Skip to content

Commit da40e62

Browse files
authored
chore: make mocha tests fail on unhandled rejections (#4466)
1 parent 862908a commit da40e62

File tree

25 files changed

+112
-27
lines changed

25 files changed

+112
-27
lines changed

configs/mocha-config-compass/compass-plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const path = require('path');
23
const reactConfig = require('./react');
34

configs/mocha-config-compass/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const path = require('path');
23
const specs = process.argv.slice(2).filter((arg) => !arg.startsWith('-'));
34

@@ -23,6 +24,7 @@ module.exports = {
2324
path.resolve(__dirname, 'register', 'assets-import-register.js'),
2425
path.resolve(__dirname, 'register', 'tsnode-register.js'),
2526
path.resolve(__dirname, 'register', 'sinon-chai-register.js'),
27+
path.resolve(__dirname, 'register', 'unhandled-rejections.js'),
2628
],
2729
// Allows to run tests against a particular set of specs instead of all of them
2830
spec: specs.length > 0 ? specs : defaultSpecs,

configs/mocha-config-compass/main-process.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const { initialize, enable } = require('@electron/remote/main');
23
const { app } = require('electron');
34
app.on('web-contents-created', function (_, webContents) {

configs/mocha-config-compass/react.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const path = require('path');
23
const base = require('.');
34

configs/mocha-config-compass/register/assets-import-register.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const filepathExports = (module, filepath) => {
23
module.exports = require('path').relative(module.parent.path, filepath);
34
};

configs/mocha-config-compass/register/chai-dom-register.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const chai = require('chai');
23
const chaiDom = require('chai-dom');
34

configs/mocha-config-compass/register/css-import-register.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const identityObjProxy = require('identity-obj-proxy');
23

34
const identityProxyExports = (module) => {

configs/mocha-config-compass/register/electron-renderer-register.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const isElectronRenderer = require('is-electron-renderer');
23

34
// We are overriding default mocha-electron handling of console as it can throw

configs/mocha-config-compass/register/enzyme-register.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
const chai = require('chai');
23
const Enzyme = require('enzyme');
34
const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');

configs/mocha-config-compass/register/jsdom-global-register.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use strict';
12
if (typeof window === 'undefined') {
23
require('global-jsdom')(undefined, { pretendToBeVisual: true });
34
}

0 commit comments

Comments
 (0)