Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions packages/rstack/src/cli/commandHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export type HelpTopic =
| 'test watch'
| 'test list'
| 'test merge-reports'
| 'test init'
| 'lib'
| 'lib build'
| 'lib inspect'
Expand Down Expand Up @@ -259,7 +258,6 @@ const HELP_DEFINITIONS = {
['watch [...filters]', 'Run tests in watch mode'],
['list [...filters]', 'List matching tests'],
['merge-reports [path]', 'Merge blob reports'],
['init [project]', 'Initialize Rstest configuration'],
],
},
commandHint('test'),
Expand Down Expand Up @@ -338,16 +336,6 @@ const HELP_DEFINITIONS = {
},
],
},
'test init': {
usage: 'rs test init [project] [options]',
description: 'Initialize Rstest configuration',
sections: [
{
title: 'Options',
items: [['--yes', 'Use default options without prompts'], HELP_OPTION],
},
],
},
lib: {
usage: 'rs lib [command] [options]',
sections: [
Expand Down
11 changes: 9 additions & 2 deletions packages/rstack/src/cli/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { join, resolve } from 'node:path';
import { pathToFileURL } from 'node:url';
import { logger } from 'rslog';
import { CLI_CONFIG_PATH_ENV, getConfigState } from './config.ts';
import { insertConfigArg, parseArgs, parseCliArgs } from './args.ts';
import { hasHelpFlag, printCommandHelp } from './help.ts';
Expand Down Expand Up @@ -31,6 +32,14 @@ async function runRsbuildCLI(args: string[]): Promise<void> {
}

async function runRstestCLI(args: string[]): Promise<void> {
if (args[0] === 'init') {
logger.error(
'Rstack CLI does not support "rs test init". Configure browser tests manually with `define.test()` in your Rstack config.',
);
process.exitCode = 1;
return;
}

if (hasHelpFlag(args)) {
switch (args[0]) {
case 'run':
Expand All @@ -41,8 +50,6 @@ async function runRstestCLI(args: string[]): Promise<void> {
return printCommandHelp('test list');
case 'merge-reports':
return printCommandHelp('test merge-reports');
case 'init':
return printCommandHelp('test init');
default:
return printCommandHelp('test');
}
Expand Down
15 changes: 0 additions & 15 deletions packages/rstack/tests/cli/__snapshots__/help.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ Commands:
watch [...filters] Run tests in watch mode
list [...filters] List matching tests
merge-reports [path] Merge blob reports
init [project] Initialize Rstest configuration

For command-specific options, run:
$ rs test <command> -h
Expand All @@ -242,20 +241,6 @@ Options:
"
`;

exports[`displays test init help 1`] = `
"Rstack v<version>

Usage:
$ rs test init [project] [options]

Initialize Rstest configuration

Options:
--yes Use default options without prompts
-h, --help Display this help message
"
`;

exports[`displays test list help 1`] = `
"Rstack v<version>

Expand Down
10 changes: 9 additions & 1 deletion packages/rstack/tests/cli/help.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ for (const command of [
'test watch',
'test list',
'test merge-reports',
'test init',
]) {
test(`displays ${command} help`, ({ execCli, expect }) => {
const output = execCli(`${command} --help`);
Expand All @@ -54,3 +53,12 @@ for (const command of [
expect(normalizeHelpOutput(output)).toMatchSnapshot();
});
}

test('directs test init users to manual browser setup', ({
execCli,
expect,
}) => {
expect(() => execCli('test init browser')).toThrow(
'Configure browser tests manually with `define.test()` in your Rstack config.',
);
});
8 changes: 0 additions & 8 deletions website/docs/en/guide/cli/test.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ rs test list
rs test merge-reports
```

### init

[`rs test init`](https://rstest.rs/guide/basic/cli#rstest-init) initializes an Rstest configuration for a supported project type.

```bash
rs test init browser
```

## Configuration

Configure tests through [`define.test()`](../configuration#define-test) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rstest configuration](https://rstest.rs/config/):
Expand Down
8 changes: 0 additions & 8 deletions website/docs/zh/guide/cli/test.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ rs test list
rs test merge-reports
```

### init

[`rs test init`](https://rstest.rs/zh/guide/basic/cli#rstest-init) 用于为支持的项目类型初始化 Rstest 配置。

```bash
rs test init browser
```

## 配置 \{#configuration}

在 [Rstack 配置文件](/guide/configuration#configuration-file)中通过 [`define.test()`](../configuration#define-test) 配置测试。该 API 支持标准的 [Rstest 配置](https://rstest.rs/zh/config/):
Expand Down
Loading