Skip to content

Commit 684a758

Browse files
committed
fix: update inBand runs failing, reorganize jest configs
Signed-off-by: Charlike Mike Reagent <[email protected]>
1 parent 52213cb commit 684a758

File tree

9 files changed

+45
-29
lines changed

9 files changed

+45
-29
lines changed

@tunnckocore/create-jest-runner/src/createJestRunner.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,18 @@ const createRunner = (runPath, { getExtraOptions } = {}) => {
7878
return runner(baseOptions);
7979
});
8080
})
81-
.then((result) => onResult(test, result))
81+
.then((testResult) => {
82+
if (Array.isArray(testResult)) {
83+
testResult.forEach((result) =>
84+
result.numFailingTests > 0
85+
? onFailure(test, new Error(result.errorMessage))
86+
: onResult(test, result),
87+
);
88+
return;
89+
}
90+
91+
onResult(test, testResult);
92+
})
8293
.catch((err) => onFailure(test, err)),
8394
),
8495
Promise.resolve(),

jest-runner.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
config: {
2323
presets: [['@tunnckocore/babel-preset', presetOptions]],
2424
comments: false,
25-
sourceMaps: 'both',
25+
sourceMaps: true,
2626
},
2727
outDir: 'dist/main',
2828
},
@@ -32,7 +32,7 @@ module.exports = {
3232
['@tunnckocore/babel-preset', { ...presetOptions, modules: false }],
3333
],
3434
comments: false,
35-
sourceMaps: 'both',
35+
sourceMaps: true,
3636
},
3737
outDir: 'dist/module',
3838
},

jest.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

jest.build.config.js renamed to jest/build.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
const utils = require('./@tunnckocore/utils/src');
1+
const path = require('path');
2+
const utils = require('../@tunnckocore/utils/src');
23

3-
const { exts } = utils.getWorkspacesAndExtensions(__dirname);
4+
const ROOT = path.dirname(__dirname);
5+
const { exts } = utils.getWorkspacesAndExtensions(ROOT);
46

57
module.exports = {
8+
rootDir: ROOT,
69
displayName: 'build',
7-
rootDir: __dirname,
810
testMatch: [
911
'<rootDir>/packages/*/src/**/*',
1012
'<rootDir>/@tunnckocore/*/src/**/*',
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
const utils = require('./@tunnckocore/utils/src');
1+
const path = require('path');
2+
const utils = require('../@tunnckocore/utils/src');
23

3-
const { exts } = utils.getWorkspacesAndExtensions(__dirname);
4+
const ROOT = path.dirname(__dirname);
5+
const { exts } = utils.getWorkspacesAndExtensions(ROOT);
46

57
module.exports = {
8+
rootDir: ROOT,
69
displayName: 'bundle',
7-
rootDir: __dirname,
810
testMatch: [
911
// '<rootDir>/src/index.ts',
1012
// '<rootDir>/packages/*/src/**/*',
11-
`<rootDir>/@tunnckocore/*/src/index.js`,
13+
`<rootDir>/@tunnckocore/execa/src/index.js`,
1214
// `<rootDir>/src/zzz*`,
1315
],
1416
testPathIgnorePatterns: [
@@ -18,5 +20,5 @@ module.exports = {
1820
],
1921
// moduleNameMapper: alias,
2022
moduleFileExtensions: exts,
21-
runner: './packages/jest-runner-rollup/src/index.js',
23+
runner: path.join(ROOT, 'packages/jest-runner-rollup/src/index.js'),
2224
};

jest/full.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* eslint-disable global-require */
2+
module.exports = {
3+
projects: [require('./lint'), require('./test'), require('./build')],
4+
};

jest.lint.config.js renamed to jest/lint.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
const utils = require('./@tunnckocore/utils/src');
1+
const path = require('path');
2+
const utils = require('../@tunnckocore/utils/src');
23

3-
const { alias, exts } = utils.createAliases(__dirname, 'src');
4+
const ROOT = path.dirname(__dirname);
5+
const { alias, exts } = utils.createAliases(ROOT, 'src');
46

57
module.exports = {
8+
rootDir: ROOT,
69
displayName: 'lint',
7-
rootDir: __dirname,
810
testMatch: [
911
'<rootDir>/packages/*/src/**/*',
1012
'<rootDir>/@tunnckocore/*/src/**/*',

jest.test.config.js renamed to jest/test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
const utils = require('./@tunnckocore/utils/src');
1+
const path = require('path');
2+
const utils = require('../@tunnckocore/utils/src');
23

3-
const { alias } = utils.createAliases(__dirname, 'src');
4+
const ROOT = path.dirname(__dirname);
5+
const { alias } = utils.createAliases(ROOT, 'src');
46

57
module.exports = {
8+
rootDir: ROOT,
69
displayName: 'test',
7-
rootDir: __dirname,
810
testMatch: [
911
'<rootDir>/packages/*/test/**/*',
1012
'<rootDir>/@tunnckocore/*/test/**/*',

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
"clean:fresh": "lerna clean -y && rm -rf node_modules",
1717
"clean:dist": "rm -rf packages/*/dist @tunnckocore/*/dist",
1818
"pre-commit": "yarn jest:all || (yarn resque && yarn jest:all)",
19-
"jest:all": "jest -c jest.config.js",
20-
"lint": "jest -c jest.lint.config.js",
21-
"test": "jest -c jest.test.config.js",
22-
"build": "jest -c jest.build.config.js",
23-
"bundle": "jest -c jest.bundle.config.js",
19+
"jest:all": "jest -c jest/full.js",
20+
"lint": "jest -c jest/lint.js",
21+
"test": "jest -c jest/test.js",
22+
"build": "jest -c jest/build.js",
23+
"bundle": "jest -c jest/bundle.js",
2424
"release": "lerna version && lerna publish from-package",
2525
"cr": "node create-package.js",
2626
"fmt": "prettier '**/*' --write --check",

0 commit comments

Comments
 (0)