Files
appium/test/setup.js
Christopher Hiller f0cb12d2e8 chore(eslint-config-appium): dev & test env improvements
- add `jsconfig.json` for the TS language server to understand the project
- update `.wallaby.js` to transpile fixtures if necessary; run on save to reduce lag
- update single-file Mocha debug launch config
- add `test` env in `babel.config.json` which is used by the former
- add some handy vscode tasks
- add a bunch of types
- remove unused `babel-eslint` (we use `@babel/eslint-parser`)
- bump `ecmaVersion` in `eslint-config-appium`
- remove cruft from babel configs (`shippedProposals: true` goes a long way)
- enable `sinon-chai` globally in tests
- add `rewiremock` for module-level mocking (sinon cannot do this itself, but they work in tandem)
2021-10-20 11:39:59 -07:00

26 lines
1010 B
JavaScript

'use strict';
/**
* Mocha will load this file to configure the environment to use Chai as the
* assertion library. Since Chai is a singleton, we can run into problems when
* running files individually, if we have not carefully configured Chai in every
* single test file. This file means less boilerplate and less random test
* failures when running single test files.
*
* For simplicity, this file is _not_ transpiled. If it were, Mocha would need
* to load different versions of this file depending on the test context (are we
* running tests against the distfiles, or the source files?).
*
* @module
*/
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const sinonChai = require('sinon-chai');
// The `chai` global is set if a test needs something special.
// Most tests won't need this.
global.chai = chai.use(chaiAsPromised).use(sinonChai);
// `should()` is only necessary when working with some `null` or `undefined` values.
global.should = chai.should();