@modern-js/plugin-testing 2.0.0-beta.1 → 2.0.0-beta.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/CHANGELOG.md +55 -0
- package/dist/types/base/config/index.d.ts +10 -0
- package/dist/types/base/config/testConfigOperator.d.ts +1 -115
- package/dist/types/base/hook.d.ts +4 -6
- package/dist/types/base/runJest.d.ts +7 -1
- package/dist/types/cli/bff/index.d.ts +7 -1
- package/dist/types/cli/index.d.ts +7 -1
- package/dist/types/cli/test.d.ts +7 -1
- package/dist/types/runtime-testing/app.d.ts +12 -2
- package/dist/types/runtime-testing/resolvePlugins.d.ts +5 -1
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,60 @@
|
|
1
1
|
# @modern-js/plugin-testing
|
2
2
|
|
3
|
+
## 2.0.0-beta.2
|
4
|
+
|
5
|
+
### Major Changes
|
6
|
+
|
7
|
+
- dda38c9c3e: chore: v2
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- cc971eabfc: refactor: move server plugin load logic in `@modern-js/core`
|
12
|
+
refactor:移除在 `@modern-js/core` 中的 server 插件加载逻辑
|
13
|
+
- 14b712da84: fix: use consistent alias type and default value across packages
|
14
|
+
|
15
|
+
fix: 在各个包中使用一致的 alias 类型定义和默认值
|
16
|
+
|
17
|
+
- Updated dependencies [2344eb2]
|
18
|
+
- Updated dependencies [a11fcf8]
|
19
|
+
- Updated dependencies [b18fa8f3ed]
|
20
|
+
- Updated dependencies [c9e800d39a]
|
21
|
+
- Updated dependencies [d032d49]
|
22
|
+
- Updated dependencies [15bf09d9c8]
|
23
|
+
- Updated dependencies [3e57f2b]
|
24
|
+
- Updated dependencies [fbf5eed]
|
25
|
+
- Updated dependencies [a2509bfbdb]
|
26
|
+
- Updated dependencies [decfcd989d]
|
27
|
+
- Updated dependencies [e4357f1]
|
28
|
+
- Updated dependencies [4369648ae2]
|
29
|
+
- Updated dependencies [92f0ead]
|
30
|
+
- Updated dependencies [92c0994]
|
31
|
+
- Updated dependencies [edd1cfb1af]
|
32
|
+
- Updated dependencies [cc971eabfc]
|
33
|
+
- Updated dependencies [5b9049f2e9]
|
34
|
+
- Updated dependencies [6bda14ed71]
|
35
|
+
- Updated dependencies [92004d1]
|
36
|
+
- Updated dependencies [b8bbe036c7]
|
37
|
+
- Updated dependencies [40ed587]
|
38
|
+
- Updated dependencies [60d5378632]
|
39
|
+
- Updated dependencies [d5a31df781]
|
40
|
+
- Updated dependencies [dda38c9c3e]
|
41
|
+
- Updated dependencies [102d32e4ba]
|
42
|
+
- Updated dependencies [8b8e1bb571]
|
43
|
+
- Updated dependencies [3bbea92b2a]
|
44
|
+
- Updated dependencies [73cd29dd9f]
|
45
|
+
- Updated dependencies [18aaf42]
|
46
|
+
- Updated dependencies [f179749]
|
47
|
+
- Updated dependencies [fcace5b5b9]
|
48
|
+
- Updated dependencies [abf3421a75]
|
49
|
+
- Updated dependencies [543be9558e]
|
50
|
+
- Updated dependencies [14b712da84]
|
51
|
+
- @modern-js/runtime@2.0.0-beta.2
|
52
|
+
- @modern-js/prod-server@2.0.0-beta.2
|
53
|
+
- @modern-js/babel-preset-app@2.0.0-beta.2
|
54
|
+
- @modern-js/utils@2.0.0-beta.2
|
55
|
+
- @modern-js/plugin@2.0.0-beta.2
|
56
|
+
- @modern-js/babel-compiler@2.0.0-beta.2
|
57
|
+
|
3
58
|
## 2.0.0-beta.1
|
4
59
|
|
5
60
|
### Major Changes
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { AliasOption } from '@modern-js/utils';
|
2
|
+
import { JestConfig } from '@modern-js/core';
|
1
3
|
import { TestConfig } from '../types';
|
2
4
|
import { TestConfigOperator } from './testConfigOperator';
|
3
5
|
/**
|
@@ -120,4 +122,12 @@ declare const patchConfig: (testOperator: TestConfigOperator) => Promise<Partial
|
|
120
122
|
watchPlugins: (string | [string, Record<string, unknown>])[];
|
121
123
|
}>>;
|
122
124
|
export declare const DEFAULT_RESOLVER_PATH: string;
|
125
|
+
export declare type UserConfig = {
|
126
|
+
source?: {
|
127
|
+
alias?: AliasOption;
|
128
|
+
};
|
129
|
+
tools?: {
|
130
|
+
jest: JestConfig | ((config: JestConfig) => JestConfig);
|
131
|
+
};
|
132
|
+
};
|
123
133
|
export { getJestUtils, patchConfig };
|
@@ -6,121 +6,7 @@ declare class TestConfigOperator {
|
|
6
6
|
private readonly defaultTestConfig;
|
7
7
|
constructor(testConfig: TestConfig);
|
8
8
|
private initial;
|
9
|
-
get jestConfig():
|
10
|
-
automock: boolean;
|
11
|
-
bail: number | boolean;
|
12
|
-
cache: boolean;
|
13
|
-
cacheDirectory: string;
|
14
|
-
ci: boolean;
|
15
|
-
clearMocks: boolean;
|
16
|
-
changedFilesWithAncestor: boolean;
|
17
|
-
changedSince: string;
|
18
|
-
collectCoverage: boolean;
|
19
|
-
collectCoverageFrom: string[];
|
20
|
-
collectCoverageOnlyFrom: {
|
21
|
-
[key: string]: boolean;
|
22
|
-
};
|
23
|
-
coverageDirectory: string;
|
24
|
-
coveragePathIgnorePatterns: string[];
|
25
|
-
coverageProvider: "babel" | "v8";
|
26
|
-
coverageReporters: import("@jest/types/build/Config").CoverageReporters;
|
27
|
-
coverageThreshold: {
|
28
|
-
[path: string]: import("@jest/types/build/Config").CoverageThresholdValue;
|
29
|
-
global: import("@jest/types/build/Config").CoverageThresholdValue;
|
30
|
-
};
|
31
|
-
dependencyExtractor: string;
|
32
|
-
detectLeaks: boolean;
|
33
|
-
detectOpenHandles: boolean;
|
34
|
-
displayName: string | import("@jest/types/build/Config").DisplayName;
|
35
|
-
expand: boolean;
|
36
|
-
extensionsToTreatAsEsm: string[];
|
37
|
-
extraGlobals: string[];
|
38
|
-
filter: string;
|
39
|
-
findRelatedTests: boolean;
|
40
|
-
forceCoverageMatch: string[];
|
41
|
-
forceExit: boolean;
|
42
|
-
json: boolean;
|
43
|
-
globals: import("@jest/types/build/Config").ConfigGlobals;
|
44
|
-
globalSetup: string | null | undefined;
|
45
|
-
globalTeardown: string | null | undefined;
|
46
|
-
haste: import("@jest/types/build/Config").HasteConfig;
|
47
|
-
injectGlobals: boolean;
|
48
|
-
reporters: (string | import("@jest/types/build/Config").ReporterConfig)[];
|
49
|
-
logHeapUsage: boolean;
|
50
|
-
lastCommit: boolean;
|
51
|
-
listTests: boolean;
|
52
|
-
maxConcurrency: number;
|
53
|
-
maxWorkers: string | number;
|
54
|
-
moduleDirectories: string[];
|
55
|
-
moduleFileExtensions: string[];
|
56
|
-
moduleLoader: string;
|
57
|
-
moduleNameMapper: {
|
58
|
-
[key: string]: string | string[];
|
59
|
-
};
|
60
|
-
modulePathIgnorePatterns: string[];
|
61
|
-
modulePaths: string[];
|
62
|
-
name: string;
|
63
|
-
noStackTrace: boolean;
|
64
|
-
notify: boolean;
|
65
|
-
notifyMode: string;
|
66
|
-
onlyChanged: boolean;
|
67
|
-
onlyFailures: boolean;
|
68
|
-
outputFile: string;
|
69
|
-
passWithNoTests: boolean;
|
70
|
-
preprocessorIgnorePatterns: string[];
|
71
|
-
preset: string | null | undefined;
|
72
|
-
prettierPath: string | null | undefined;
|
73
|
-
projects: (string | import("@jest/types/build/Config").InitialProjectOptions)[];
|
74
|
-
replname: string | null | undefined;
|
75
|
-
resetMocks: boolean;
|
76
|
-
resetModules: boolean;
|
77
|
-
resolver: string | null | undefined;
|
78
|
-
restoreMocks: boolean;
|
79
|
-
rootDir: string;
|
80
|
-
roots: string[];
|
81
|
-
runner: string;
|
82
|
-
runTestsByPath: boolean;
|
83
|
-
scriptPreprocessor: string;
|
84
|
-
setupFiles: string[];
|
85
|
-
setupTestFrameworkScriptFile: string;
|
86
|
-
setupFilesAfterEnv: string[];
|
87
|
-
silent: boolean;
|
88
|
-
skipFilter: boolean;
|
89
|
-
skipNodeResolution: boolean;
|
90
|
-
slowTestThreshold: number;
|
91
|
-
snapshotResolver: string;
|
92
|
-
snapshotSerializers: string[];
|
93
|
-
snapshotFormat: import("@jest/types/build/Config").PrettyFormatOptions;
|
94
|
-
errorOnDeprecated: boolean;
|
95
|
-
testEnvironment: string;
|
96
|
-
testEnvironmentOptions: Record<string, unknown>;
|
97
|
-
testFailureExitCode: string | number;
|
98
|
-
testLocationInResults: boolean;
|
99
|
-
testMatch: string[];
|
100
|
-
testNamePattern: string;
|
101
|
-
testPathDirs: string[];
|
102
|
-
testPathIgnorePatterns: string[];
|
103
|
-
testRegex: string | string[];
|
104
|
-
testResultsProcessor: string;
|
105
|
-
testRunner: string;
|
106
|
-
testSequencer: string;
|
107
|
-
testURL: string;
|
108
|
-
testTimeout: number;
|
109
|
-
timers: "modern" | "real" | "fake" | "legacy";
|
110
|
-
transform: {
|
111
|
-
[regex: string]: string | import("@jest/types/build/Config").TransformerConfig;
|
112
|
-
};
|
113
|
-
transformIgnorePatterns: string[];
|
114
|
-
watchPathIgnorePatterns: string[];
|
115
|
-
unmockedModulePathPatterns: string[];
|
116
|
-
updateSnapshot: boolean;
|
117
|
-
useStderr: boolean;
|
118
|
-
verbose?: boolean | undefined;
|
119
|
-
watch: boolean;
|
120
|
-
watchAll: boolean;
|
121
|
-
watchman: boolean;
|
122
|
-
watchPlugins: (string | [string, Record<string, unknown>])[];
|
123
|
-
}>;
|
9
|
+
get jestConfig(): JestConfig;
|
124
10
|
get testConfig(): TestConfig;
|
125
11
|
mergeJestConfig(sourceConfig: JestConfig): void;
|
126
12
|
setJestUserConfig(): void;
|
@@ -5,9 +5,7 @@ export declare const testingHooks: {
|
|
5
5
|
jestConfig: import("@modern-js/plugin").AsyncPipeline<TestConfigOperator, TestConfigOperator>;
|
6
6
|
afterTest: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
|
7
7
|
};
|
8
|
-
declare
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
13
|
-
}
|
8
|
+
export declare type Hooks = {
|
9
|
+
jestConfig: typeof jestConfigHook;
|
10
|
+
afterTest: typeof afterTestHook;
|
11
|
+
};
|
@@ -7,7 +7,9 @@
|
|
7
7
|
*/
|
8
8
|
import { Config } from '@jest/types';
|
9
9
|
import type { PluginAPI } from '@modern-js/core';
|
10
|
+
import { UserConfig } from './config';
|
10
11
|
import { TestConfig } from './types';
|
12
|
+
import type { Hooks } from './hook';
|
11
13
|
declare type Argv = Omit<Config.Argv, '_' | '$0'>;
|
12
14
|
/**
|
13
15
|
* Node API: execute jest
|
@@ -16,5 +18,9 @@ export declare function runJest(config: Argv, pwd?: string): Promise<void>;
|
|
16
18
|
/**
|
17
19
|
* Node API: run test
|
18
20
|
*/
|
19
|
-
export declare function runTest(api: PluginAPI
|
21
|
+
export declare function runTest(api: PluginAPI<{
|
22
|
+
hooks: Hooks;
|
23
|
+
userConfig: UserConfig;
|
24
|
+
normalizedConfig: Required<UserConfig>;
|
25
|
+
}>, config: TestConfig, pwd?: string): Promise<void>;
|
20
26
|
export {};
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import type { CliPlugin } from '@modern-js/core';
|
2
2
|
import { InternalPlugins } from '@modern-js/types';
|
3
|
+
import { UserConfig } from '../../base/config';
|
3
4
|
import { TestConfigOperator } from '../../base';
|
5
|
+
import type { Hooks } from '../../base/hook';
|
4
6
|
export declare const setJestConfigForBFF: ({
|
5
7
|
pwd,
|
6
8
|
userConfig,
|
@@ -14,5 +16,9 @@ export declare const setJestConfigForBFF: ({
|
|
14
16
|
routes: any[];
|
15
17
|
utils: TestConfigOperator;
|
16
18
|
}) => Promise<void>;
|
17
|
-
declare const _default: () => CliPlugin
|
19
|
+
declare const _default: () => CliPlugin<{
|
20
|
+
hooks: Hooks;
|
21
|
+
userConfig: UserConfig;
|
22
|
+
normalizedConfig: Required<UserConfig>;
|
23
|
+
}>;
|
18
24
|
export default _default;
|
@@ -1,5 +1,11 @@
|
|
1
1
|
import type { CliPlugin } from '@modern-js/core';
|
2
2
|
import { TestConfigOperator } from '../base';
|
3
|
+
import type { Hooks } from '../base/hook';
|
4
|
+
import type { UserConfig } from '../base/config';
|
3
5
|
export declare const mergeUserJestConfig: (testUtils: TestConfigOperator) => void;
|
4
|
-
declare const _default: () => CliPlugin
|
6
|
+
declare const _default: () => CliPlugin<{
|
7
|
+
hooks: Hooks;
|
8
|
+
userConfig: UserConfig;
|
9
|
+
normalizedConfig: Required<UserConfig>;
|
10
|
+
}>;
|
5
11
|
export default _default;
|
package/dist/types/cli/test.d.ts
CHANGED
@@ -1,3 +1,9 @@
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
2
|
-
|
2
|
+
import { Hooks } from '../base/hook';
|
3
|
+
import { UserConfig } from '../base/config';
|
4
|
+
declare const test: (api: PluginAPI<{
|
5
|
+
hooks: Hooks;
|
6
|
+
userConfig: UserConfig;
|
7
|
+
normalizedConfig: Required<UserConfig>;
|
8
|
+
}>) => Promise<void>;
|
3
9
|
export default test;
|
@@ -6,8 +6,18 @@ interface CreateAppProps {
|
|
6
6
|
}
|
7
7
|
declare class ModernRuntime {
|
8
8
|
private options;
|
9
|
-
constructor(options: UserConfig
|
10
|
-
|
9
|
+
constructor(options: UserConfig<{
|
10
|
+
userConfig: {
|
11
|
+
runtime?: any;
|
12
|
+
runtimeByEntries?: any;
|
13
|
+
};
|
14
|
+
}>);
|
15
|
+
init(options: UserConfig<{
|
16
|
+
userConfig: {
|
17
|
+
runtime?: any;
|
18
|
+
runtimeByEntries?: any;
|
19
|
+
};
|
20
|
+
}>): void;
|
11
21
|
createApp(props?: CreateAppProps): React.ComponentType<any>;
|
12
22
|
}
|
13
23
|
declare const _default: ModernRuntime;
|
@@ -1,2 +1,6 @@
|
|
1
1
|
import type { NormalizedConfig } from '@modern-js/core';
|
2
|
-
export default function resolvePlugins(features: NormalizedConfig
|
2
|
+
export default function resolvePlugins(features: NormalizedConfig<{
|
3
|
+
normalizedConfig: {
|
4
|
+
runtime: any;
|
5
|
+
};
|
6
|
+
}>['runtime']): any[];
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.0.0-beta.
|
14
|
+
"version": "2.0.0-beta.2",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -111,16 +111,16 @@
|
|
111
111
|
"jest": "^27.0.6",
|
112
112
|
"ts-jest": "^27.0.4",
|
113
113
|
"yargs": "^17.0.1",
|
114
|
-
"@modern-js/babel-compiler": "2.0.0-beta.
|
115
|
-
"@modern-js/utils": "2.0.0-beta.
|
116
|
-
"@modern-js/babel-preset-app": "2.0.0-beta.
|
117
|
-
"@modern-js/plugin": "2.0.0-beta.
|
118
|
-
"@modern-js/prod-server": "2.0.0-beta.
|
114
|
+
"@modern-js/babel-compiler": "2.0.0-beta.2",
|
115
|
+
"@modern-js/utils": "2.0.0-beta.2",
|
116
|
+
"@modern-js/babel-preset-app": "2.0.0-beta.2",
|
117
|
+
"@modern-js/plugin": "2.0.0-beta.2",
|
118
|
+
"@modern-js/prod-server": "2.0.0-beta.2"
|
119
119
|
},
|
120
120
|
"peerDependencies": {
|
121
121
|
"react": ">=17",
|
122
122
|
"react-dom": ">=17",
|
123
|
-
"@modern-js/runtime": "^2.0.0-beta.
|
123
|
+
"@modern-js/runtime": "^2.0.0-beta.2"
|
124
124
|
},
|
125
125
|
"peerDependenciesMeta": {
|
126
126
|
"@modern-js/runtime": {
|
@@ -137,12 +137,12 @@
|
|
137
137
|
"@jest/types": "^27.0.6",
|
138
138
|
"jest": "^27",
|
139
139
|
"typescript": "^4",
|
140
|
-
"@modern-js/core": "2.0.0-beta.
|
141
|
-
"@modern-js/types": "2.0.0-beta.
|
142
|
-
"@modern-js/runtime": "2.0.0-beta.
|
143
|
-
"@modern-js/bff-core": "2.0.0-beta.
|
144
|
-
"@scripts/build": "2.0.0-beta.
|
145
|
-
"@scripts/jest-config": "2.0.0-beta.
|
140
|
+
"@modern-js/core": "2.0.0-beta.2",
|
141
|
+
"@modern-js/types": "2.0.0-beta.2",
|
142
|
+
"@modern-js/runtime": "2.0.0-beta.2",
|
143
|
+
"@modern-js/bff-core": "2.0.0-beta.2",
|
144
|
+
"@scripts/build": "2.0.0-beta.2",
|
145
|
+
"@scripts/jest-config": "2.0.0-beta.2"
|
146
146
|
},
|
147
147
|
"sideEffects": false,
|
148
148
|
"modernConfig": {},
|
@@ -151,9 +151,9 @@
|
|
151
151
|
"access": "public"
|
152
152
|
},
|
153
153
|
"scripts": {
|
154
|
-
"new": "modern new",
|
155
|
-
"dev": "modern build --watch",
|
156
|
-
"build": "modern build",
|
154
|
+
"new": "modern-lib new",
|
155
|
+
"dev": "modern-lib build --watch",
|
156
|
+
"build": "modern-lib build",
|
157
157
|
"test": "jest"
|
158
158
|
}
|
159
159
|
}
|