@modern-js/plugin-testing 1.3.3 → 1.4.1
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/CHANGELOG.md +54 -0
- package/dist/js/modern/cli/index.js +83 -29
- package/dist/js/modern/cli/test.js +5 -35
- package/dist/js/modern/constant.js +1 -1
- package/dist/js/modern/runtime-testing/app.js +2 -2
- package/dist/js/modern/runtime-testing/reduck.js +2 -2
- package/dist/js/node/cli/index.js +91 -31
- package/dist/js/node/cli/test.js +5 -39
- package/dist/js/node/constant.js +3 -3
- package/dist/js/node/runtime-testing/app.js +1 -1
- package/dist/js/node/runtime-testing/reduck.js +1 -1
- package/dist/js/treeshaking/cli/index.js +117 -38
- package/dist/js/treeshaking/cli/test.js +11 -59
- package/dist/js/treeshaking/constant.js +1 -1
- package/dist/js/treeshaking/runtime-testing/app.js +2 -2
- package/dist/js/treeshaking/runtime-testing/reduck.js +2 -2
- package/dist/types/cli/index.d.ts +5 -1
- package/dist/types/cli/test.d.ts +3 -10
- package/dist/types/constant.d.ts +1 -1
- package/dist/types/runtime-testing/app.d.ts +1 -1
- package/dist/types/runtime-testing/resolvePlugins.d.ts +1 -1
- package/jest.config.js +0 -1
- package/package.json +19 -9
- package/{dist/js/modern/cli/plugins/modern.test.js → tests/merge-config.test.ts} +22 -25
- package/type.d.ts +0 -11
- package/dist/js/modern/cli/plugins/modern.js +0 -43
- package/dist/js/node/cli/plugins/modern.js +0 -57
- package/dist/js/node/cli/plugins/modern.test.js +0 -60
- package/dist/js/treeshaking/cli/plugins/modern.js +0 -70
- package/dist/js/treeshaking/cli/plugins/modern.test.js +0 -53
- package/dist/types/cli/plugins/modern.d.ts +0 -6
- package/dist/types/cli/plugins/modern.test.d.ts +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,59 @@
|
|
1
1
|
# @modern-js/plugin-testing
|
2
2
|
|
3
|
+
## 1.4.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- bebb39b6: chore: improve devDependencies and peerDependencies
|
8
|
+
- 132f7b53: feat: move config declarations to @modern-js/core
|
9
|
+
- 8491b6dd: fix: optimise "types" exports from plugin
|
10
|
+
- Updated dependencies [bebb39b6]
|
11
|
+
- Updated dependencies [4b4e73b7]
|
12
|
+
- Updated dependencies [da60172c]
|
13
|
+
- Updated dependencies [6cff93dc]
|
14
|
+
- Updated dependencies [132f7b53]
|
15
|
+
- Updated dependencies [9d4a005b]
|
16
|
+
- @modern-js/webpack@1.5.3
|
17
|
+
- @modern-js/testing@1.4.1
|
18
|
+
- @modern-js/utils@1.3.7
|
19
|
+
- @modern-js/testing-plugin-bff@1.3.0
|
20
|
+
|
21
|
+
## 1.4.0
|
22
|
+
|
23
|
+
### Minor Changes
|
24
|
+
|
25
|
+
- 13684fad: feat: convert testing plugin to new cli plugin
|
26
|
+
|
27
|
+
### Patch Changes
|
28
|
+
|
29
|
+
- 3a7ce758: feat(plugin-testing): convert to new plugin
|
30
|
+
- Updated dependencies [05ce88a0]
|
31
|
+
- Updated dependencies [a8df060e]
|
32
|
+
- Updated dependencies [c2046f37]
|
33
|
+
- Updated dependencies [13684fad]
|
34
|
+
- Updated dependencies [a2261fed]
|
35
|
+
- Updated dependencies [66cbef42]
|
36
|
+
- Updated dependencies [6a7acb81]
|
37
|
+
- Updated dependencies [4e2026e4]
|
38
|
+
- @modern-js/core@1.6.0
|
39
|
+
- @modern-js/utils@1.3.6
|
40
|
+
- @modern-js/testing@1.4.0
|
41
|
+
- @modern-js/testing-plugin-bff@1.3.0
|
42
|
+
- @modern-js/runtime-core@1.4.0
|
43
|
+
- @modern-js/webpack@1.5.0
|
44
|
+
|
45
|
+
## 1.3.4
|
46
|
+
|
47
|
+
### Patch Changes
|
48
|
+
|
49
|
+
- 9594df3f: fix: allow other bff plugin in unbundle mode
|
50
|
+
- Updated dependencies [deeaa602]
|
51
|
+
- Updated dependencies [54786e58]
|
52
|
+
- Updated dependencies [3da3bf48]
|
53
|
+
- @modern-js/utils@1.3.2
|
54
|
+
- @modern-js/webpack@1.4.0
|
55
|
+
- @modern-js/core@1.4.3
|
56
|
+
|
3
57
|
## 1.3.3
|
4
58
|
|
5
59
|
### Patch Changes
|
@@ -1,41 +1,95 @@
|
|
1
1
|
import path from 'path';
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { fs, PLUGIN_SCHEMAS, createRuntimeExportsUtils } from '@modern-js/utils';
|
3
|
+
import { jestConfigHook, getModuleNameMapper } from '@modern-js/testing';
|
4
|
+
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
|
5
|
+
import TestingBffPlugin from '@modern-js/testing-plugin-bff';
|
6
|
+
import { MODERNJS_CONFIG_KEY } from "../constant";
|
4
7
|
import test from "./test";
|
5
|
-
export
|
6
|
-
|
8
|
+
export const mergeUserJestConfig = testUtils => {
|
9
|
+
const resolveJestConfig = testUtils.testConfig.jest;
|
10
|
+
|
11
|
+
if (resolveJestConfig && typeof resolveJestConfig !== 'function') {
|
12
|
+
testUtils.mergeJestConfig(resolveJestConfig);
|
13
|
+
}
|
14
|
+
|
15
|
+
if (typeof resolveJestConfig === 'function') {
|
16
|
+
resolveJestConfig(testUtils.jestConfig);
|
17
|
+
}
|
18
|
+
};
|
19
|
+
export default (() => {
|
20
|
+
const BffPlugin = TestingBffPlugin();
|
7
21
|
return {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
});
|
22
|
+
name: '@modern-js/plugin-testing',
|
23
|
+
usePlugins: [BffPlugin],
|
24
|
+
post: [BffPlugin.name],
|
25
|
+
registerHook: {
|
26
|
+
jestConfig: jestConfigHook
|
14
27
|
},
|
28
|
+
setup: api => {
|
29
|
+
let testingExportsUtils;
|
30
|
+
const appContext = api.useAppContext();
|
31
|
+
const userConfig = api.useResolvedConfigContext();
|
32
|
+
return {
|
33
|
+
commands: ({
|
34
|
+
program
|
35
|
+
}) => {
|
36
|
+
program.command('test').allowUnknownOption().usage('[options]').action(async () => {
|
37
|
+
await test(api);
|
38
|
+
});
|
39
|
+
},
|
15
40
|
|
16
|
-
|
17
|
-
|
18
|
-
|
41
|
+
validateSchema() {
|
42
|
+
return PLUGIN_SCHEMAS['@modern-js/plugin-testing'];
|
43
|
+
},
|
19
44
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
45
|
+
config() {
|
46
|
+
testingExportsUtils = createRuntimeExportsUtils(appContext.internalDirectory, 'testing');
|
47
|
+
return {
|
48
|
+
source: {
|
49
|
+
alias: {
|
50
|
+
'@modern-js/runtime/testing': testingExportsUtils.getPath()
|
51
|
+
}
|
52
|
+
}
|
53
|
+
};
|
54
|
+
},
|
55
|
+
|
56
|
+
addRuntimeExports() {
|
57
|
+
const testingPath = path.resolve(__dirname, '../');
|
58
|
+
testingExportsUtils.addExport(`export * from '${testingPath}'`);
|
59
|
+
},
|
60
|
+
|
61
|
+
jestConfig: async (utils, next) => {
|
62
|
+
const existSrc = await fs.pathExists(appContext.srcDirectory);
|
63
|
+
|
64
|
+
if (!existSrc) {
|
65
|
+
return next(utils);
|
28
66
|
}
|
67
|
+
|
68
|
+
const webpackConfig = getWebpackConfig(WebpackConfigTarget.CLIENT);
|
69
|
+
const {
|
70
|
+
resolve: {
|
71
|
+
alias = {}
|
72
|
+
}
|
73
|
+
} = webpackConfig;
|
74
|
+
utils.mergeJestConfig({
|
75
|
+
globals: {
|
76
|
+
[MODERNJS_CONFIG_KEY]: userConfig
|
77
|
+
},
|
78
|
+
moduleNameMapper: getModuleNameMapper(alias),
|
79
|
+
testEnvironment: 'jsdom',
|
80
|
+
resolver: require.resolve("./resolver")
|
81
|
+
});
|
82
|
+
utils.setJestConfig({
|
83
|
+
rootDir: appContext.appDirectory || process.cwd(),
|
84
|
+
// todo: diffrent test root for diffrent solutions
|
85
|
+
// testMatch: [`<rootDir>/(src|tests|electron)/**/*.test.[jt]s?(x)`],
|
86
|
+
// testMatch bug on windows, issue: https://github.com/facebook/jest/issues/7914
|
87
|
+
testMatch: [`<rootDir>/src/**/*.test.[jt]s?(x)`, `<rootDir>/tests/**/*.test.[jt]s?(x)`, `<rootDir>/electron/**/*.test.[jt]s?(x)`]
|
88
|
+
});
|
89
|
+
mergeUserJestConfig(utils);
|
90
|
+
return next(utils);
|
29
91
|
}
|
30
92
|
};
|
31
|
-
},
|
32
|
-
|
33
|
-
addRuntimeExports() {
|
34
|
-
const testingPath = path.resolve(__dirname, '../');
|
35
|
-
testingExportsUtils.addExport(`export * from '${testingPath}'`);
|
36
93
|
}
|
37
|
-
|
38
94
|
};
|
39
|
-
}, {
|
40
|
-
name: '@modern-js/plugin-testing'
|
41
95
|
});
|
@@ -1,21 +1,10 @@
|
|
1
1
|
import path from 'path';
|
2
2
|
import { compiler } from '@modern-js/babel-compiler';
|
3
|
-
import { useAppContext, useResolvedConfigContext } from '@modern-js/core';
|
4
3
|
import { runTest } from '@modern-js/testing';
|
5
|
-
import { getWebpackConfig, WebpackConfigTarget } from '@modern-js/webpack';
|
6
|
-
import testingBffPlugin from '@modern-js/testing-plugin-bff';
|
7
|
-
import { fs } from '@modern-js/utils';
|
8
|
-
import modernTestPlugin from "./plugins/modern";
|
9
4
|
|
10
|
-
const test = async
|
11
|
-
|
12
|
-
const
|
13
|
-
|
14
|
-
const config = useAppContext();
|
15
|
-
const {
|
16
|
-
srcDirectory
|
17
|
-
} = config;
|
18
|
-
const existSrc = await fs.pathExists(srcDirectory);
|
5
|
+
const test = async api => {
|
6
|
+
const userConfig = api.useResolvedConfigContext();
|
7
|
+
const appContext = api.useAppContext();
|
19
8
|
userConfig.testing = userConfig.testing || {};
|
20
9
|
const jest = userConfig.testing.jest || userConfig.tools.jest;
|
21
10
|
|
@@ -24,26 +13,7 @@ const test = async () => {
|
|
24
13
|
}
|
25
14
|
|
26
15
|
userConfig.testing.jest = userConfig.testing.jest || userConfig.tools.jest;
|
27
|
-
|
28
|
-
if (existSrc) {
|
29
|
-
// todo: consider lib-tools ...
|
30
|
-
const webpackConfigs = getWebpackConfig(WebpackConfigTarget.CLIENT);
|
31
|
-
userConfig.testing.plugins = [...(userConfig.testing.plugins || []), modernTestPlugin(webpackConfigs, userConfig, config.appDirectory), testingBffPlugin({
|
32
|
-
pwd: config.appDirectory,
|
33
|
-
userConfig,
|
34
|
-
plugins: config.plugins.map(p => p.server).filter(Boolean),
|
35
|
-
routes: config.serverRoutes
|
36
|
-
})];
|
37
|
-
} else {
|
38
|
-
userConfig.testing.plugins = [...(userConfig.testing.plugins || []), testingBffPlugin({
|
39
|
-
pwd: config.appDirectory,
|
40
|
-
userConfig,
|
41
|
-
plugins: config.plugins.map(p => p.server).filter(Boolean),
|
42
|
-
routes: config.serverRoutes
|
43
|
-
})];
|
44
|
-
}
|
45
|
-
|
46
|
-
const runtimeExportsPath = path.join(config.internalDirectory, '.runtime-exports');
|
16
|
+
const runtimeExportsPath = path.join(appContext.internalDirectory, '.runtime-exports');
|
47
17
|
await compiler({
|
48
18
|
sourceDir: runtimeExportsPath,
|
49
19
|
rootDir: runtimeExportsPath,
|
@@ -54,7 +24,7 @@ const test = async () => {
|
|
54
24
|
modules: 'cjs'
|
55
25
|
}]]
|
56
26
|
});
|
57
|
-
await runTest(userConfig.testing);
|
27
|
+
await runTest(api, userConfig.testing);
|
58
28
|
};
|
59
29
|
|
60
30
|
export default test;
|
@@ -1 +1 @@
|
|
1
|
-
export const
|
1
|
+
export const MODERNJS_CONFIG_KEY = '__modernjs_config__';
|
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
6
|
|
7
7
|
import { createApp } from '@modern-js/runtime-core';
|
8
|
-
import {
|
8
|
+
import { MODERNJS_CONFIG_KEY } from "../constant";
|
9
9
|
import resolvePlugins from "./resolvePlugins";
|
10
10
|
|
11
11
|
class ModernRuntime {
|
@@ -48,4 +48,4 @@ class ModernRuntime {
|
|
48
48
|
|
49
49
|
}
|
50
50
|
|
51
|
-
export default new ModernRuntime(global[
|
51
|
+
export default new ModernRuntime(global[MODERNJS_CONFIG_KEY] || {});
|
@@ -8,7 +8,7 @@ import { createStore as originCreateStore } from '@modern-js-reduck/store';
|
|
8
8
|
import effectsPlugin from '@modern-js-reduck/plugin-effects';
|
9
9
|
import autoActionsPlugin from '@modern-js-reduck/plugin-auto-actions';
|
10
10
|
import immerPlugin from '@modern-js-reduck/plugin-immutable';
|
11
|
-
import {
|
11
|
+
import { MODERNJS_CONFIG_KEY } from "../constant";
|
12
12
|
export const effects = () => effectsPlugin;
|
13
13
|
export const immer = () => immerPlugin;
|
14
14
|
export const autoActions = () => autoActionsPlugin;
|
@@ -16,7 +16,7 @@ export const createStore = props => {
|
|
16
16
|
const createStatePlugins = () => {
|
17
17
|
var _modernConfig$runtime;
|
18
18
|
|
19
|
-
const modernConfig = global[
|
19
|
+
const modernConfig = global[MODERNJS_CONFIG_KEY];
|
20
20
|
const stateConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$runtime = modernConfig.runtime) === null || _modernConfig$runtime === void 0 ? void 0 : _modernConfig$runtime.state;
|
21
21
|
const plugins = [];
|
22
22
|
|
@@ -3,55 +3,115 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default = void 0;
|
6
|
+
exports.mergeUserJestConfig = exports.default = void 0;
|
7
7
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
9
9
|
|
10
10
|
var _utils = require("@modern-js/utils");
|
11
11
|
|
12
|
-
var
|
12
|
+
var _testing = require("@modern-js/testing");
|
13
|
+
|
14
|
+
var _webpack = require("@modern-js/webpack");
|
15
|
+
|
16
|
+
var _testingPluginBff = _interopRequireDefault(require("@modern-js/testing-plugin-bff"));
|
17
|
+
|
18
|
+
var _constant = require("../constant");
|
13
19
|
|
14
20
|
var _test = _interopRequireDefault(require("./test"));
|
15
21
|
|
16
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
23
|
|
18
|
-
|
19
|
-
|
24
|
+
const mergeUserJestConfig = testUtils => {
|
25
|
+
const resolveJestConfig = testUtils.testConfig.jest;
|
26
|
+
|
27
|
+
if (resolveJestConfig && typeof resolveJestConfig !== 'function') {
|
28
|
+
testUtils.mergeJestConfig(resolveJestConfig);
|
29
|
+
}
|
30
|
+
|
31
|
+
if (typeof resolveJestConfig === 'function') {
|
32
|
+
resolveJestConfig(testUtils.jestConfig);
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
exports.mergeUserJestConfig = mergeUserJestConfig;
|
37
|
+
|
38
|
+
var _default = () => {
|
39
|
+
const BffPlugin = (0, _testingPluginBff.default)();
|
20
40
|
return {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
});
|
41
|
+
name: '@modern-js/plugin-testing',
|
42
|
+
usePlugins: [BffPlugin],
|
43
|
+
post: [BffPlugin.name],
|
44
|
+
registerHook: {
|
45
|
+
jestConfig: _testing.jestConfigHook
|
27
46
|
},
|
47
|
+
setup: api => {
|
48
|
+
let testingExportsUtils;
|
49
|
+
const appContext = api.useAppContext();
|
50
|
+
const userConfig = api.useResolvedConfigContext();
|
51
|
+
return {
|
52
|
+
commands: ({
|
53
|
+
program
|
54
|
+
}) => {
|
55
|
+
program.command('test').allowUnknownOption().usage('[options]').action(async () => {
|
56
|
+
await (0, _test.default)(api);
|
57
|
+
});
|
58
|
+
},
|
28
59
|
|
29
|
-
|
30
|
-
|
31
|
-
|
60
|
+
validateSchema() {
|
61
|
+
return _utils.PLUGIN_SCHEMAS['@modern-js/plugin-testing'];
|
62
|
+
},
|
32
63
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
64
|
+
config() {
|
65
|
+
testingExportsUtils = (0, _utils.createRuntimeExportsUtils)(appContext.internalDirectory, 'testing');
|
66
|
+
return {
|
67
|
+
source: {
|
68
|
+
alias: {
|
69
|
+
'@modern-js/runtime/testing': testingExportsUtils.getPath()
|
70
|
+
}
|
71
|
+
}
|
72
|
+
};
|
73
|
+
},
|
74
|
+
|
75
|
+
addRuntimeExports() {
|
76
|
+
const testingPath = _path.default.resolve(__dirname, '../');
|
77
|
+
|
78
|
+
testingExportsUtils.addExport(`export * from '${testingPath}'`);
|
79
|
+
},
|
80
|
+
|
81
|
+
jestConfig: async (utils, next) => {
|
82
|
+
const existSrc = await _utils.fs.pathExists(appContext.srcDirectory);
|
83
|
+
|
84
|
+
if (!existSrc) {
|
85
|
+
return next(utils);
|
41
86
|
}
|
87
|
+
|
88
|
+
const webpackConfig = (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.CLIENT);
|
89
|
+
const {
|
90
|
+
resolve: {
|
91
|
+
alias = {}
|
92
|
+
}
|
93
|
+
} = webpackConfig;
|
94
|
+
utils.mergeJestConfig({
|
95
|
+
globals: {
|
96
|
+
[_constant.MODERNJS_CONFIG_KEY]: userConfig
|
97
|
+
},
|
98
|
+
moduleNameMapper: (0, _testing.getModuleNameMapper)(alias),
|
99
|
+
testEnvironment: 'jsdom',
|
100
|
+
resolver: require.resolve("./resolver")
|
101
|
+
});
|
102
|
+
utils.setJestConfig({
|
103
|
+
rootDir: appContext.appDirectory || process.cwd(),
|
104
|
+
// todo: diffrent test root for diffrent solutions
|
105
|
+
// testMatch: [`<rootDir>/(src|tests|electron)/**/*.test.[jt]s?(x)`],
|
106
|
+
// testMatch bug on windows, issue: https://github.com/facebook/jest/issues/7914
|
107
|
+
testMatch: [`<rootDir>/src/**/*.test.[jt]s?(x)`, `<rootDir>/tests/**/*.test.[jt]s?(x)`, `<rootDir>/electron/**/*.test.[jt]s?(x)`]
|
108
|
+
});
|
109
|
+
mergeUserJestConfig(utils);
|
110
|
+
return next(utils);
|
42
111
|
}
|
43
112
|
};
|
44
|
-
},
|
45
|
-
|
46
|
-
addRuntimeExports() {
|
47
|
-
const testingPath = _path.default.resolve(__dirname, '../');
|
48
|
-
|
49
|
-
testingExportsUtils.addExport(`export * from '${testingPath}'`);
|
50
113
|
}
|
51
|
-
|
52
114
|
};
|
53
|
-
}
|
54
|
-
name: '@modern-js/plugin-testing'
|
55
|
-
});
|
115
|
+
};
|
56
116
|
|
57
117
|
exports.default = _default;
|
package/dist/js/node/cli/test.js
CHANGED
@@ -9,29 +9,13 @@ var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
10
10
|
var _babelCompiler = require("@modern-js/babel-compiler");
|
11
11
|
|
12
|
-
var _core = require("@modern-js/core");
|
13
|
-
|
14
12
|
var _testing = require("@modern-js/testing");
|
15
13
|
|
16
|
-
var _webpack = require("@modern-js/webpack");
|
17
|
-
|
18
|
-
var _testingPluginBff = _interopRequireDefault(require("@modern-js/testing-plugin-bff"));
|
19
|
-
|
20
|
-
var _utils = require("@modern-js/utils");
|
21
|
-
|
22
|
-
var _modern = _interopRequireDefault(require("./plugins/modern"));
|
23
|
-
|
24
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
15
|
|
26
|
-
const test = async
|
27
|
-
|
28
|
-
const
|
29
|
-
|
30
|
-
const config = (0, _core.useAppContext)();
|
31
|
-
const {
|
32
|
-
srcDirectory
|
33
|
-
} = config;
|
34
|
-
const existSrc = await _utils.fs.pathExists(srcDirectory);
|
16
|
+
const test = async api => {
|
17
|
+
const userConfig = api.useResolvedConfigContext();
|
18
|
+
const appContext = api.useAppContext();
|
35
19
|
userConfig.testing = userConfig.testing || {};
|
36
20
|
const jest = userConfig.testing.jest || userConfig.tools.jest;
|
37
21
|
|
@@ -41,25 +25,7 @@ const test = async () => {
|
|
41
25
|
|
42
26
|
userConfig.testing.jest = userConfig.testing.jest || userConfig.tools.jest;
|
43
27
|
|
44
|
-
|
45
|
-
// todo: consider lib-tools ...
|
46
|
-
const webpackConfigs = (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.CLIENT);
|
47
|
-
userConfig.testing.plugins = [...(userConfig.testing.plugins || []), (0, _modern.default)(webpackConfigs, userConfig, config.appDirectory), (0, _testingPluginBff.default)({
|
48
|
-
pwd: config.appDirectory,
|
49
|
-
userConfig,
|
50
|
-
plugins: config.plugins.map(p => p.server).filter(Boolean),
|
51
|
-
routes: config.serverRoutes
|
52
|
-
})];
|
53
|
-
} else {
|
54
|
-
userConfig.testing.plugins = [...(userConfig.testing.plugins || []), (0, _testingPluginBff.default)({
|
55
|
-
pwd: config.appDirectory,
|
56
|
-
userConfig,
|
57
|
-
plugins: config.plugins.map(p => p.server).filter(Boolean),
|
58
|
-
routes: config.serverRoutes
|
59
|
-
})];
|
60
|
-
}
|
61
|
-
|
62
|
-
const runtimeExportsPath = _path.default.join(config.internalDirectory, '.runtime-exports');
|
28
|
+
const runtimeExportsPath = _path.default.join(appContext.internalDirectory, '.runtime-exports');
|
63
29
|
|
64
30
|
await (0, _babelCompiler.compiler)({
|
65
31
|
sourceDir: runtimeExportsPath,
|
@@ -71,7 +37,7 @@ const test = async () => {
|
|
71
37
|
modules: 'cjs'
|
72
38
|
}]]
|
73
39
|
});
|
74
|
-
await (0, _testing.runTest)(userConfig.testing);
|
40
|
+
await (0, _testing.runTest)(api, userConfig.testing);
|
75
41
|
};
|
76
42
|
|
77
43
|
var _default = test;
|
package/dist/js/node/constant.js
CHANGED
@@ -3,6 +3,6 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
7
|
-
const
|
8
|
-
exports.
|
6
|
+
exports.MODERNJS_CONFIG_KEY = void 0;
|
7
|
+
const MODERNJS_CONFIG_KEY = '__modernjs_config__';
|
8
|
+
exports.MODERNJS_CONFIG_KEY = MODERNJS_CONFIG_KEY;
|
@@ -39,7 +39,7 @@ const createStore = props => {
|
|
39
39
|
const createStatePlugins = () => {
|
40
40
|
var _modernConfig$runtime;
|
41
41
|
|
42
|
-
const modernConfig = global[_constant.
|
42
|
+
const modernConfig = global[_constant.MODERNJS_CONFIG_KEY];
|
43
43
|
const stateConfig = modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig$runtime = modernConfig.runtime) === null || _modernConfig$runtime === void 0 ? void 0 : _modernConfig$runtime.state;
|
44
44
|
const plugins = [];
|
45
45
|
|