@modern-js/plugin-testing 2.58.2 → 2.59.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/base/config/patches/index.js +1 -1
- package/dist/cjs/base/config/transformer/babelTransformer.js +1 -1
- package/dist/cjs/base/runJest.js +2 -2
- package/dist/cjs/cli/bff/app.js +1 -1
- package/dist/cjs/cli/bff/setup.js +1 -1
- package/dist/cjs/runtime-testing/customRender.js +4 -4
- package/dist/cjs/runtime-testing/reduck.js +2 -2
- package/dist/esm/base/config/patches/index.js +1 -1
- package/dist/esm/base/config/transformer/babelTransformer.js +1 -1
- package/dist/esm/base/runJest.js +2 -2
- package/dist/esm/cli/bff/app.js +1 -1
- package/dist/esm/cli/bff/index.js +1 -1
- package/dist/esm/cli/bff/setup.js +1 -1
- package/dist/esm/cli/index.js +2 -2
- package/dist/esm/runtime-testing/customRender.js +1 -1
- package/dist/esm/runtime-testing/reduck.js +2 -2
- package/dist/esm-node/base/config/patches/index.js +1 -1
- package/dist/esm-node/base/config/transformer/babelTransformer.js +1 -1
- package/dist/esm-node/base/runJest.js +2 -2
- package/dist/esm-node/cli/bff/app.js +1 -1
- package/dist/esm-node/cli/bff/index.js +1 -1
- package/dist/esm-node/cli/bff/setup.js +1 -1
- package/dist/esm-node/cli/index.js +2 -2
- package/dist/esm-node/runtime-testing/customRender.js +1 -1
- package/dist/esm-node/runtime-testing/reduck.js +2 -2
- package/dist/types/base/config/index.d.ts +1 -1
- package/dist/types/base/runJest.d.ts +1 -1
- package/dist/types/cli/bff/index.d.ts +1 -1
- package/dist/types/cli/index.d.ts +1 -1
- package/dist/types/cli/test.d.ts +1 -1
- package/dist/types/runtime-testing/app.d.ts +1 -1
- package/package.json +14 -14
@@ -21,8 +21,8 @@ __export(patches_exports, {
|
|
21
21
|
applyPatches: () => applyPatches
|
22
22
|
});
|
23
23
|
module.exports = __toCommonJS(patches_exports);
|
24
|
-
var import_transformer = require("./transformer");
|
25
24
|
var import_assetsModule = require("./assetsModule");
|
25
|
+
var import_transformer = require("./transformer");
|
26
26
|
const _applyPatches = async (patches2, testOperator) => {
|
27
27
|
for (const patch of patches2) {
|
28
28
|
await patch(testOperator);
|
@@ -31,8 +31,8 @@ __export(babelTransformer_exports, {
|
|
31
31
|
default: () => babelTransformer_default
|
32
32
|
});
|
33
33
|
module.exports = __toCommonJS(babelTransformer_exports);
|
34
|
-
var import_babel_jest = __toESM(require("babel-jest"));
|
35
34
|
var import_utils = require("@modern-js/utils");
|
35
|
+
var import_babel_jest = __toESM(require("babel-jest"));
|
36
36
|
var _babelJest_createTransformer;
|
37
37
|
const isNewJsx = (0, import_utils.isBeyondReact17)(process.cwd());
|
38
38
|
const babelTransformer = (_babelJest_createTransformer = import_babel_jest.default.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(import_babel_jest.default, {
|
package/dist/cjs/base/runJest.js
CHANGED
@@ -32,9 +32,9 @@ __export(runJest_exports, {
|
|
32
32
|
runTest: () => runTest
|
33
33
|
});
|
34
34
|
module.exports = __toCommonJS(runJest_exports);
|
35
|
-
var import_yargs = __toESM(require("yargs/yargs"));
|
36
|
-
var import_jest = require("jest");
|
37
35
|
var import_utils = require("@modern-js/utils");
|
36
|
+
var import_jest = require("jest");
|
37
|
+
var import_yargs = __toESM(require("yargs/yargs"));
|
38
38
|
var import_config = require("./config");
|
39
39
|
var import_utils2 = require("./utils");
|
40
40
|
const buildArgv = async (rawArgv, config) => {
|
package/dist/cjs/cli/bff/app.js
CHANGED
@@ -34,9 +34,9 @@ __export(app_exports, {
|
|
34
34
|
isInHandler: () => isInHandler
|
35
35
|
});
|
36
36
|
module.exports = __toCommonJS(app_exports);
|
37
|
-
var import_async_hooks = require("async_hooks");
|
38
37
|
var import_node_path = __toESM(require("node:path"));
|
39
38
|
var import_prod_server = require("@modern-js/prod-server");
|
39
|
+
var import_async_hooks = require("async_hooks");
|
40
40
|
const store = new import_async_hooks.AsyncLocalStorage();
|
41
41
|
const isInHandler = () => Boolean(store.getStore());
|
42
42
|
let server;
|
@@ -23,9 +23,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
23
23
|
));
|
24
24
|
var import_path = __toESM(require("path"));
|
25
25
|
var import_bff_core = require("@modern-js/bff-core");
|
26
|
+
var import_app = require("./app");
|
26
27
|
var import_constant = require("./constant");
|
27
28
|
var import_mockAPI = __toESM(require("./mockAPI"));
|
28
|
-
var import_app = require("./app");
|
29
29
|
let uped = false;
|
30
30
|
const setup = () => {
|
31
31
|
var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1;
|
@@ -31,11 +31,11 @@ __export(customRender_exports, {
|
|
31
31
|
default: () => customRender_default
|
32
32
|
});
|
33
33
|
module.exports = __toCommonJS(customRender_exports);
|
34
|
-
var import_react =
|
35
|
-
var import_react2 = require("
|
34
|
+
var import_react = require("@testing-library/react");
|
35
|
+
var import_react2 = __toESM(require("react"));
|
36
36
|
var import_app = __toESM(require("./app"));
|
37
|
-
const WrapModernProviders = (props) =>
|
38
|
-
const customRender = (ui, options) => (0,
|
37
|
+
const WrapModernProviders = (props) => import_react2.default.createElement(import_app.default.createApp(props));
|
38
|
+
const customRender = (ui, options) => (0, import_react.render)(ui, {
|
39
39
|
wrapper: WrapModernProviders,
|
40
40
|
...options
|
41
41
|
});
|
@@ -34,10 +34,10 @@ __export(reduck_exports, {
|
|
34
34
|
immer: () => immer
|
35
35
|
});
|
36
36
|
module.exports = __toCommonJS(reduck_exports);
|
37
|
-
var import_store = require("@modern-js-reduck/store");
|
38
|
-
var import_plugin_effects = __toESM(require("@modern-js-reduck/plugin-effects"));
|
39
37
|
var import_plugin_auto_actions = __toESM(require("@modern-js-reduck/plugin-auto-actions"));
|
38
|
+
var import_plugin_effects = __toESM(require("@modern-js-reduck/plugin-effects"));
|
40
39
|
var import_plugin_immutable = __toESM(require("@modern-js-reduck/plugin-immutable"));
|
40
|
+
var import_store = require("@modern-js-reduck/store");
|
41
41
|
var import_constant = require("../constant");
|
42
42
|
const effects = () => import_plugin_effects.default;
|
43
43
|
const immer = () => import_plugin_immutable.default;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
-
import { patchTransformer } from "./transformer";
|
4
3
|
import { patchAssetsModule } from "./assetsModule";
|
4
|
+
import { patchTransformer } from "./transformer";
|
5
5
|
var _applyPatches = function() {
|
6
6
|
var _ref = _async_to_generator(function(patches2, testOperator) {
|
7
7
|
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, patch, err;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
var _babelJest_createTransformer;
|
2
|
-
import babelJest from "babel-jest";
|
3
2
|
import { isBeyondReact17 } from "@modern-js/utils";
|
3
|
+
import babelJest from "babel-jest";
|
4
4
|
var isNewJsx = isBeyondReact17(process.cwd());
|
5
5
|
var babelTransformer = (_babelJest_createTransformer = babelJest.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(babelJest, {
|
6
6
|
presets: [
|
package/dist/esm/base/runJest.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
-
import yargs from "yargs/yargs";
|
4
|
-
import { runCLI } from "jest";
|
5
3
|
import { chalk } from "@modern-js/utils";
|
4
|
+
import { runCLI } from "jest";
|
5
|
+
import yargs from "yargs/yargs";
|
6
6
|
import { getJestUtils, patchConfig } from "./config";
|
7
7
|
import { debug } from "./utils";
|
8
8
|
var buildArgv = function() {
|
package/dist/esm/cli/bff/app.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
|
-
import { AsyncLocalStorage } from "async_hooks";
|
4
3
|
import path from "node:path";
|
5
4
|
import { createProdServer, loadServerPlugins } from "@modern-js/prod-server";
|
5
|
+
import { AsyncLocalStorage } from "async_hooks";
|
6
6
|
var store = new AsyncLocalStorage();
|
7
7
|
var isInHandler = function() {
|
8
8
|
return Boolean(store.getStore());
|
@@ -3,7 +3,7 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
3
3
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
5
5
|
import { isApiOnly } from "@modern-js/utils";
|
6
|
-
import {
|
6
|
+
import { DEFAULT_RESOLVER_PATH, getModuleNameMapper } from "../../base";
|
7
7
|
import { bff_info_key } from "./constant";
|
8
8
|
import { isBFFProject } from "./utils";
|
9
9
|
var setJestConfigForBFF = function() {
|
@@ -2,9 +2,9 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
3
|
import path from "path";
|
4
4
|
import { ApiRouter } from "@modern-js/bff-core";
|
5
|
+
import { closeServer, createApp } from "./app";
|
5
6
|
import { bff_info_key } from "./constant";
|
6
7
|
import mockAPI from "./mockAPI";
|
7
|
-
import { createApp, closeServer } from "./app";
|
8
8
|
var uped = false;
|
9
9
|
var setup = function() {
|
10
10
|
var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1;
|
package/dist/esm/cli/index.js
CHANGED
@@ -2,8 +2,8 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
4
4
|
import path from "path";
|
5
|
-
import { isApiOnly, mergeAlias
|
6
|
-
import {
|
5
|
+
import { createRuntimeExportsUtils, isApiOnly, mergeAlias } from "@modern-js/utils";
|
6
|
+
import { DEFAULT_RESOLVER_PATH, getModuleNameMapper, testingHooks } from "../base";
|
7
7
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
8
8
|
import { testingBffPlugin } from "./bff";
|
9
9
|
import test from "./test";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
2
|
-
import React from "react";
|
3
2
|
import { render } from "@testing-library/react";
|
3
|
+
import React from "react";
|
4
4
|
import app from "./app";
|
5
5
|
var WrapModernProviders = function(props) {
|
6
6
|
return React.createElement(app.createApp(props));
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
3
|
-
import { createStore as originCreateStore } from "@modern-js-reduck/store";
|
4
|
-
import effectsPlugin from "@modern-js-reduck/plugin-effects";
|
5
3
|
import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
|
4
|
+
import effectsPlugin from "@modern-js-reduck/plugin-effects";
|
6
5
|
import immerPlugin from "@modern-js-reduck/plugin-immutable";
|
6
|
+
import { createStore as originCreateStore } from "@modern-js-reduck/store";
|
7
7
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
8
8
|
var effects = function() {
|
9
9
|
return effectsPlugin;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { patchTransformer } from "./transformer";
|
2
1
|
import { patchAssetsModule } from "./assetsModule";
|
2
|
+
import { patchTransformer } from "./transformer";
|
3
3
|
const _applyPatches = async (patches2, testOperator) => {
|
4
4
|
for (const patch of patches2) {
|
5
5
|
await patch(testOperator);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
var _babelJest_createTransformer;
|
2
|
-
import babelJest from "babel-jest";
|
3
2
|
import { isBeyondReact17 } from "@modern-js/utils";
|
3
|
+
import babelJest from "babel-jest";
|
4
4
|
const isNewJsx = isBeyondReact17(process.cwd());
|
5
5
|
const babelTransformer = (_babelJest_createTransformer = babelJest.createTransformer) === null || _babelJest_createTransformer === void 0 ? void 0 : _babelJest_createTransformer.call(babelJest, {
|
6
6
|
presets: [
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import yargs from "yargs/yargs";
|
2
|
-
import { runCLI } from "jest";
|
3
1
|
import { chalk } from "@modern-js/utils";
|
2
|
+
import { runCLI } from "jest";
|
3
|
+
import yargs from "yargs/yargs";
|
4
4
|
import { getJestUtils, patchConfig } from "./config";
|
5
5
|
import { debug } from "./utils";
|
6
6
|
const buildArgv = async (rawArgv, config) => {
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { AsyncLocalStorage } from "async_hooks";
|
2
1
|
import path from "node:path";
|
3
2
|
import { createProdServer, loadServerPlugins } from "@modern-js/prod-server";
|
3
|
+
import { AsyncLocalStorage } from "async_hooks";
|
4
4
|
const store = new AsyncLocalStorage();
|
5
5
|
const isInHandler = () => Boolean(store.getStore());
|
6
6
|
let server;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { isApiOnly } from "@modern-js/utils";
|
2
|
-
import {
|
2
|
+
import { DEFAULT_RESOLVER_PATH, getModuleNameMapper } from "../../base";
|
3
3
|
import { bff_info_key } from "./constant";
|
4
4
|
import { isBFFProject } from "./utils";
|
5
5
|
const setJestConfigForBFF = async ({ pwd, userConfig, plugins, routes, utils, appContext }) => {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import path from "path";
|
2
2
|
import { ApiRouter } from "@modern-js/bff-core";
|
3
|
+
import { closeServer, createApp } from "./app";
|
3
4
|
import { bff_info_key } from "./constant";
|
4
5
|
import mockAPI from "./mockAPI";
|
5
|
-
import { createApp, closeServer } from "./app";
|
6
6
|
let uped = false;
|
7
7
|
const setup = () => {
|
8
8
|
var _bff_info_modernUserConfig_bff, _bff_info_modernUserConfig, _bff_info_modernUserConfig_bff1, _bff_info_modernUserConfig1;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import path from "path";
|
2
|
-
import { isApiOnly, mergeAlias
|
3
|
-
import {
|
2
|
+
import { createRuntimeExportsUtils, isApiOnly, mergeAlias } from "@modern-js/utils";
|
3
|
+
import { DEFAULT_RESOLVER_PATH, getModuleNameMapper, testingHooks } from "../base";
|
4
4
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
5
5
|
import { testingBffPlugin } from "./bff";
|
6
6
|
import test from "./test";
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import React from "react";
|
2
1
|
import { render } from "@testing-library/react";
|
2
|
+
import React from "react";
|
3
3
|
import app from "./app";
|
4
4
|
const WrapModernProviders = (props) => React.createElement(app.createApp(props));
|
5
5
|
const customRender = (ui, options) => render(ui, {
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { createStore as originCreateStore } from "@modern-js-reduck/store";
|
2
|
-
import effectsPlugin from "@modern-js-reduck/plugin-effects";
|
3
1
|
import autoActionsPlugin from "@modern-js-reduck/plugin-auto-actions";
|
2
|
+
import effectsPlugin from "@modern-js-reduck/plugin-effects";
|
4
3
|
import immerPlugin from "@modern-js-reduck/plugin-immutable";
|
4
|
+
import { createStore as originCreateStore } from "@modern-js-reduck/store";
|
5
5
|
import { MODERNJS_CONFIG_KEY } from "../constant";
|
6
6
|
const effects = () => effectsPlugin;
|
7
7
|
const immer = () => immerPlugin;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { AliasOption } from '@modern-js/utils';
|
2
1
|
import type { JestConfig } from '@modern-js/types';
|
2
|
+
import type { AliasOption } from '@modern-js/utils';
|
3
3
|
import type { TestConfig } from '../types';
|
4
4
|
import { TestConfigOperator } from './testConfigOperator';
|
5
5
|
/**
|
@@ -8,8 +8,8 @@
|
|
8
8
|
import type { Config } from '@jest/types';
|
9
9
|
import type { PluginAPI } from '@modern-js/core';
|
10
10
|
import { type UserConfig } from './config';
|
11
|
-
import type { TestConfig } from './types';
|
12
11
|
import type { Hooks } from './hook';
|
12
|
+
import type { TestConfig } from './types';
|
13
13
|
type Argv = Omit<Config.Argv, '_' | '$0'>;
|
14
14
|
/**
|
15
15
|
* Node API: execute jest
|
@@ -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 type { UserConfig } from '../../base/config';
|
4
3
|
import { type TestConfigOperator } from '../../base';
|
4
|
+
import type { UserConfig } from '../../base/config';
|
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,7 +1,7 @@
|
|
1
1
|
import type { CliPlugin } from '@modern-js/core';
|
2
2
|
import { type TestConfigOperator } from '../base';
|
3
|
-
import type { Hooks } from '../base/hook';
|
4
3
|
import type { UserConfig } from '../base/config';
|
4
|
+
import type { Hooks } from '../base/hook';
|
5
5
|
export declare const mergeUserJestConfig: (testUtils: TestConfigOperator) => void;
|
6
6
|
export declare const getJestTransformEsModulesRegStr: () => string;
|
7
7
|
export declare const testingPlugin: () => CliPlugin<{
|
package/dist/types/cli/test.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { PluginAPI } from '@modern-js/core';
|
2
|
-
import type { Hooks } from '../base/hook';
|
3
2
|
import type { UserConfig } from '../base/config';
|
3
|
+
import type { Hooks } from '../base/hook';
|
4
4
|
declare const test: (api: PluginAPI<{
|
5
5
|
hooks: Hooks;
|
6
6
|
userConfig: UserConfig;
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.59.0",
|
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-
|
134
|
-
"@modern-js/babel-
|
135
|
-
"@modern-js/bff-core": "2.
|
136
|
-
"@modern-js/plugin": "2.
|
137
|
-
"@modern-js/
|
138
|
-
"@modern-js/
|
139
|
-
"@modern-js/
|
140
|
-
"@modern-js/utils": "2.
|
133
|
+
"@modern-js/babel-preset": "2.59.0",
|
134
|
+
"@modern-js/babel-compiler": "2.59.0",
|
135
|
+
"@modern-js/bff-core": "2.59.0",
|
136
|
+
"@modern-js/plugin": "2.59.0",
|
137
|
+
"@modern-js/server-core": "2.59.0",
|
138
|
+
"@modern-js/types": "2.59.0",
|
139
|
+
"@modern-js/prod-server": "2.59.0",
|
140
|
+
"@modern-js/utils": "2.59.0"
|
141
141
|
},
|
142
142
|
"peerDependencies": {
|
143
143
|
"react": ">=17",
|
144
144
|
"react-dom": ">=17",
|
145
|
-
"@modern-js/runtime": "^2.
|
145
|
+
"@modern-js/runtime": "^2.59.0"
|
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": "2.
|
161
|
-
"@modern-js/runtime": "2.
|
162
|
-
"@scripts/jest-config": "2.
|
163
|
-
"@scripts/build": "2.
|
160
|
+
"@modern-js/core": "2.59.0",
|
161
|
+
"@modern-js/runtime": "2.59.0",
|
162
|
+
"@scripts/jest-config": "2.59.0",
|
163
|
+
"@scripts/build": "2.59.0"
|
164
164
|
},
|
165
165
|
"sideEffects": false,
|
166
166
|
"publishConfig": {
|