-
Notifications
You must be signed in to change notification settings - Fork 62
/
.mocharc.js
36 lines (31 loc) · 1.02 KB
/
.mocharc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const { nodeFs } = require('@file-services/node');
const { dirname } = require('path');
module.exports = {
colors: true,
'enable-source-maps': true,
...getRequire(),
};
function getRequire() {
let launchedPath;
const root = dirname(require.resolve('./package.json'));
const packagesSet = new Set([root]);
const packages = [
'webpack-plugin',
'rollup-plugin',
'webpack-extensions',
'custom-value',
'experimental-loader',
];
for (const packageName of packages) {
packagesSet.add(dirname(require.resolve(`@stylable/${packageName}/package.json`)));
}
// we get this env variable from ./.vscode/launch.json (f5 - Mocha Current)
if (process.env.FILE) {
launchedPath = dirname(nodeFs.findClosestFileSync(process.env.FILE, 'package.json'));
} else {
launchedPath = process.cwd();
}
return packagesSet.has(launchedPath)
? { require: require.resolve('@stylable/e2e-test-kit/dist/browser-server.js') }
: {};
}