diff --git a/examples/rstest-inline-projects/rstack.config.ts b/examples/rstest-inline-projects/rstack.config.ts deleted file mode 100644 index 501912cb..00000000 --- a/examples/rstest-inline-projects/rstack.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Rstack configuration guide: https://rstack.rs/config -import { define } from 'rstack'; -import { defineInlineProject } from 'rstack/test'; - -define.app(async () => { - const { pluginReact } = await import('@rsbuild/plugin-react'); - - return { - plugins: [pluginReact()], - }; -}); - -define.test({ - projects: [ - defineInlineProject({ - name: 'ssr', - include: ['./tests/ssr.test.tsx'], - testEnvironment: 'node', - }), - defineInlineProject({ - name: 'dom', - include: ['./tests/dom.test.tsx'], - testEnvironment: 'happy-dom', - }), - ], -}); diff --git a/examples/rstest-inline-projects/package.json b/examples/test-inline-projects/package.json similarity index 92% rename from examples/rstest-inline-projects/package.json rename to examples/test-inline-projects/package.json index 4fea5d03..b1ddaad1 100644 --- a/examples/rstest-inline-projects/package.json +++ b/examples/test-inline-projects/package.json @@ -1,5 +1,5 @@ { - "name": "@examples/rstest-inline-projects", + "name": "@examples/test-inline-projects", "private": true, "type": "module", "scripts": { diff --git a/examples/test-inline-projects/rstack.config.ts b/examples/test-inline-projects/rstack.config.ts new file mode 100644 index 00000000..12fa4e57 --- /dev/null +++ b/examples/test-inline-projects/rstack.config.ts @@ -0,0 +1,27 @@ +// Rstack configuration guide: https://rstack.rs/config +import { define } from 'rstack'; + +define.app(async () => { + const { pluginReact } = await import('@rsbuild/plugin-react'); + return { + plugins: [pluginReact()], + }; +}); + +define.test(async () => { + const { defineInlineProject } = await import('rstack/test'); + return { + projects: [ + defineInlineProject({ + name: 'ssr', + include: ['./tests/ssr.test.tsx'], + testEnvironment: 'node', + }), + defineInlineProject({ + name: 'dom', + include: ['./tests/dom.test.tsx'], + testEnvironment: 'happy-dom', + }), + ], + }; +}); diff --git a/examples/rstest-inline-projects/src/App.tsx b/examples/test-inline-projects/src/App.tsx similarity index 100% rename from examples/rstest-inline-projects/src/App.tsx rename to examples/test-inline-projects/src/App.tsx diff --git a/examples/rstest-inline-projects/src/index.tsx b/examples/test-inline-projects/src/index.tsx similarity index 100% rename from examples/rstest-inline-projects/src/index.tsx rename to examples/test-inline-projects/src/index.tsx diff --git a/examples/rstest-inline-projects/tests/dom.test.tsx b/examples/test-inline-projects/tests/dom.test.tsx similarity index 100% rename from examples/rstest-inline-projects/tests/dom.test.tsx rename to examples/test-inline-projects/tests/dom.test.tsx diff --git a/examples/rstest-inline-projects/tests/ssr.test.tsx b/examples/test-inline-projects/tests/ssr.test.tsx similarity index 100% rename from examples/rstest-inline-projects/tests/ssr.test.tsx rename to examples/test-inline-projects/tests/ssr.test.tsx diff --git a/examples/rstest-inline-projects/tsconfig.json b/examples/test-inline-projects/tsconfig.json similarity index 100% rename from examples/rstest-inline-projects/tsconfig.json rename to examples/test-inline-projects/tsconfig.json diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 014fe63a..2e29deea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -309,7 +309,7 @@ importers: specifier: 'catalog:' version: 7.0.2 - examples/rstest-inline-projects: + examples/test-inline-projects: dependencies: react: specifier: 'catalog:' @@ -320,7 +320,7 @@ importers: devDependencies: '@rsbuild/plugin-react': specifier: 'catalog:' - version: 2.1.0(@rsbuild/core@2.1.10)(@rspack/core@2.1.10) + version: 2.1.0(@rsbuild/core@2.1.12)(@rspack/core@2.1.10) '@testing-library/dom': specifier: 'catalog:' version: 10.4.1 @@ -3988,6 +3988,15 @@ snapshots: transitivePeerDependencies: - '@module-federation/runtime-tools' + '@rsbuild/plugin-react@2.1.0(@rsbuild/core@2.1.10)': + dependencies: + '@rspack/plugin-react-refresh': 2.0.2(@rspack/core@2.1.10)(react-refresh@0.18.0) + react-refresh: 0.18.0 + optionalDependencies: + '@rsbuild/core': 2.1.10 + transitivePeerDependencies: + - '@rspack/core' + '@rsbuild/plugin-react@2.1.0(@rsbuild/core@2.1.10)(@rspack/core@2.1.10)': dependencies: '@rspack/plugin-react-refresh': 2.0.2(@rspack/core@2.1.10)(react-refresh@0.18.0) @@ -3997,6 +4006,15 @@ snapshots: transitivePeerDependencies: - '@rspack/core' + '@rsbuild/plugin-react@2.1.0(@rsbuild/core@2.1.12)(@rspack/core@2.1.10)': + dependencies: + '@rspack/plugin-react-refresh': 2.0.2(@rspack/core@2.1.10)(react-refresh@0.18.0) + react-refresh: 0.18.0 + optionalDependencies: + '@rsbuild/core': 2.1.12 + transitivePeerDependencies: + - '@rspack/core' + '@rsbuild/plugin-sass@2.0.1(@rsbuild/core@2.1.10)': dependencies: deepmerge: 4.3.1 @@ -4264,7 +4282,7 @@ snapshots: '@mdx-js/mdx': 3.1.1(supports-color@8.1.1) '@mdx-js/react': 3.1.1(@types/react@19.2.18)(react@19.2.8) '@rsbuild/core': 2.1.10 - '@rsbuild/plugin-react': 2.1.0(@rsbuild/core@2.1.10)(@rspack/core@2.1.10) + '@rsbuild/plugin-react': 2.1.0(@rsbuild/core@2.1.10) '@rspress/shared': 2.0.19(supports-color@8.1.1) '@shikijs/rehype': 4.3.1 '@types/mdast': 4.0.4 diff --git a/website/docs/en/guide/testing.mdx b/website/docs/en/guide/testing.mdx index aa4a442a..5fcb5494 100644 --- a/website/docs/en/guide/testing.mdx +++ b/website/docs/en/guide/testing.mdx @@ -86,7 +86,7 @@ Run one project by name: rs test --project dom ``` -See [`examples/rstest-inline-projects`](https://github.com/rstackjs/rstack-cli/tree/main/examples/rstest-inline-projects) for a complete React SSR example using Node.js and happy-dom. +See [`examples/test-inline-projects`](https://github.com/rstackjs/rstack-cli/tree/main/examples/test-inline-projects) for a complete React SSR example using Node.js and happy-dom. ### External projects diff --git a/website/docs/zh/guide/testing.mdx b/website/docs/zh/guide/testing.mdx index 9c629635..fd969ad2 100644 --- a/website/docs/zh/guide/testing.mdx +++ b/website/docs/zh/guide/testing.mdx @@ -86,7 +86,7 @@ Rstack CLI 会将对应的适配器应用到每个未设置 `extends` 的内联 rs test --project dom ``` -完整的 React SSR 示例请参阅 [`examples/rstest-inline-projects`](https://github.com/rstackjs/rstack-cli/tree/main/examples/rstest-inline-projects),该示例使用 Node.js 和 happy-dom 两种测试环境。 +完整的 React SSR 示例请参阅 [`examples/test-inline-projects`](https://github.com/rstackjs/rstack-cli/tree/main/examples/test-inline-projects),该示例使用 Node.js 和 happy-dom 两种测试环境。 ### 外部项目 \{#external-projects}