@modern-js/plugin-testing 0.0.0-next-20221128142600 → 0.0.0-next-20221129071631

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,6 +1,6 @@
1
1
  # @modern-js/plugin-testing
2
2
 
3
- ## 0.0.0-next-20221128142600
3
+ ## 0.0.0-next-20221129071631
4
4
 
5
5
  ### Major Changes
6
6
 
@@ -47,12 +47,12 @@
47
47
  - Updated dependencies [abf3421a7]
48
48
  - Updated dependencies [543be9558]
49
49
  - Updated dependencies [14b712da8]
50
- - @modern-js/runtime@0.0.0-next-20221128142600
51
- - @modern-js/prod-server@0.0.0-next-20221128142600
52
- - @modern-js/babel-preset-app@0.0.0-next-20221128142600
53
- - @modern-js/utils@0.0.0-next-20221128142600
54
- - @modern-js/plugin@0.0.0-next-20221128142600
55
- - @modern-js/babel-compiler@0.0.0-next-20221128142600
50
+ - @modern-js/runtime@0.0.0-next-20221129071631
51
+ - @modern-js/prod-server@0.0.0-next-20221129071631
52
+ - @modern-js/babel-preset-app@0.0.0-next-20221129071631
53
+ - @modern-js/utils@0.0.0-next-20221129071631
54
+ - @modern-js/plugin@0.0.0-next-20221129071631
55
+ - @modern-js/babel-compiler@0.0.0-next-20221129071631
56
56
 
57
57
  ## 2.0.0-beta.1
58
58
 
@@ -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 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(): Partial<{
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 module '@modern-js/core' {
9
- interface Hooks {
10
- jestConfig: typeof jestConfigHook;
11
- afterTest: typeof afterTestHook;
12
- }
13
- }
8
+ export 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
  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, config: TestConfig, pwd?: string): Promise<void>;
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;
@@ -1,3 +1,9 @@
1
1
  import type { PluginAPI } from '@modern-js/core';
2
- declare const test: (api: PluginAPI) => Promise<void>;
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
- init(options: UserConfig): void;
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['runtime']): any[];
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": "0.0.0-next-20221128142600",
14
+ "version": "0.0.0-next-20221129071631",
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": "0.0.0-next-20221128142600",
115
- "@modern-js/utils": "0.0.0-next-20221128142600",
116
- "@modern-js/babel-preset-app": "0.0.0-next-20221128142600",
117
- "@modern-js/plugin": "0.0.0-next-20221128142600",
118
- "@modern-js/prod-server": "0.0.0-next-20221128142600"
114
+ "@modern-js/babel-compiler": "0.0.0-next-20221129071631",
115
+ "@modern-js/utils": "0.0.0-next-20221129071631",
116
+ "@modern-js/babel-preset-app": "0.0.0-next-20221129071631",
117
+ "@modern-js/plugin": "0.0.0-next-20221129071631",
118
+ "@modern-js/prod-server": "0.0.0-next-20221129071631"
119
119
  },
120
120
  "peerDependencies": {
121
121
  "react": ">=17",
122
122
  "react-dom": ">=17",
123
- "@modern-js/runtime": "0.0.0-next-20221128142600"
123
+ "@modern-js/runtime": "0.0.0-next-20221129071631"
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": "0.0.0-next-20221128142600",
141
- "@modern-js/types": "0.0.0-next-20221128142600",
142
- "@modern-js/runtime": "0.0.0-next-20221128142600",
143
- "@modern-js/bff-core": "0.0.0-next-20221128142600",
144
- "@scripts/build": "0.0.0-next-20221128142600",
145
- "@scripts/jest-config": "0.0.0-next-20221128142600"
140
+ "@modern-js/core": "0.0.0-next-20221129071631",
141
+ "@modern-js/types": "0.0.0-next-20221129071631",
142
+ "@modern-js/runtime": "0.0.0-next-20221129071631",
143
+ "@modern-js/bff-core": "0.0.0-next-20221129071631",
144
+ "@scripts/build": "0.0.0-next-20221129071631",
145
+ "@scripts/jest-config": "0.0.0-next-20221129071631"
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
  }