@lipemat/js-boilerplate 9.4.1 → 9.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/jest.config.js +4 -0
- package/package.json +1 -1
- package/scripts/test.js +25 -10
package/config/jest.config.js
CHANGED
|
@@ -28,8 +28,12 @@ let jestConfig = {
|
|
|
28
28
|
'^.+\\.[tj]sx?$': [ 'babel-jest', babelConfig ],
|
|
29
29
|
},
|
|
30
30
|
setupFilesAfterEnv: [
|
|
31
|
+
// @todo Remove old "tests" directory on next major release.
|
|
31
32
|
path.resolve( packageConfig.workingDirectory, 'tests/setup.js' ),
|
|
32
33
|
path.resolve( packageConfig.workingDirectory, 'tests/setup.ts' ),
|
|
34
|
+
|
|
35
|
+
// New location.
|
|
36
|
+
path.resolve( packageConfig.workingDirectory, 'jest/setup.ts' ),
|
|
33
37
|
].filter( fs.existsSync ),
|
|
34
38
|
};
|
|
35
39
|
|
package/package.json
CHANGED
package/scripts/test.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const {resolve: pathResolve} = require( 'path' );
|
|
2
|
+
const {existsSync} = require( 'fs' );
|
|
3
|
+
|
|
4
|
+
const {getPackageConfig} = require( '../helpers/package-config' );
|
|
5
|
+
|
|
6
|
+
const packageConfig = getPackageConfig();
|
|
7
|
+
|
|
8
|
+
const possibleConfig = [
|
|
9
|
+
// @todo Remove pulling from the root on next major release.
|
|
10
|
+
pathResolve( packageConfig.workingDirectory + '/jest.config.ts' ),
|
|
11
|
+
pathResolve( packageConfig.workingDirectory + '/jest.config.js' ),
|
|
12
|
+
|
|
13
|
+
// New location.
|
|
14
|
+
pathResolve( packageConfig.workingDirectory + '/jest/jest.config.ts' ),
|
|
15
|
+
pathResolve( packageConfig.workingDirectory + '/jest/jest.config.js' ),
|
|
16
|
+
].filter( existsSync );
|
|
17
|
+
|
|
18
|
+
if ( possibleConfig.length < 1 ) {
|
|
19
|
+
throw new Error( 'You must have a `jest.config.[tj]s` file in the root of your project or in the `jest` folder.' );
|
|
20
|
+
} else {
|
|
21
|
+
const file = possibleConfig.shift();
|
|
22
|
+
if ( undefined !== file ) {
|
|
23
|
+
process.argv.push( '--config', file );
|
|
24
|
+
}
|
|
25
|
+
}
|
|
11
26
|
|
|
12
27
|
require( 'jest-cli/bin/jest' );
|