@lipemat/js-boilerplate 9.4.0 → 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.
@@ -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
 
@@ -85,7 +85,7 @@ module.exports = {
85
85
  new ForkTsCheckerWebpackPlugin( {
86
86
  formatter: 'basic',
87
87
  typescript: {
88
- configFile: getTsConfigFile(),
88
+ configFile: config.workingDirectory + '/tsconfig.json',
89
89
  },
90
90
  } ),
91
91
  new SubresourceIntegrityPlugin( {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "9.4.0",
3
+ "version": "9.4.2",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "author": "Mat Lipe",
6
6
  "license": "MIT",
package/scripts/test.js CHANGED
@@ -1,12 +1,27 @@
1
- /**
2
- * Runs `jest` with any arguments passed via the terminal or yarn.
3
- *
4
- * @notice you must add `/templates/jest.config.js` to the `jsPath` of your project.
5
- *
6
- * @example `lipemat-js-boilerplate test`
7
- */
8
-
9
- const packageConfig = require( '../helpers/package-config' );
10
- process.argv.push( '--config', packageConfig.workingDirectory + '/jest.config.js' );
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' );