@modern-js/main-doc 2.54.0 → 2.54.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -145,7 +145,6 @@ $ npx modern new
145
145
  Enable BFF
146
146
  Enable SSG
147
147
  Enable Micro Frontend
148
- Enable Unit Test / Integration Test
149
148
  ```
150
149
 
151
150
  :::tip
@@ -266,38 +265,3 @@ Options:
266
265
  Normally, only the part of the code modified by this commit needs to be checked by `lint-staged` during the `git commit` phase.
267
266
 
268
267
  - `--no-fix` close auto fix by lint.
269
-
270
- ## modern test
271
-
272
- `modern test` command will automatically run the test cases.
273
-
274
- ```bash
275
- Usage: modern test [options]
276
-
277
- Options:
278
- -u --updateSnapshot use this flag to re-record snapshots.
279
- --watch watch files for changes and rerun tests related to changed files.
280
- -h, --help show command help
281
- ```
282
-
283
- :::tip
284
- `modern test` command need to execute the `new` command in advance to enable the `unit test/integration test`.
285
- :::
286
-
287
- The effect is as follows:
288
-
289
- ```bash
290
- $ npx modern test
291
- PASS src/tests/index.test.ts
292
- The add method
293
- ✓ should work fine. (2ms)
294
-
295
- Test Suites: 1 passed, 1 total
296
- Tests: 1 passed, 1 total
297
- Snapshots: 0 total
298
- Time: 0.994 s, estimated 1 s
299
- ```
300
-
301
- :::info
302
- Files match `*.test.(js|ts)` in `api/` or `src/` folders will be recognized as test cases by default.
303
- :::
@@ -97,7 +97,6 @@ This function takes the following parameters:
97
97
  - `env`: same as the value of `process.env.NODE_ENV`.
98
98
  - When running `modern dev` or `modern start`, the value of `env` is `development`.
99
99
  - When running `modern build` or `modern serve`, the value of `env` is `production`.
100
- - When running `modern test`, the value of `env` is `test`.
101
100
  - `command`: corresponds to the currently running command, such as `dev`, `start`, `build`, `serve`.
102
101
 
103
102
  ### Export Async Function
@@ -17,7 +17,6 @@ The current path prefix of the asset, which is a read-only environment variable.
17
17
  The current execution environment and is a **read-only** environment variable whose have different values under different execution commands:
18
18
 
19
19
  - `production`: Default value when running `modern build` or `modern serve`.
20
- - `test`: Default value when running `modern test`.
21
20
  - `development`: Default value when running `modern dev`, also the default value in other cases.
22
21
 
23
22
  ### MODERN_ENV
@@ -38,7 +38,6 @@ $ npx modern new
38
38
  ❯ Enable BFF
39
39
  Enable SSG
40
40
  Enable Micro Frontend
41
- Enable Unit Test / Integration Test
42
41
  ```
43
42
 
44
43
  After the selection is completed, the Modern.js generator will automatically install the corresponding plugins and third-party dependencies. Upon completion of the installation, you will see:
@@ -60,8 +60,6 @@ Options:
60
60
 
61
61
  - Enable Micro Frontend -- micro_frontend
62
62
 
63
- - Enable Unit Test / Integration Test -- test
64
-
65
63
  - Enable UA-based Polyfill Feature -- polyfill
66
64
 
67
65
  - Enable Global Proxy -- proxy
@@ -110,8 +108,6 @@ Question: Please select the feature name.
110
108
 
111
109
  Options:
112
110
 
113
- - Enable Unit Test / Integration Test -- test
114
-
115
111
  - Enable Tailwind CSS -- tailwindcss
116
112
 
117
113
  - Enable Storybook -- storybook
@@ -144,7 +144,6 @@ $ npx modern new
144
144
  ❯ 启用 「Tailwind CSS」 支持
145
145
  启用「BFF」功能
146
146
  启用「微前端」模式
147
- 启用「单元测试 / 集成测试」功能
148
147
  ```
149
148
 
150
149
  :::tip
@@ -268,38 +267,3 @@ Options:
268
267
  通常情况下,我们只需要在 `git commit` 阶段通过 `lint-staged` 检查本次提交修改的部分代码。
269
268
 
270
269
  - 设置 `--no-fix` 参数后可以关闭自动修复 lint 错误代码的能力。
271
-
272
- ## modern test
273
-
274
- `modern test` 命令会自动运行项目下的测试用例。
275
-
276
- ```bash
277
- Usage: modern test [options]
278
-
279
- Options:
280
- -u --updateSnapshot 使用此选项来更新快照
281
- --watch 监视文件的变更并重新运行相关的测试
282
- -h, --help 显示命令帮助
283
- ```
284
-
285
- :::tip
286
- 在使用 `modern test` 命令前,需要先通过 [`new`](/apis/app/commands#modern-new) 命令启用「单元测试 / 集成测试」功能。
287
- :::
288
-
289
- 效果如下:
290
-
291
- ```bash
292
- $ npx modern test
293
- PASS src/tests/index.test.ts
294
- The add method
295
- ✓ should work fine. (2ms)
296
-
297
- Test Suites: 1 passed, 1 total
298
- Tests: 1 passed, 1 total
299
- Snapshots: 0 total
300
- Time: 0.994 s, estimated 1 s
301
- ```
302
-
303
- :::info
304
- `src` 和 `api` 目录下面的 `*.test.(js|ts)` 文件都会被识别为测试用例。
305
- :::
@@ -185,7 +185,6 @@ Modern.js Module 的核心能力包括:
185
185
 
186
186
  - **构建能力**:基于 esbuild 实现的构建工具,提供类型生成能力,能够高度定制构建产物。
187
187
  - **调试能力**:基于 Storybook 调试项目,可以测试代码功能、验证构建产物可用性。
188
- - **测试能力**:集成 Jest 测试能力,能够开箱即用地编写你的测试代码。
189
188
  - **版本管理能力**:基于 Changeset 提供版本管理命令,涵盖从开发到发布的过程。
190
189
  - **扩展能力**:提供包含丰富 Hooks 的插件机制,支持扩展调试能力,或对流程进行自定义。
191
190
 
@@ -97,7 +97,6 @@ export default defineConfig(({ env, command }) => ({
97
97
  - `env`:对应 `process.env.NODE_ENV` 的值。
98
98
  - 当运行 `modern dev` 或 `modern start` 时,`env` 的值为 `development`。
99
99
  - 当运行 `modern build` 或 `modern serve` 时,`env` 的值为 `production`。
100
- - 当运行 `modern test` 时,`env` 的值为 `test`。
101
100
  - `command`:对应当前运行的命令,如 `dev`、`start`、`build`、`serve`。
102
101
 
103
102
  ### 导出异步函数
@@ -17,7 +17,6 @@ Modern.js 提供了对环境变量的支持,包含内置的环境变量和自
17
17
  表示当前的执行环境,是**只读的**的环境变量,其值在不同的执行命令下具有不同的值:
18
18
 
19
19
  - `production`:执行 `modern build`、`modern serve` 命令时的默认值。
20
- - `test`:执行 `modern test` 命令时的默认值。
21
20
  - `development`:执行 `modern dev` 命令时的默认值,同时也是其他所有情况下的默认值。
22
21
 
23
22
  ### MODERN_ENV
@@ -37,7 +37,6 @@ $ npx modern new
37
37
  启用 「Tailwind CSS」 支持
38
38
  ❯ 启用「BFF」功能
39
39
  启用「微前端」模式
40
- 启用「单元测试 / 集成测试」功能
41
40
  ```
42
41
 
43
42
  完成选择后,Modern.js 生成器会自动安装对应的插件和三方依赖,安装完成后可以看到:
package/package.json CHANGED
@@ -15,17 +15,17 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.54.0",
18
+ "version": "2.54.2",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public",
22
22
  "provenance": true
23
23
  },
24
24
  "dependencies": {
25
- "@modern-js/sandpack-react": "2.54.0"
25
+ "@modern-js/sandpack-react": "2.54.2"
26
26
  },
27
27
  "peerDependencies": {
28
- "@modern-js/builder-doc": "^2.54.0"
28
+ "@modern-js/builder-doc": "^2.54.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "classnames": "^2",
@@ -39,8 +39,8 @@
39
39
  "@rspress/shared": "1.18.2",
40
40
  "@types/node": "^16",
41
41
  "@types/fs-extra": "9.0.13",
42
- "@modern-js/doc-plugin-auto-sidebar": "2.54.0",
43
- "@modern-js/builder-doc": "2.54.0"
42
+ "@modern-js/builder-doc": "2.54.2",
43
+ "@modern-js/doc-plugin-auto-sidebar": "2.54.2"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "rspress dev",
@@ -1,13 +0,0 @@
1
- ---
2
- title: test.[tj]s
3
- sidebar_position: 4
4
- ---
5
-
6
- # test.[tj]s
7
-
8
- App's BFF test file, support for writing test cases in the `api/` directory which file with suffix `.test.[tj]s`.
9
-
10
- :::info
11
- To use unit test and integration test, you need to execute the `new` command in advance to enable the `unit test/integration test`.
12
-
13
- :::
@@ -1,15 +0,0 @@
1
- ---
2
- title: test.[tj]s
3
- sidebar_position: 2
4
- ---
5
-
6
- # test.[tj]s
7
-
8
- Custom Web Server test directory.
9
-
10
- The application supports testing custom Web Server. You can directly create files with the suffix `.test.[tj]s` under the `server/` directory of the project to write test cases.
11
-
12
- :::info
13
- Enabling unit testing and integration testing requires running the `new` command to enable the "Unit Testing/Integration Testing" function under the project first.
14
-
15
- :::
@@ -1,15 +0,0 @@
1
- ---
2
- title: '**/*.test.[tj]sx?'
3
- sidebar_position: 6
4
- ---
5
-
6
- # **/*.test.[tj]sx?
7
-
8
- Application project test files.
9
-
10
- The application project supports creating files with the suffix `.test.[tj]sx?` in the project source code directory (`src`) to write test cases.
11
-
12
- :::info
13
- To use unit testing and integration testing, you need to enable the "Unit Testing / Integration Testing" feature by running the `new` command in the project first.
14
-
15
- :::
@@ -1,12 +0,0 @@
1
- ---
2
- title: test.[tj]s
3
- sidebar_position: 4
4
- ---
5
- # test.[tj]s
6
-
7
- The BFF test file of the application supports writing test cases in files with the suffix `.test.[tj]sx?` under the `api/` directory.
8
-
9
- :::info
10
- Enabling unit testing and integration testing requires running the new command to enable the "Unit Testing/Integration Testing" function under the project first.
11
-
12
- :::
@@ -1,14 +0,0 @@
1
- ---
2
- title: test.[tj]s
3
- sidebar_position: 2
4
- ---
5
- # test.[tj]s
6
-
7
- 自定义 Web Server 测试目录。
8
-
9
- 应用支持对自定义 Web Server 逻辑进行测试,可直接在项目 `server/` 目录下创建后缀为 `.test.[tj]s` 文件进行编写测试用例。
10
-
11
- :::info
12
- 使用单元测试、集成测试需要提前在项目下执行 new 命令启用「单元测试 / 集成测试」功能。
13
-
14
- :::
@@ -1,14 +0,0 @@
1
- ---
2
- title: '**/*.test.[tj]sx?'
3
- sidebar_position: 6
4
- ---
5
- # **/*.test.[tj]sx?
6
-
7
- 应用项目测试文件。
8
-
9
- 应用项目支持在项目源码目录(src)下创建后缀为 `.test.[tj]sx?` 文件进行编写测试用例。
10
-
11
- :::info
12
- 使用单元测试、集成测试需要提前在项目下执行 new 命令启用「单元测试 / 集成测试」功能。
13
-
14
- :::