You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/site/docs/en/midscene-test/configuration.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,10 @@ Midscene Test supports the following configuration files:
10
10
11
11
| How the configuration is selected | Supported file | Loading behavior |
12
12
| --- | --- | --- |
13
-
| Automatic discovery, when no configuration path is provided |`midscene.config.ts`only | Transformed from TypeScript and loaded |
13
+
| Automatic discovery, when no configuration path is provided |`midscene.config.ts`or `midscene.config.mjs`|`.ts` is transformed from TypeScript; `.mjs` is loaded by Node.js as native ESM|
14
14
| An explicit path passed through the CLI's `--config <path>` option or `loadTestProject(path)`|`.ts` or `.mjs`|`.ts` is transformed from TypeScript; `.mjs` is loaded by Node.js as native ESM without TypeScript transformation |
15
15
16
-
For a typical project, create `midscene.config.ts` in the project root and run Midscene Test without `--config`. Use `.mjs` when another build step already emits the configuration as JavaScript, and pass that file explicitly. A file named `midscene.config.mjs` is not discovered automatically.
16
+
For a typical project, create `midscene.config.ts` in the project root and run Midscene Test without `--config`. If another build step emits the configuration as JavaScript, name it `midscene.config.mjs`and it is discovered in the same way. If both files exist, Midscene Test reports a conflict instead of choosing one silently; use `--config <path>` to select the intended file explicitly.
17
17
18
18
Create browser or device resources in `setup` and register the corresponding Agent Nodes through `nodes`. These determine the capabilities available to each execution project.
19
19
@@ -452,7 +452,7 @@ import {
452
452
} from '@midscene/test';
453
453
```
454
454
455
-
- **`loadTestProject(path)`**: asynchronously loads an explicitly provided TypeScript (`.ts`) or JavaScript ESM (`.mjs`) project configuration. Without an explicit path, the CLI discovers only `midscene.config.ts`. Midscene Test does not support synchronous loading.
455
+
- **`loadTestProject(path)`**: asynchronously loads an explicitly provided TypeScript (`.ts`) or JavaScript ESM (`.mjs`) project configuration. Without `--config`, the CLI discovers `midscene.config.ts` or `midscene.config.mjs`; if both exist, it asks you to select one explicitly. Midscene Test does not support synchronous loading.
456
456
- **`runTestProject()`**: asynchronously discovers, runs, and summarizes the entire project.
457
457
- **`CaseRunner` / `createCaseRunner()`**: directly runs one test case represented as a plain object, without file parsing or lifecycle management.
458
458
- **`runWorkflowDocument()`**: runs the complete lifecycle and every Case in one document.
一般情况下,在项目根目录创建 `midscene.config.ts`,运行 Midscene Test 时无需传入 `--config`。如果配置已经由其他构建流程输出为 JavaScript,可以使用 `.mjs`,但必须显式传入文件路径。Midscene Test 不会自动查找名为 `midscene.config.mjs` 的文件。
16
+
一般情况下,在项目根目录创建 `midscene.config.ts`,运行 Midscene Test 时无需传入 `--config`。如果配置已经由其他构建流程输出为 JavaScript,将它命名为 `midscene.config.mjs`,Midscene Test 也会自动查找。如果两个文件同时存在,Midscene Test 会报告冲突,不会静默选择其中一个;此时请通过 `--config <路径>` 明确指定要使用的文件。
0 commit comments