diff --git a/package.json b/package.json index b208800..efb0c99 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "lint": "rslint && prettier -c .", "lint:write": "rslint --fix && prettier -w .", "prepare": "simple-git-hooks", - "test": "playwright test", + "test": "rstest", "bump": "pnpx bumpp" }, "simple-git-hooks": { @@ -36,10 +36,11 @@ "reduce-configs": "^1.1.2" }, "devDependencies": { - "@playwright/test": "^1.61.1", "@rsbuild/core": "^2.1.4", "@rslib/core": "^0.23.2", "@rslint/core": "^0.6.4", + "@rstest/core": "^0.11.1", + "@rstest/playwright": "^0.11.1", "@types/node": "^24.13.2", "playwright": "^1.61.1", "prettier": "^3.9.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f5e372b..dcd7868 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,9 +15,6 @@ importers: specifier: ^1.1.2 version: 1.1.2 devDependencies: - '@playwright/test': - specifier: ^1.61.1 - version: 1.61.1 '@rsbuild/core': specifier: ^2.1.4 version: 2.1.4 @@ -27,6 +24,12 @@ importers: '@rslint/core': specifier: ^0.6.4 version: 0.6.4 + '@rstest/core': + specifier: ^0.11.1 + version: 0.11.1 + '@rstest/playwright': + specifier: ^0.11.1 + version: 0.11.1(@rstest/core@0.11.1)(playwright@1.61.1) '@types/node': specifier: ^24.13.2 version: 24.13.2 @@ -131,11 +134,6 @@ packages: '@emnapi/core': ^1.7.1 '@emnapi/runtime': ^1.7.1 - '@playwright/test@1.61.1': - resolution: {integrity: sha512-8nKv6+0RJSL9FE4jYOEGXnPeM/Hg12qZpmqzZjRh3qM0Y7c3z1mrOTfFLids72RDQYVh9WpLEfR5WdpNX4fkig==} - engines: {node: '>=18'} - hasBin: true - '@rsbuild/core@2.1.4': resolution: {integrity: sha512-kdubx/qB6tXduCdqaW78OULLZJ3ludpuA4mOkDko18THsI1rUy9U34DsaDSnotE8GAvTeme+FX9MnqLEUlg8kQ==} engines: {node: ^20.19.0 || >=22.12.0} @@ -292,6 +290,26 @@ packages: '@swc/helpers': optional: true + '@rstest/core@0.11.1': + resolution: {integrity: sha512-9iJnDrM/zYuHyk1//CMr/Jer2XughgN3fYagGb1YWpMLUke+E+WXlUPgACwf7OkmIB47/TttbLFK+4zwGDNOFg==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + happy-dom: ^20.8.3 + jsdom: '*' + peerDependenciesMeta: + happy-dom: + optional: true + jsdom: + optional: true + + '@rstest/playwright@0.11.1': + resolution: {integrity: sha512-VhA5SvfYTdC9nJ572Q5NfR8OqcHWr9Agd9zWrkSCBC3sQDwuWLiZTTX4wAv8hMwRtDGzNG0otUPTDrCQ1r0hWQ==} + engines: {node: ^20.19.0 || >=22.12.0} + peerDependencies: + '@rstest/core': workspace:^ + playwright: ^1.49.1 + '@swc/counter@0.1.3': resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} @@ -304,6 +322,12 @@ packages: '@tybys/wasm-util@0.10.3': resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==} + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/node@24.13.2': resolution: {integrity: sha512-fRa09kZTgu8o71KFcDjUFuc7F+dEbZYZmkI0mg5YBTRs0yMKjYHsq/c0urDKeDb+D5qVgXOdFcuu+DZPKOITwA==} @@ -427,6 +451,10 @@ packages: cpu: [x64] os: [win32] + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + csstype@3.2.3: resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==} @@ -588,10 +616,6 @@ snapshots: '@tybys/wasm-util': 0.10.3 optional: true - '@playwright/test@1.61.1': - dependencies: - playwright: 1.61.1 - '@rsbuild/core@2.1.4': dependencies: '@rspack/core': 2.1.2(@swc/helpers@0.5.23) @@ -708,6 +732,19 @@ snapshots: optionalDependencies: '@swc/helpers': 0.5.23 + '@rstest/core@0.11.1': + dependencies: + '@rsbuild/core': 2.1.4 + '@types/chai': 5.2.3 + transitivePeerDependencies: + - '@module-federation/runtime-tools' + - core-js + + '@rstest/playwright@0.11.1(@rstest/core@0.11.1)(playwright@1.61.1)': + dependencies: + '@rstest/core': 0.11.1 + playwright: 1.61.1 + '@swc/counter@0.1.3': {} '@swc/helpers@0.5.23': @@ -723,6 +760,13 @@ snapshots: tslib: 2.8.1 optional: true + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + '@types/node@24.13.2': dependencies: undici-types: 7.18.2 @@ -787,6 +831,8 @@ snapshots: '@typescript/typescript-win32-x64@7.0.2': optional: true + assertion-error@2.0.1: {} + csstype@3.2.3: {} fsevents@2.3.2: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7c22446..2f9f00e 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -5,3 +5,4 @@ allowBuilds: minimumReleaseAgeExclude: - typescript - '@typescript/*' + - '@rstest/*' diff --git a/rstest.config.ts b/rstest.config.ts new file mode 100644 index 0000000..b68293b --- /dev/null +++ b/rstest.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from '@rstest/core'; + +export default defineConfig({ + env: { + // Let Rsbuild choose the mode based on the command. + NODE_ENV: undefined, + }, + isolate: false, +}); diff --git a/test/basic/index.test.ts b/test/basic/index.test.ts index 83df070..06eb4ba 100644 --- a/test/basic/index.test.ts +++ b/test/basic/index.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; -import { expect, test } from '@playwright/test'; +import { expect, test } from '@rstest/playwright'; import { createRsbuild } from '@rsbuild/core'; import { pluginStyledComponents } from '../../dist';