@modern-js/plugin-testing 2.9.0 → 2.11.0

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 CHANGED
@@ -1,5 +1,51 @@
1
1
  # @modern-js/plugin-testing
2
2
 
3
+ ## 2.11.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [cfb058f]
8
+ - Updated dependencies [0bd018b]
9
+ - Updated dependencies [5d624fd]
10
+ - Updated dependencies [e2466a1]
11
+ - Updated dependencies [02bb383]
12
+ - Updated dependencies [381a3b9]
13
+ - Updated dependencies [7a60f10]
14
+ - Updated dependencies [274b2e5]
15
+ - Updated dependencies [b9e1c54]
16
+ - @modern-js/babel-preset-app@2.11.0
17
+ - @modern-js/utils@2.11.0
18
+ - @modern-js/runtime@2.11.0
19
+ - @modern-js/prod-server@2.11.0
20
+ - @modern-js/babel-compiler@2.11.0
21
+ - @modern-js/plugin@2.11.0
22
+
23
+ ## 2.10.0
24
+
25
+ ### Patch Changes
26
+
27
+ - 0da32d0: chore: upgrade jest and puppeteer
28
+ chore: 升级 jest 和 puppeteer 到 latest
29
+ - 0d9962b: fix: add types field in package.json
30
+ fix: 添加 package.json 中的 types 字段
31
+ - Updated dependencies [d8bbf28]
32
+ - Updated dependencies [a8db932]
33
+ - Updated dependencies [3e0bd50]
34
+ - Updated dependencies [92d247f]
35
+ - Updated dependencies [0da32d0]
36
+ - Updated dependencies [0d9962b]
37
+ - Updated dependencies [5766414]
38
+ - Updated dependencies [fbefa7e]
39
+ - Updated dependencies [4d54233]
40
+ - Updated dependencies [6db4864]
41
+ - Updated dependencies [950e138]
42
+ - @modern-js/prod-server@2.10.0
43
+ - @modern-js/babel-preset-app@2.10.0
44
+ - @modern-js/runtime@2.10.0
45
+ - @modern-js/babel-compiler@2.10.0
46
+ - @modern-js/plugin@2.10.0
47
+ - @modern-js/utils@2.10.0
48
+
3
49
  ## 2.9.0
4
50
 
5
51
  ### Patch Changes
@@ -50,17 +50,10 @@ const patchTransformer = (testOperator) => {
50
50
  });
51
51
  }
52
52
  if (transformer === "ts-jest") {
53
+ const compilerOptions = resolveTsCompilerOptions();
53
54
  testOperator.mergeJestConfig({
54
55
  transform: {
55
- "\\.[jt]sx?$": require.resolve("ts-jest")
56
- }
57
- });
58
- const compilerOptions = resolveTsCompilerOptions();
59
- compilerOptions && testOperator.mergeJestConfig({
60
- globals: {
61
- "ts-jest": {
62
- tsconfig: compilerOptions
63
- }
56
+ "\\.[jt]sx?$": [require.resolve("ts-jest"), compilerOptions || {}]
64
57
  }
65
58
  });
66
59
  }
@@ -50,11 +50,6 @@ const setJestConfigForBFF = async ({
50
50
  testEnvironment: "node",
51
51
  testMatch: [`**/api/**/*.test.[jt]s`],
52
52
  globals: {
53
- "ts-jest": {
54
- diagnostics: {
55
- warnOnly: true
56
- }
57
- },
58
53
  [import_constant.bff_info_key]: {
59
54
  appDir: pwd,
60
55
  modernUserConfig: userConfig,
@@ -68,7 +63,14 @@ const setJestConfigForBFF = async ({
68
63
  const aliasMapper = (0, import_base.getModuleNameMapper)(alias);
69
64
  const { moduleNameMapper } = jestConfig;
70
65
  const transform = {
71
- "\\.[jt]sx?$": require.resolve("ts-jest")
66
+ "\\.[jt]sx?$": [
67
+ require.resolve("ts-jest"),
68
+ {
69
+ diagnostics: {
70
+ warnOnly: true
71
+ }
72
+ }
73
+ ]
72
74
  };
73
75
  const apiOnly = await (0, import_utils.isApiOnly)(pwd);
74
76
  const mergedModuleNameMapper = {
@@ -18,17 +18,13 @@ var patchTransformer = function(testOperator) {
18
18
  });
19
19
  }
20
20
  if (transformer === "ts-jest") {
21
+ var compilerOptions = resolveTsCompilerOptions();
21
22
  testOperator.mergeJestConfig({
22
23
  transform: {
23
- "\\.[jt]sx?$": require.resolve("ts-jest")
24
- }
25
- });
26
- var compilerOptions = resolveTsCompilerOptions();
27
- compilerOptions && testOperator.mergeJestConfig({
28
- globals: {
29
- "ts-jest": {
30
- tsconfig: compilerOptions
31
- }
24
+ "\\.[jt]sx?$": [
25
+ require.resolve("ts-jest"),
26
+ compilerOptions || {}
27
+ ]
32
28
  }
33
29
  });
34
30
  }
@@ -171,13 +171,7 @@ var setJestConfigForBFF = function() {
171
171
  testMatch: [
172
172
  "**/api/**/*.test.[jt]s"
173
173
  ],
174
- globals: _defineProperty({
175
- "ts-jest": {
176
- diagnostics: {
177
- warnOnly: true
178
- }
179
- }
180
- }, bff_info_key, {
174
+ globals: _defineProperty({}, bff_info_key, {
181
175
  appDir: pwd,
182
176
  modernUserConfig: userConfig,
183
177
  plugins: plugins,
@@ -189,7 +183,14 @@ var setJestConfigForBFF = function() {
189
183
  aliasMapper = getModuleNameMapper(alias);
190
184
  moduleNameMapper = jestConfig.moduleNameMapper;
191
185
  transform = {
192
- "\\.[jt]sx?$": require.resolve("ts-jest")
186
+ "\\.[jt]sx?$": [
187
+ require.resolve("ts-jest"),
188
+ {
189
+ diagnostics: {
190
+ warnOnly: true
191
+ }
192
+ }
193
+ ]
193
194
  };
194
195
  return [
195
196
  4,
@@ -18,17 +18,10 @@ const patchTransformer = (testOperator) => {
18
18
  });
19
19
  }
20
20
  if (transformer === "ts-jest") {
21
+ const compilerOptions = resolveTsCompilerOptions();
21
22
  testOperator.mergeJestConfig({
22
23
  transform: {
23
- "\\.[jt]sx?$": require.resolve("ts-jest")
24
- }
25
- });
26
- const compilerOptions = resolveTsCompilerOptions();
27
- compilerOptions && testOperator.mergeJestConfig({
28
- globals: {
29
- "ts-jest": {
30
- tsconfig: compilerOptions
31
- }
24
+ "\\.[jt]sx?$": [require.resolve("ts-jest"), compilerOptions || {}]
32
25
  }
33
26
  });
34
27
  }
@@ -20,11 +20,6 @@ const setJestConfigForBFF = async ({
20
20
  testEnvironment: "node",
21
21
  testMatch: [`**/api/**/*.test.[jt]s`],
22
22
  globals: {
23
- "ts-jest": {
24
- diagnostics: {
25
- warnOnly: true
26
- }
27
- },
28
23
  [bff_info_key]: {
29
24
  appDir: pwd,
30
25
  modernUserConfig: userConfig,
@@ -38,7 +33,14 @@ const setJestConfigForBFF = async ({
38
33
  const aliasMapper = getModuleNameMapper(alias);
39
34
  const { moduleNameMapper } = jestConfig;
40
35
  const transform = {
41
- "\\.[jt]sx?$": require.resolve("ts-jest")
36
+ "\\.[jt]sx?$": [
37
+ require.resolve("ts-jest"),
38
+ {
39
+ diagnostics: {
40
+ warnOnly: true
41
+ }
42
+ }
43
+ ]
42
44
  };
43
45
  const apiOnly = await isApiOnly(pwd);
44
46
  const mergedModuleNameMapper = {
@@ -7,121 +7,7 @@ import { TestConfigOperator } from './testConfigOperator';
7
7
  */
8
8
 
9
9
  declare const getJestUtils: (testConfig: TestConfig) => TestConfigOperator;
10
- declare const patchConfig: (testOperator: TestConfigOperator) => Promise<Partial<{
11
- automock: boolean;
12
- bail: number | boolean;
13
- cache: boolean;
14
- cacheDirectory: string;
15
- ci: boolean;
16
- clearMocks: boolean;
17
- changedFilesWithAncestor: boolean;
18
- changedSince: string;
19
- collectCoverage: boolean;
20
- collectCoverageFrom: string[];
21
- collectCoverageOnlyFrom: {
22
- [key: string]: boolean;
23
- };
24
- coverageDirectory: string;
25
- coveragePathIgnorePatterns: string[];
26
- coverageProvider: "babel" | "v8";
27
- coverageReporters: import("@jest/types/build/Config").CoverageReporters;
28
- coverageThreshold: {
29
- [path: string]: import("@jest/types/build/Config").CoverageThresholdValue;
30
- global: import("@jest/types/build/Config").CoverageThresholdValue;
31
- };
32
- dependencyExtractor: string;
33
- detectLeaks: boolean;
34
- detectOpenHandles: boolean;
35
- displayName: string | import("@jest/types/build/Config").DisplayName;
36
- expand: boolean;
37
- extensionsToTreatAsEsm: string[];
38
- extraGlobals: string[];
39
- filter: string;
40
- findRelatedTests: boolean;
41
- forceCoverageMatch: string[];
42
- forceExit: boolean;
43
- json: boolean;
44
- globals: import("@jest/types/build/Config").ConfigGlobals;
45
- globalSetup: string | null | undefined;
46
- globalTeardown: string | null | undefined;
47
- haste: import("@jest/types/build/Config").HasteConfig;
48
- injectGlobals: boolean;
49
- reporters: (string | import("@jest/types/build/Config").ReporterConfig)[];
50
- logHeapUsage: boolean;
51
- lastCommit: boolean;
52
- listTests: boolean;
53
- maxConcurrency: number;
54
- maxWorkers: string | number;
55
- moduleDirectories: string[];
56
- moduleFileExtensions: string[];
57
- moduleLoader: string;
58
- moduleNameMapper: {
59
- [key: string]: string | string[];
60
- };
61
- modulePathIgnorePatterns: string[];
62
- modulePaths: string[];
63
- name: string;
64
- noStackTrace: boolean;
65
- notify: boolean;
66
- notifyMode: string;
67
- onlyChanged: boolean;
68
- onlyFailures: boolean;
69
- outputFile: string;
70
- passWithNoTests: boolean;
71
- preprocessorIgnorePatterns: string[];
72
- preset: string | null | undefined;
73
- prettierPath: string | null | undefined;
74
- projects: (string | import("@jest/types/build/Config").InitialProjectOptions)[];
75
- replname: string | null | undefined;
76
- resetMocks: boolean;
77
- resetModules: boolean;
78
- resolver: string | null | undefined;
79
- restoreMocks: boolean;
80
- rootDir: string;
81
- roots: string[];
82
- runner: string;
83
- runTestsByPath: boolean;
84
- scriptPreprocessor: string;
85
- setupFiles: string[];
86
- setupTestFrameworkScriptFile: string;
87
- setupFilesAfterEnv: string[];
88
- silent: boolean;
89
- skipFilter: boolean;
90
- skipNodeResolution: boolean;
91
- slowTestThreshold: number;
92
- snapshotResolver: string;
93
- snapshotSerializers: string[];
94
- snapshotFormat: import("@jest/types/build/Config").PrettyFormatOptions;
95
- errorOnDeprecated: boolean;
96
- testEnvironment: string;
97
- testEnvironmentOptions: Record<string, unknown>;
98
- testFailureExitCode: string | number;
99
- testLocationInResults: boolean;
100
- testMatch: string[];
101
- testNamePattern: string;
102
- testPathDirs: string[];
103
- testPathIgnorePatterns: string[];
104
- testRegex: string | string[];
105
- testResultsProcessor: string;
106
- testRunner: string;
107
- testSequencer: string;
108
- testURL: string;
109
- testTimeout: number;
110
- timers: "legacy" | "modern" | "real" | "fake";
111
- transform: {
112
- [regex: string]: string | import("@jest/types/build/Config").TransformerConfig;
113
- };
114
- transformIgnorePatterns: string[];
115
- watchPathIgnorePatterns: string[];
116
- unmockedModulePathPatterns: string[];
117
- updateSnapshot: boolean;
118
- useStderr: boolean;
119
- verbose?: boolean | undefined;
120
- watch: boolean;
121
- watchAll: boolean;
122
- watchman: boolean;
123
- watchPlugins: (string | [string, Record<string, unknown>])[];
124
- }>>;
10
+ declare const patchConfig: (testOperator: TestConfigOperator) => Promise<JestConfigTypes.InitialOptions>;
125
11
  export declare const DEFAULT_RESOLVER_PATH: string;
126
12
  export type UserConfig = {
127
13
  source?: {
@@ -14,121 +14,7 @@ declare class TestConfigOperator {
14
14
  setJestConfig(sourceConfig: JestConfig, options?: {
15
15
  force: boolean;
16
16
  }): void;
17
- getFinalConfig(): Partial<{
18
- automock: boolean;
19
- bail: number | boolean;
20
- cache: boolean;
21
- cacheDirectory: string;
22
- ci: boolean;
23
- clearMocks: boolean;
24
- changedFilesWithAncestor: boolean;
25
- changedSince: string;
26
- collectCoverage: boolean;
27
- collectCoverageFrom: string[];
28
- collectCoverageOnlyFrom: {
29
- [key: string]: boolean;
30
- };
31
- coverageDirectory: string;
32
- coveragePathIgnorePatterns: string[];
33
- coverageProvider: "babel" | "v8";
34
- coverageReporters: import("@jest/types/build/Config").CoverageReporters;
35
- coverageThreshold: {
36
- [path: string]: import("@jest/types/build/Config").CoverageThresholdValue;
37
- global: import("@jest/types/build/Config").CoverageThresholdValue;
38
- };
39
- dependencyExtractor: string;
40
- detectLeaks: boolean;
41
- detectOpenHandles: boolean;
42
- displayName: string | import("@jest/types/build/Config").DisplayName;
43
- expand: boolean;
44
- extensionsToTreatAsEsm: string[];
45
- extraGlobals: string[];
46
- filter: string;
47
- findRelatedTests: boolean;
48
- forceCoverageMatch: string[];
49
- forceExit: boolean;
50
- json: boolean;
51
- globals: import("@jest/types/build/Config").ConfigGlobals;
52
- globalSetup: string | null | undefined;
53
- globalTeardown: string | null | undefined;
54
- haste: import("@jest/types/build/Config").HasteConfig;
55
- injectGlobals: boolean;
56
- reporters: (string | import("@jest/types/build/Config").ReporterConfig)[];
57
- logHeapUsage: boolean;
58
- lastCommit: boolean;
59
- listTests: boolean;
60
- maxConcurrency: number;
61
- maxWorkers: string | number;
62
- moduleDirectories: string[];
63
- moduleFileExtensions: string[];
64
- moduleLoader: string;
65
- moduleNameMapper: {
66
- [key: string]: string | string[];
67
- };
68
- modulePathIgnorePatterns: string[];
69
- modulePaths: string[];
70
- name: string;
71
- noStackTrace: boolean;
72
- notify: boolean;
73
- notifyMode: string;
74
- onlyChanged: boolean;
75
- onlyFailures: boolean;
76
- outputFile: string;
77
- passWithNoTests: boolean;
78
- preprocessorIgnorePatterns: string[];
79
- preset: string | null | undefined;
80
- prettierPath: string | null | undefined;
81
- projects: (string | import("@jest/types/build/Config").InitialProjectOptions)[];
82
- replname: string | null | undefined;
83
- resetMocks: boolean;
84
- resetModules: boolean;
85
- resolver: string | null | undefined;
86
- restoreMocks: boolean;
87
- rootDir: string;
88
- roots: string[];
89
- runner: string;
90
- runTestsByPath: boolean;
91
- scriptPreprocessor: string;
92
- setupFiles: string[];
93
- setupTestFrameworkScriptFile: string;
94
- setupFilesAfterEnv: string[];
95
- silent: boolean;
96
- skipFilter: boolean;
97
- skipNodeResolution: boolean;
98
- slowTestThreshold: number;
99
- snapshotResolver: string;
100
- snapshotSerializers: string[];
101
- snapshotFormat: import("@jest/types/build/Config").PrettyFormatOptions;
102
- errorOnDeprecated: boolean;
103
- testEnvironment: string;
104
- testEnvironmentOptions: Record<string, unknown>;
105
- testFailureExitCode: string | number;
106
- testLocationInResults: boolean;
107
- testMatch: string[];
108
- testNamePattern: string;
109
- testPathDirs: string[];
110
- testPathIgnorePatterns: string[];
111
- testRegex: string | string[];
112
- testResultsProcessor: string;
113
- testRunner: string;
114
- testSequencer: string;
115
- testURL: string;
116
- testTimeout: number;
117
- timers: "legacy" | "modern" | "real" | "fake";
118
- transform: {
119
- [regex: string]: string | import("@jest/types/build/Config").TransformerConfig;
120
- };
121
- transformIgnorePatterns: string[];
122
- watchPathIgnorePatterns: string[];
123
- unmockedModulePathPatterns: string[];
124
- updateSnapshot: boolean;
125
- useStderr: boolean;
126
- verbose?: boolean | undefined;
127
- watch: boolean;
128
- watchAll: boolean;
129
- watchman: boolean;
130
- watchPlugins: (string | [string, Record<string, unknown>])[];
131
- }>;
17
+ getFinalConfig(): any;
132
18
  }
133
19
 
134
20
  export { TestConfigOperator };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "2.9.0",
14
+ "version": "2.11.0",
15
15
  "jsnext:source": "./src/cli/index.ts",
16
16
  "types": "./dist/types/cli/index.d.ts",
17
17
  "main": "./dist/cjs/cli/index.js",
@@ -27,6 +27,7 @@
27
27
  },
28
28
  ".": {
29
29
  "jsnext:source": "./src/cli/index.ts",
30
+ "types": "./dist/types/cli/index.d.ts",
30
31
  "default": "./dist/cjs/cli/index.js"
31
32
  },
32
33
  "./runtime": {
@@ -35,6 +36,7 @@
35
36
  "import": "./dist/esm-node/runtime-testing/index.js",
36
37
  "require": "./dist/cjs/runtime-testing/index.js"
37
38
  },
39
+ "types": "./dist/types/runtime-testing/index.d.ts",
38
40
  "default": "./dist/esm/runtime-testing/index.js"
39
41
  },
40
42
  "./runtime-base": {
@@ -43,18 +45,22 @@
43
45
  "import": "./dist/esm-node/runtime-testing/base.js",
44
46
  "require": "./dist/cjs/runtime-testing/base.js"
45
47
  },
48
+ "types": "./dist/types/runtime-testing/base.d.ts",
46
49
  "default": "./dist/esm/runtime-testing/base.js"
47
50
  },
48
51
  "./cli": {
49
52
  "jsnext:source": "./src/cli/index.ts",
53
+ "types": "./dist/types/cli/index.d.ts",
50
54
  "default": "./dist/cjs/cli/index.js"
51
55
  },
52
56
  "./bff-cli": {
53
57
  "jsnext:source": "./src/cli/bff/index.ts",
58
+ "types": "./dist/types/cli/bff/index.d.ts",
54
59
  "default": "./dist/cjs/cli/bff/index.js"
55
60
  },
56
61
  "./base": {
57
62
  "jsnext:source": "./src/base/index.ts",
63
+ "types": "./dist/types/base/index.d.ts",
58
64
  "default": "./dist/cjs/base/index.js"
59
65
  }
60
66
  },
@@ -97,25 +103,26 @@
97
103
  "@testing-library/jest-dom": "^5.14.1",
98
104
  "@testing-library/react": "^13.4.0",
99
105
  "@types/testing-library__jest-dom": "^5.14.3",
100
- "jest-environment-node": "^27.2.2",
101
106
  "path-to-regexp": "^6.2.0",
102
107
  "supertest": "^6.1.6",
103
108
  "babel-jest": "^27.0.6",
104
- "enhanced-resolve": "^5.8.3",
109
+ "enhanced-resolve": "5.12.0",
105
110
  "identity-obj-proxy": "^3.0.0",
106
- "jest": "^27.0.6",
107
- "ts-jest": "^27.0.4",
111
+ "jest": "^29.5.0",
112
+ "jest-environment-jsdom": "^29.5.0",
113
+ "@jest/types": "^29.5.0",
114
+ "ts-jest": "^29.0.5",
108
115
  "yargs": "^17.0.1",
109
- "@modern-js/babel-compiler": "2.9.0",
110
- "@modern-js/utils": "2.9.0",
111
- "@modern-js/babel-preset-app": "2.9.0",
112
- "@modern-js/plugin": "2.9.0",
113
- "@modern-js/prod-server": "2.9.0"
116
+ "@modern-js/babel-compiler": "2.11.0",
117
+ "@modern-js/utils": "2.11.0",
118
+ "@modern-js/babel-preset-app": "2.11.0",
119
+ "@modern-js/plugin": "2.11.0",
120
+ "@modern-js/prod-server": "2.11.0"
114
121
  },
115
122
  "peerDependencies": {
116
123
  "react": ">=17",
117
124
  "react-dom": ">=17",
118
- "@modern-js/runtime": "^2.9.0"
125
+ "@modern-js/runtime": "^2.11.0"
119
126
  },
120
127
  "peerDependenciesMeta": {
121
128
  "@modern-js/runtime": {
@@ -125,19 +132,17 @@
125
132
  "devDependencies": {
126
133
  "react": "^18",
127
134
  "react-dom": "^18",
128
- "@types/jest": "^27",
135
+ "@types/jest": "^29",
129
136
  "@types/supertest": "^2.0.11",
130
137
  "@types/node": "^14",
131
138
  "@types/yargs": "^17.0.2",
132
- "@jest/types": "^27.0.6",
133
- "jest": "^27",
134
139
  "typescript": "^4",
135
- "@modern-js/core": "2.9.0",
136
- "@modern-js/types": "2.9.0",
137
- "@modern-js/runtime": "2.9.0",
138
- "@modern-js/bff-core": "2.9.0",
139
- "@scripts/build": "2.9.0",
140
- "@scripts/jest-config": "2.9.0"
140
+ "@modern-js/core": "2.11.0",
141
+ "@modern-js/types": "2.11.0",
142
+ "@modern-js/runtime": "2.11.0",
143
+ "@modern-js/bff-core": "2.11.0",
144
+ "@scripts/build": "2.11.0",
145
+ "@scripts/jest-config": "2.11.0"
141
146
  },
142
147
  "sideEffects": false,
143
148
  "modernConfig": {},