balena-supervisor/test/lib/chai.ts
Felipe Lalanne c1e6dadeb4 Create test/unit and test/integration folders
This sets up the new `test/unit` and `test/integration` folders
and starts classification of some of the test files.

Note that unit tests include, `fs-utils` and `system-info` tests.

While these tests interact with the filesystem, the implementation
of these modules is simple enough, and the tests are fast enough to
allow these tests to fall under the `unit` test category (according to
test/README)

Change-type: patch
2022-08-24 14:28:36 -04:00

26 lines
941 B
TypeScript

import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import * as sinonChai from 'sinon-chai';
import * as chaiThings from 'chai-things';
import * as chaiLike from 'chai-like';
/**
* Mocha runs this EXACTLY ONCE before all tests to set up globals that
* are used among all test files, such as chai assertion plugins. See
* https://mochajs.org/#test-fixture-decision-tree-wizard-thing
*
* IMPORTANT: The functionality in this global fixture hook should not break any
* suite run in isolation, and it should be required by ALL test suites.
* If unsure whether to add to global fixtures, refer to the chart above.
* Also, avoid setting global mutable variables here.
*/
export const mochaGlobalSetup = function () {
console.log('Setting up global fixtures for tests...');
/* Setup chai assertion plugins */
chai.use(chaiAsPromised);
chai.use(sinonChai);
chai.use(chaiLike);
chai.use(chaiThings);
};