@modern-js/plugin-testing 0.0.0-nightly-20240817170640 → 0.0.0-nightly-20240819170736

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.
@@ -43,7 +43,7 @@ let server;
43
43
  const createApp = async (pwd, config, plugins, routes) => {
44
44
  if (!server) {
45
45
  config.output.path = "./";
46
- const pluginInstances = (0, import_prod_server.loadServerPlugins)(plugins, pwd);
46
+ const pluginInstances = await (0, import_prod_server.loadServerPlugins)(plugins, pwd);
47
47
  server = await (0, import_prod_server.createProdServer)({
48
48
  pwd,
49
49
  config,
@@ -44,7 +44,7 @@ const setup = () => {
44
44
  prefix,
45
45
  httpMethodDecider
46
46
  });
47
- const apiInfos = apiRouter.getApiHandlers();
47
+ const apiInfos = await apiRouter.getApiHandlers();
48
48
  const apiInfosByFile = apiInfos.reduce((res, apiInfo) => {
49
49
  if (!res[apiInfo.filename]) {
50
50
  res[apiInfo.filename] = [];
@@ -54,7 +54,7 @@ var readResultsAndExit = function(result, globalConfig) {
54
54
  });
55
55
  if (globalConfig.forceExit) {
56
56
  if (!globalConfig.detectOpenHandles) {
57
- console.warn("".concat(chalk.bold("Force exiting Jest: "), "Have you considered using `--detectOpenHandles` to detect ") + "async operations that kept running after all tests finished?");
57
+ console.warn("".concat(chalk.bold("Force exiting Jest: "), "Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?"));
58
58
  }
59
59
  process.exit(code);
60
60
  } else if (!globalConfig.detectOpenHandles) {
@@ -17,10 +17,15 @@ var createApp = function() {
17
17
  if (!!server)
18
18
  return [
19
19
  3,
20
- 2
20
+ 3
21
21
  ];
22
22
  config.output.path = "./";
23
- pluginInstances = loadServerPlugins(plugins, pwd);
23
+ return [
24
+ 4,
25
+ loadServerPlugins(plugins, pwd)
26
+ ];
27
+ case 1:
28
+ pluginInstances = _state.sent();
24
29
  return [
25
30
  4,
26
31
  createProdServer({
@@ -34,10 +39,10 @@ var createApp = function() {
34
39
  }
35
40
  })
36
41
  ];
37
- case 1:
38
- server = _state.sent();
39
- _state.label = 2;
40
42
  case 2:
43
+ server = _state.sent();
44
+ _state.label = 3;
45
+ case 3:
41
46
  app = server.getRequestListener();
42
47
  return [
43
48
  2,
@@ -27,7 +27,12 @@ var setup = function() {
27
27
  prefix,
28
28
  httpMethodDecider
29
29
  });
30
- apiInfos = apiRouter.getApiHandlers();
30
+ return [
31
+ 4,
32
+ apiRouter.getApiHandlers()
33
+ ];
34
+ case 1:
35
+ apiInfos = _state.sent();
31
36
  apiInfosByFile = apiInfos.reduce(function(res, apiInfo) {
32
37
  if (!res[apiInfo.filename]) {
33
38
  res[apiInfo.filename] = [];
@@ -39,16 +44,16 @@ var setup = function() {
39
44
  if (!!app)
40
45
  return [
41
46
  3,
42
- 2
47
+ 3
43
48
  ];
44
49
  return [
45
50
  4,
46
51
  createApp(bff_info.appDir, bff_info.modernUserConfig, bff_info.plugins, bff_info.routes)
47
52
  ];
48
- case 1:
49
- app = _state.sent();
50
- _state.label = 2;
51
53
  case 2:
54
+ app = _state.sent();
55
+ _state.label = 3;
56
+ case 3:
52
57
  return [
53
58
  2
54
59
  ];
@@ -7,7 +7,7 @@ let server;
7
7
  const createApp = async (pwd, config, plugins, routes) => {
8
8
  if (!server) {
9
9
  config.output.path = "./";
10
- const pluginInstances = loadServerPlugins(plugins, pwd);
10
+ const pluginInstances = await loadServerPlugins(plugins, pwd);
11
11
  server = await createProdServer({
12
12
  pwd,
13
13
  config,
@@ -21,7 +21,7 @@ const setup = () => {
21
21
  prefix,
22
22
  httpMethodDecider
23
23
  });
24
- const apiInfos = apiRouter.getApiHandlers();
24
+ const apiInfos = await apiRouter.getApiHandlers();
25
25
  const apiInfosByFile = apiInfos.reduce((res, apiInfo) => {
26
26
  if (!res[apiInfo.filename]) {
27
27
  res[apiInfo.filename] = [];
@@ -1,6 +1,6 @@
1
- import { AliasOption } from '@modern-js/utils';
2
- import { JestConfig } from '@modern-js/types';
3
- import { TestConfig } from '../types';
1
+ import type { AliasOption } from '@modern-js/utils';
2
+ import type { JestConfig } from '@modern-js/types';
3
+ import type { TestConfig } from '../types';
4
4
  import { TestConfigOperator } from './testConfigOperator';
5
5
  /**
6
6
  * Parse jest config
@@ -1,4 +1,4 @@
1
- import { TestConfigOperator } from '../testConfigOperator';
1
+ import type { TestConfigOperator } from '../testConfigOperator';
2
2
  /**
3
3
  * Merge config from testConfig.jest
4
4
  */
@@ -1,2 +1,2 @@
1
- import { TestConfigOperator } from '../testConfigOperator';
1
+ import type { TestConfigOperator } from '../testConfigOperator';
2
2
  export declare const applyPatches: (testConfig: TestConfigOperator) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { TestConfigOperator } from '../testConfigOperator';
1
+ import type { TestConfigOperator } from '../testConfigOperator';
2
2
  /**
3
3
  * Map `TestConfig.transformer` to jest config
4
4
  */
@@ -1,4 +1,4 @@
1
- import { TestConfigOperator } from './config/testConfigOperator';
1
+ import type { TestConfigOperator } from './config/testConfigOperator';
2
2
  export declare const jestConfigHook: import("@modern-js/plugin").AsyncPipeline<TestConfigOperator, TestConfigOperator>;
3
3
  export declare const afterTestHook: import("@modern-js/plugin").ParallelWorkflow<void, unknown>;
4
4
  export declare const testingHooks: {
@@ -5,10 +5,10 @@
5
5
  * The followed code is inspired by
6
6
  * https://github.com/facebook/jest/blob/fdc74af37235354e077edeeee8aa2d1a4a863032/packages/jest-cli/src/cli/index.ts#L21
7
7
  */
8
- import { Config } from '@jest/types';
8
+ import type { Config } from '@jest/types';
9
9
  import type { PluginAPI } from '@modern-js/core';
10
- import { UserConfig } from './config';
11
- import { TestConfig } from './types';
10
+ import { type UserConfig } from './config';
11
+ import type { TestConfig } from './types';
12
12
  import type { Hooks } from './hook';
13
13
  type Argv = Omit<Config.Argv, '_' | '$0'>;
14
14
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { ServerPlugin } from '@modern-js/types';
2
+ import type { ServerPlugin } from '@modern-js/types';
3
3
  export declare const isInHandler: () => boolean;
4
4
  declare const createApp: (pwd: string, config: any, plugins: ServerPlugin[], routes: any[]) => Promise<(req: import("http").IncomingMessage, res: import("http").ServerResponse) => Promise<void>>;
5
5
  declare const getApp: () => (req: import("http").IncomingMessage, res: import("http").ServerResponse) => Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import type { CliPlugin, IAppContext } from '@modern-js/core';
2
2
  import type { ServerPlugin } from '@modern-js/server-core';
3
- import { UserConfig } from '../../base/config';
4
- import { TestConfigOperator } from '../../base';
3
+ import type { UserConfig } from '../../base/config';
4
+ import { type TestConfigOperator } from '../../base';
5
5
  import type { Hooks } from '../../base/hook';
6
6
  export declare const setJestConfigForBFF: ({ pwd, userConfig, plugins, routes, utils, appContext, }: {
7
7
  pwd: string;
@@ -1,5 +1,5 @@
1
1
  import type { CliPlugin } from '@modern-js/core';
2
- import { TestConfigOperator } from '../base';
2
+ import { type TestConfigOperator } from '../base';
3
3
  import type { Hooks } from '../base/hook';
4
4
  import type { UserConfig } from '../base/config';
5
5
  export declare const mergeUserJestConfig: (testUtils: TestConfigOperator) => void;
@@ -1,6 +1,6 @@
1
1
  import type { PluginAPI } from '@modern-js/core';
2
- import { Hooks } from '../base/hook';
3
- import { UserConfig } from '../base/config';
2
+ import type { Hooks } from '../base/hook';
3
+ import type { UserConfig } from '../base/config';
4
4
  declare const test: (api: PluginAPI<{
5
5
  hooks: Hooks;
6
6
  userConfig: UserConfig;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  import type { UserConfig } from '@modern-js/core';
3
3
  interface CreateAppProps {
4
4
  entry?: string;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-nightly-20240817170640",
18
+ "version": "0.0.0-nightly-20240819170736",
19
19
  "jsnext:source": "./src/cli/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "main": "./dist/cjs/cli/index.js",
@@ -130,19 +130,19 @@
130
130
  "supertest": "^6.1.6",
131
131
  "ts-jest": "^29.1.0",
132
132
  "yargs": "^17.0.1",
133
- "@modern-js/babel-compiler": "0.0.0-nightly-20240817170640",
134
- "@modern-js/babel-preset": "0.0.0-nightly-20240817170640",
135
- "@modern-js/bff-core": "0.0.0-nightly-20240817170640",
136
- "@modern-js/plugin": "0.0.0-nightly-20240817170640",
137
- "@modern-js/prod-server": "0.0.0-nightly-20240817170640",
138
- "@modern-js/server-core": "0.0.0-nightly-20240817170640",
139
- "@modern-js/types": "0.0.0-nightly-20240817170640",
140
- "@modern-js/utils": "0.0.0-nightly-20240817170640"
133
+ "@modern-js/babel-compiler": "0.0.0-nightly-20240819170736",
134
+ "@modern-js/babel-preset": "0.0.0-nightly-20240819170736",
135
+ "@modern-js/bff-core": "0.0.0-nightly-20240819170736",
136
+ "@modern-js/prod-server": "0.0.0-nightly-20240819170736",
137
+ "@modern-js/plugin": "0.0.0-nightly-20240819170736",
138
+ "@modern-js/types": "0.0.0-nightly-20240819170736",
139
+ "@modern-js/server-core": "0.0.0-nightly-20240819170736",
140
+ "@modern-js/utils": "0.0.0-nightly-20240819170736"
141
141
  },
142
142
  "peerDependencies": {
143
143
  "react": ">=17",
144
144
  "react-dom": ">=17",
145
- "@modern-js/runtime": "0.0.0-nightly-20240817170640"
145
+ "@modern-js/runtime": "0.0.0-nightly-20240819170736"
146
146
  },
147
147
  "peerDependenciesMeta": {
148
148
  "@modern-js/runtime": {
@@ -157,10 +157,10 @@
157
157
  "react": "^18",
158
158
  "react-dom": "^18",
159
159
  "typescript": "^5",
160
- "@modern-js/core": "0.0.0-nightly-20240817170640",
161
- "@modern-js/runtime": "0.0.0-nightly-20240817170640",
162
- "@scripts/jest-config": "0.0.0-nightly-20240817170640",
163
- "@scripts/build": "0.0.0-nightly-20240817170640"
160
+ "@modern-js/core": "0.0.0-nightly-20240819170736",
161
+ "@modern-js/runtime": "0.0.0-nightly-20240819170736",
162
+ "@scripts/jest-config": "0.0.0-nightly-20240819170736",
163
+ "@scripts/build": "0.0.0-nightly-20240819170736"
164
164
  },
165
165
  "sideEffects": false,
166
166
  "publishConfig": {