@modern-js/plugin-testing 1.21.5 → 2.0.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/CHANGELOG.md +88 -29
  2. package/dist/js/modern/base/config/index.js +1 -3
  3. package/dist/js/modern/base/config/patches/index.js +0 -2
  4. package/dist/js/modern/base/config/patches/transformer.js +1 -7
  5. package/dist/js/modern/base/config/resolver.js +0 -3
  6. package/dist/js/modern/base/config/testConfigOperator.js +0 -23
  7. package/dist/js/modern/base/config/transformer/babelTransformer.js +0 -1
  8. package/dist/js/modern/base/runJest.js +11 -14
  9. package/dist/js/modern/base/utils.js +2 -12
  10. package/dist/js/modern/cli/bff/app.js +1 -8
  11. package/dist/js/modern/cli/bff/index.js +5 -17
  12. package/dist/js/modern/cli/bff/mockAPI.js +4 -20
  13. package/dist/js/modern/cli/bff/setup.js +0 -5
  14. package/dist/js/modern/cli/bff/utils/index.js +0 -4
  15. package/dist/js/modern/cli/index.js +7 -15
  16. package/dist/js/modern/cli/test.js +0 -4
  17. package/dist/js/modern/runtime-testing/app.js +0 -15
  18. package/dist/js/modern/runtime-testing/customRender.js +0 -6
  19. package/dist/js/modern/runtime-testing/reduck.js +0 -10
  20. package/dist/js/modern/runtime-testing/request.js +1 -4
  21. package/dist/js/modern/runtime-testing/resolvePlugins.js +0 -6
  22. package/dist/js/node/base/config/index.js +0 -8
  23. package/dist/js/node/base/config/patches/assetsModule.js +0 -2
  24. package/dist/js/node/base/config/patches/index.js +0 -6
  25. package/dist/js/node/base/config/patches/transformer.js +1 -9
  26. package/dist/js/node/base/config/resolver.js +0 -5
  27. package/dist/js/node/base/config/testConfigOperator.js +0 -24
  28. package/dist/js/node/base/config/transformer/babelTransformer.js +0 -4
  29. package/dist/js/node/base/hook.js +0 -2
  30. package/dist/js/node/base/index.js +0 -7
  31. package/dist/js/node/base/runJest.js +11 -21
  32. package/dist/js/node/base/utils.js +2 -22
  33. package/dist/js/node/cli/bff/app.js +1 -15
  34. package/dist/js/node/cli/bff/index.js +5 -27
  35. package/dist/js/node/cli/bff/mockAPI.js +2 -25
  36. package/dist/js/node/cli/bff/setup.js +0 -11
  37. package/dist/js/node/cli/bff/utils/index.js +0 -9
  38. package/dist/js/node/cli/index.js +6 -27
  39. package/dist/js/node/cli/test.js +0 -10
  40. package/dist/js/node/index.js +0 -4
  41. package/dist/js/node/runtime-testing/app.js +0 -20
  42. package/dist/js/node/runtime-testing/base.js +0 -5
  43. package/dist/js/node/runtime-testing/customRender.js +0 -10
  44. package/dist/js/node/runtime-testing/index.js +0 -4
  45. package/dist/js/node/runtime-testing/reduck.js +0 -24
  46. package/dist/js/node/runtime-testing/request.js +1 -6
  47. package/dist/js/node/runtime-testing/resolvePlugins.js +0 -8
  48. package/dist/js/treeshaking/base/config/index.js +1 -6
  49. package/dist/js/treeshaking/base/config/patches/index.js +0 -17
  50. package/dist/js/treeshaking/base/config/patches/transformer.js +1 -7
  51. package/dist/js/treeshaking/base/config/resolver.js +0 -3
  52. package/dist/js/treeshaking/base/config/testConfigOperator.js +0 -15
  53. package/dist/js/treeshaking/base/config/transformer/babelTransformer.js +0 -1
  54. package/dist/js/treeshaking/base/runJest.js +19 -38
  55. package/dist/js/treeshaking/base/utils.js +2 -10
  56. package/dist/js/treeshaking/cli/bff/app.js +1 -14
  57. package/dist/js/treeshaking/cli/bff/index.js +5 -24
  58. package/dist/js/treeshaking/cli/bff/mockAPI.js +8 -24
  59. package/dist/js/treeshaking/cli/bff/setup.js +0 -9
  60. package/dist/js/treeshaking/cli/bff/utils/index.js +1 -2
  61. package/dist/js/treeshaking/cli/index.js +8 -15
  62. package/dist/js/treeshaking/cli/test.js +0 -7
  63. package/dist/js/treeshaking/runtime-testing/app.js +2 -15
  64. package/dist/js/treeshaking/runtime-testing/customRender.js +0 -3
  65. package/dist/js/treeshaking/runtime-testing/reduck.js +0 -7
  66. package/dist/js/treeshaking/runtime-testing/request.js +2 -7
  67. package/dist/js/treeshaking/runtime-testing/resolvePlugins.js +0 -3
  68. package/dist/types/base/config/index.d.ts +0 -1
  69. package/dist/types/base/config/patches/assetsModule.d.ts +0 -1
  70. package/dist/types/base/config/patches/filemock.d.ts +0 -1
  71. package/dist/types/base/config/patches/transformer.d.ts +0 -1
  72. package/dist/types/base/config/testConfigOperator.d.ts +0 -2
  73. package/dist/types/base/runJest.d.ts +0 -2
  74. package/dist/types/base/utils.d.ts +0 -1
  75. package/dist/types/cli/bff/app.d.ts +2 -1
  76. package/dist/types/cli/bff/index.d.ts +2 -3
  77. package/dist/types/cli/bff/mockAPI.d.ts +0 -1
  78. package/dist/types/cli/index.d.ts +0 -2
  79. package/dist/types/runtime-testing/app.d.ts +0 -3
  80. package/dist/types/runtime-testing/customRender.d.ts +0 -2
  81. package/package.json +18 -41
@@ -12,11 +12,9 @@ declare type Argv = Omit<Config.Argv, '_' | '$0'>;
12
12
  /**
13
13
  * Node API: execute jest
14
14
  */
15
-
16
15
  export declare function runJest(config: Argv, pwd?: string): Promise<void>;
17
16
  /**
18
17
  * Node API: run test
19
18
  */
20
-
21
19
  export declare function runTest(api: PluginAPI, config: TestConfig, pwd?: string): Promise<void>;
22
20
  export {};
@@ -6,7 +6,6 @@ interface TSConfig {
6
6
  /**
7
7
  * Read `compilerOptions` in the current pwd's tsconfig.json file
8
8
  */
9
-
10
9
  export declare const readCompilerOptions: (pwd?: string, filename?: string) => TSConfig['compilerOptions'];
11
10
  export declare const getModuleNameMapper: (alias: any) => any;
12
11
  export {};
@@ -1,8 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node/http" />
3
3
  /// <reference types="@modern-js/prod-server/src/type" />
4
+ import { InternalPlugins } from '@modern-js/types';
4
5
  export declare const isInHandler: () => boolean;
5
- declare const createApp: (pwd: string, config: any, plugins: any[], routes: any[]) => Promise<(req: import("http").IncomingMessage, res: import("http").ServerResponse, next?: (() => void) | undefined) => void>;
6
+ declare const createApp: (pwd: string, config: any, plugins: InternalPlugins, routes: any[]) => Promise<(req: import("http").IncomingMessage, res: import("http").ServerResponse, next?: (() => void) | undefined) => void>;
6
7
  declare const getApp: () => (req: import("http").IncomingMessage, res: import("http").ServerResponse, next?: (() => void) | undefined) => void;
7
8
  declare const closeServer: () => Promise<void>;
8
9
  export { createApp, getApp, closeServer };
@@ -1,4 +1,5 @@
1
1
  import type { CliPlugin } from '@modern-js/core';
2
+ import { InternalPlugins } from '@modern-js/types';
2
3
  import { TestConfigOperator } from '../../base';
3
4
  export declare const setJestConfigForBFF: ({
4
5
  pwd,
@@ -9,11 +10,9 @@ export declare const setJestConfigForBFF: ({
9
10
  }: {
10
11
  pwd: string;
11
12
  userConfig: any;
12
- plugins: any[];
13
+ plugins: InternalPlugins;
13
14
  routes: any[];
14
15
  utils: TestConfigOperator;
15
16
  }) => Promise<void>;
16
-
17
17
  declare const _default: () => CliPlugin;
18
-
19
18
  export default _default;
@@ -1,3 +1,2 @@
1
1
  declare const _default: (mockApiInfosByFile: Record<string, any[]>) => void;
2
-
3
2
  export default _default;
@@ -1,7 +1,5 @@
1
1
  import type { CliPlugin } from '@modern-js/core';
2
2
  import { TestConfigOperator } from '../base';
3
3
  export declare const mergeUserJestConfig: (testUtils: TestConfigOperator) => void;
4
-
5
4
  declare const _default: () => CliPlugin;
6
-
7
5
  export default _default;
@@ -4,14 +4,11 @@ interface CreateAppProps {
4
4
  entry?: string;
5
5
  children?: React.ReactElement;
6
6
  }
7
-
8
7
  declare class ModernRuntime {
9
8
  private options;
10
9
  constructor(options: UserConfig);
11
10
  init(options: UserConfig): void;
12
11
  createApp(props?: CreateAppProps): React.ComponentType<any>;
13
12
  }
14
-
15
13
  declare const _default: ModernRuntime;
16
-
17
14
  export default _default;
@@ -1,5 +1,3 @@
1
1
  import { render } from '@testing-library/react';
2
-
3
2
  declare const _default: typeof render;
4
-
5
3
  export default _default;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.21.5",
14
+ "version": "2.0.0-beta.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -100,7 +100,7 @@
100
100
  "@modern-js-reduck/plugin-immutable": "^1.0.1",
101
101
  "@modern-js-reduck/store": "^1.0.3",
102
102
  "@testing-library/jest-dom": "^5.14.1",
103
- "@testing-library/react": "^12.0.0",
103
+ "@testing-library/react": "^13.4.0",
104
104
  "@types/testing-library__jest-dom": "^5.14.3",
105
105
  "jest-environment-node": "^27.2.2",
106
106
  "path-to-regexp": "^6.2.0",
@@ -111,17 +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": "1.21.5",
115
- "@modern-js/utils": "1.21.5",
116
- "@modern-js/webpack": "1.21.5",
117
- "@modern-js/babel-preset-app": "1.21.5",
118
- "@modern-js/plugin": "1.21.5",
119
- "@modern-js/prod-server": "1.21.5"
114
+ "@modern-js/babel-compiler": "2.0.0-beta.1",
115
+ "@modern-js/utils": "2.0.0-beta.1",
116
+ "@modern-js/babel-preset-app": "2.0.0-beta.1",
117
+ "@modern-js/plugin": "2.0.0-beta.1",
118
+ "@modern-js/prod-server": "2.0.0-beta.1"
120
119
  },
121
120
  "peerDependencies": {
122
121
  "react": ">=17",
123
122
  "react-dom": ">=17",
124
- "@modern-js/runtime": "^1.21.5"
123
+ "@modern-js/runtime": "^2.0.0-beta.1"
125
124
  },
126
125
  "peerDependenciesMeta": {
127
126
  "@modern-js/runtime": {
@@ -129,8 +128,8 @@
129
128
  }
130
129
  },
131
130
  "devDependencies": {
132
- "react": "^17",
133
- "react-dom": "^17",
131
+ "react": "^18",
132
+ "react-dom": "^18",
134
133
  "@types/jest": "^27",
135
134
  "@types/supertest": "^2.0.11",
136
135
  "@types/node": "^14",
@@ -138,11 +137,12 @@
138
137
  "@jest/types": "^27.0.6",
139
138
  "jest": "^27",
140
139
  "typescript": "^4",
141
- "@modern-js/core": "1.21.5",
142
- "@modern-js/runtime": "1.21.5",
143
- "@modern-js/bff-core": "1.21.5",
144
- "@scripts/build": "1.21.5",
145
- "@scripts/jest-config": "1.21.5"
140
+ "@modern-js/core": "2.0.0-beta.1",
141
+ "@modern-js/types": "2.0.0-beta.1",
142
+ "@modern-js/runtime": "2.0.0-beta.1",
143
+ "@modern-js/bff-core": "2.0.0-beta.1",
144
+ "@scripts/build": "2.0.0-beta.1",
145
+ "@scripts/jest-config": "2.0.0-beta.1"
146
146
  },
147
147
  "sideEffects": false,
148
148
  "modernConfig": {},
@@ -150,33 +150,10 @@
150
150
  "registry": "https://registry.npmjs.org/",
151
151
  "access": "public"
152
152
  },
153
- "wireit": {
154
- "build": {
155
- "command": "modern build",
156
- "files": [
157
- "src/**/*",
158
- "tsconfig.json",
159
- "package.json"
160
- ],
161
- "output": [
162
- "dist/**/*"
163
- ]
164
- },
165
- "test": {
166
- "command": "jest",
167
- "files": [
168
- "src/**/*",
169
- "tsconfig.json",
170
- "package.json",
171
- "tests/**/*"
172
- ],
173
- "output": []
174
- }
175
- },
176
153
  "scripts": {
177
154
  "new": "modern new",
178
155
  "dev": "modern build --watch",
179
- "build": "wireit",
180
- "test": "wireit"
156
+ "build": "modern build",
157
+ "test": "jest"
181
158
  }
182
159
  }