diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index 4d4c79b6b..9ae866b2b 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -106,6 +106,7 @@ jobs: if: steps.changes.outputs.changed == 'true' run: pnpm run test:e2e + # only run benchmark in Ubuntu - name: Benchmarks (Vitest) uses: CodSpeedHQ/action@v3 with: diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index bab059774..43f967d7f 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -115,10 +115,3 @@ jobs: - name: E2E Test (Playwright) if: steps.changes.outputs.changed == 'true' run: pnpm run test:e2e - - - name: Benchmarks (Vitest) - uses: CodSpeedHQ/action@v3 - with: - run: pnpm run test:benchmark - # token retrieved from the CodSpeed app at the previous step - token: ${{ secrets.CODSPEED_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index 07b089558..95125d4d9 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "prepare": "pnpm run build && simple-git-hooks", "sort-package-json": "npx sort-package-json \"packages/*/package.json\"", "test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:e2e", + "test:benchmark": "cd ./tests && pnpm run test:benchmark", "test:e2e": "pnpm run build:examples && cd tests && pnpm run test:e2e", "test:integration": "vitest run --project integration", "test:integration:watch": "vitest --project integration", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5af49a8d9..0f93470b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -203,6 +203,9 @@ importers: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) devDependencies: + '@codspeed/vitest-plugin': + specifier: ^3.1.1 + version: 3.1.1(vite@5.3.3(@types/node@18.19.39)(terser@5.31.6))(vitest@2.1.1(@types/node@18.19.39)(terser@5.31.6)) '@playwright/test': specifier: 1.47.2 version: 1.47.2 @@ -700,6 +703,15 @@ packages: '@changesets/write@0.3.2': resolution: {integrity: sha512-kDxDrPNpUgsjDbWBvUo27PzKX4gqeKOlhibaOXDJA6kuBisGqNHv/HwGJrAu8U/dSf8ZEFIeHIPtvSlZI1kULw==} + '@codspeed/core@3.1.1': + resolution: {integrity: sha512-ONhERVDAtkm0nc+FYPivDozoMOlNUP2BWRBFDJYATGA18Iap5Kd2mZ1/Lwz54RB5+g+3YDOpsvotHa4hd3Q+7Q==} + + '@codspeed/vitest-plugin@3.1.1': + resolution: {integrity: sha512-/PJUgxIfuRqpBSbaD8bgWXtbXxCqgnW89dzr3220fMkx/LA6z6oUb4tJGjeVsOWAzAgu0VBdSA+8hC+7D9BIuQ==} + peerDependencies: + vite: ^4.2.0 || ^5.0.0 + vitest: '>=1.2.2' + '@emnapi/core@1.2.0': resolution: {integrity: sha512-E7Vgw78I93we4ZWdYCb4DGAwRROGkMIXk7/y87UmANR+J6qsWusmC3gLt0H+O0KOt5e6O38U8oJamgbudrES/w==} @@ -2373,6 +2385,10 @@ packages: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} + find-up@6.3.0: + resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + find-value@1.0.12: resolution: {integrity: sha512-OCpo8LTk8eZ2sdDCwbU2Lc3ivYsdM6yod6jP2jHcNEFcjPhkgH0+POzTIol7xx1LZgtbI5rkO5jqxsG5MWtPjQ==} @@ -2898,6 +2914,10 @@ packages: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} + locate-path@7.2.0: + resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + lodash-es@4.17.21: resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} @@ -3214,6 +3234,10 @@ packages: resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + node-gyp-build@4.8.2: + resolution: {integrity: sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==} + hasBin: true + node-machine-id@1.1.12: resolution: {integrity: sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ==} @@ -3299,10 +3323,18 @@ packages: resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} engines: {node: '>=6'} + p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} + p-locate@6.0.0: + resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + p-map@2.1.0: resolution: {integrity: sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==} engines: {node: '>=6'} @@ -3345,6 +3377,10 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} + path-exists@5.0.0: + resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -4434,6 +4470,10 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} + yocto-queue@1.1.1: + resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} + engines: {node: '>=12.20'} + zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -4766,6 +4806,23 @@ snapshots: human-id: 1.0.2 prettier: 2.8.8 + '@codspeed/core@3.1.1': + dependencies: + axios: 1.7.5 + find-up: 6.3.0 + form-data: 4.0.0 + node-gyp-build: 4.8.2 + transitivePeerDependencies: + - debug + + '@codspeed/vitest-plugin@3.1.1(vite@5.3.3(@types/node@18.19.39)(terser@5.31.6))(vitest@2.1.1(@types/node@18.19.39)(terser@5.31.6))': + dependencies: + '@codspeed/core': 3.1.1 + vite: 5.3.3(@types/node@18.19.39)(terser@5.31.6) + vitest: 2.1.1(@types/node@18.19.39)(terser@5.31.6) + transitivePeerDependencies: + - debug + '@emnapi/core@1.2.0': dependencies: '@emnapi/wasi-threads': 1.0.1 @@ -6563,6 +6620,11 @@ snapshots: locate-path: 5.0.0 path-exists: 4.0.0 + find-up@6.3.0: + dependencies: + locate-path: 7.2.0 + path-exists: 5.0.0 + find-value@1.0.12: {} flat@5.0.2: {} @@ -7093,6 +7155,10 @@ snapshots: dependencies: p-locate: 4.1.0 + locate-path@7.2.0: + dependencies: + p-locate: 6.0.0 + lodash-es@4.17.21: {} lodash.startcase@4.4.0: {} @@ -7646,6 +7712,8 @@ snapshots: fetch-blob: 3.2.0 formdata-polyfill: 4.0.10 + node-gyp-build@4.8.2: {} + node-machine-id@1.1.12: {} node-releases@2.0.18: {} @@ -7775,10 +7843,18 @@ snapshots: dependencies: p-try: 2.2.0 + p-limit@4.0.0: + dependencies: + yocto-queue: 1.1.1 + p-locate@4.1.0: dependencies: p-limit: 2.3.0 + p-locate@6.0.0: + dependencies: + p-limit: 4.0.0 + p-map@2.1.0: {} p-try@2.2.0: {} @@ -7831,6 +7907,8 @@ snapshots: path-exists@4.0.0: {} + path-exists@5.0.0: {} + path-key@3.1.1: {} path-parse@1.0.7: {} @@ -8956,4 +9034,6 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 + yocto-queue@1.1.1: {} + zwitch@2.0.4: {} diff --git a/tests/benchmark/package.json b/tests/benchmark/package.json deleted file mode 100644 index f130f0ba8..000000000 --- a/tests/benchmark/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "@rslib/benchmark", - "private": true, - "type": "module", - "scripts": { - "benchmark": "vitest bench" - }, - "devDependencies": { - "@codspeed/vitest-plugin": "^3.1.1", - "@rslib/tsconfig": "workspace:*", - "typescript": "^5.6.2", - "vitest": "^2.0.5" - } -} diff --git a/tests/benchmark/tsconfig.json b/tests/benchmark/tsconfig.json deleted file mode 100644 index 2553bd1de..000000000 --- a/tests/benchmark/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "@rslib/tsconfig/base", - "compilerOptions": { - "outDir": "./dist", - "baseUrl": "./", - "rootDir": "src", - "declaration": true, - "isolatedDeclarations": true, - "composite": true, - "module": "ESNext", - "moduleResolution": "Bundler" - }, - "include": ["src"], - "exclude": ["**/node_modules"] -} diff --git a/tests/benchmark/vitest.config.ts b/tests/benchmark/vitest.config.ts deleted file mode 100644 index 73aac44b0..000000000 --- a/tests/benchmark/vitest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import codspeedPlugin from '@codspeed/vitest-plugin'; -import { defineConfig } from 'vitest/config'; -import { shared } from '../../vitest.workspace'; - -export default defineConfig({ - test: { - ...shared, - name: 'bench', - }, - plugins: [codspeedPlugin()], -}); diff --git a/tests/package.json b/tests/package.json index 63ac8ced2..beec47b2e 100644 --- a/tests/package.json +++ b/tests/package.json @@ -3,6 +3,7 @@ "private": true, "type": "module", "scripts": { + "test:benchmark": "vitest bench", "test:e2e": "playwright test --pass-with-no-tests" }, "dependencies": { @@ -11,6 +12,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { + "@codspeed/vitest-plugin": "^3.1.1", "@playwright/test": "1.47.2", "@rsbuild/core": "1.0.7", "@rsbuild/plugin-react": "1.0.2", diff --git a/tests/tsconfig.json b/tests/tsconfig.json index e794b8be8..5a2210061 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -4,7 +4,7 @@ "noEmit": true, "composite": true }, - "include": ["cases/**/*.ts", "playwright.config.ts", "scripts"], + "include": ["e2e/cases/**/*.ts", "playwright.config.ts", "scripts"], "exclude": ["**/node_modules", "**/.*/"], "references": [ { diff --git a/tests/vitest.config.ts b/tests/vitest.config.ts index a0cd3e263..6db1de3c3 100644 --- a/tests/vitest.config.ts +++ b/tests/vitest.config.ts @@ -1,3 +1,4 @@ +import codspeedPlugin from '@codspeed/vitest-plugin'; import { defineConfig } from 'vitest/config'; import { shared } from '../vitest.workspace'; @@ -8,5 +9,9 @@ export default defineConfig({ setupFiles: ['./setupVitestTests.ts'], include: ['./integration/**/*.test.ts'], exclude: ['**/node_modules/**'], + benchmark: { + include: ['./benchmark/**/*.bench.ts'], + }, }, + plugins: [codspeedPlugin()], });