From 54a6bc15cb5a8398404dfe952241d0e9c6512e43 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Tue, 26 Nov 2024 14:32:53 +0900 Subject: [PATCH] chore: remove bench --- package.json | 1 - .../node/ssr/__tests__/ssrTransform.bench.ts | 81 ------------------- 2 files changed, 82 deletions(-) delete mode 100644 packages/vite/src/node/ssr/__tests__/ssrTransform.bench.ts diff --git a/package.json b/package.json index b4cd3a87b83cc8..3fcd358a893291 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "test-build": "VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", "test-unit": "vitest run", "test-docs": "pnpm run docs-build", - "bench": "vitest bench", "debug-serve": "VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts", "debug-build": "VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 vitest run -c vitest.config.e2e.ts", "docs": "pnpm --filter=docs run docs", diff --git a/packages/vite/src/node/ssr/__tests__/ssrTransform.bench.ts b/packages/vite/src/node/ssr/__tests__/ssrTransform.bench.ts deleted file mode 100644 index f9e314098483a3..00000000000000 --- a/packages/vite/src/node/ssr/__tests__/ssrTransform.bench.ts +++ /dev/null @@ -1,81 +0,0 @@ -import fs from 'node:fs' -import { bench } from 'vitest' -import { ssrTransform } from '../ssrTransform' - -const ssrTransformSimple = async (code: string, url = '') => - ssrTransform(code, null, url, code) -const ssrTransformSimpleCode = async (code: string, url?: string) => - (await ssrTransformSimple(code, url))?.code - -bench( - 'basic', - async () => { - await ssrTransformSimpleCode(` -import { f } from './f' - -let x = 0; - -x -f() - -if (1) - x -f() - -if (1) - x -else - x -f() - - -let y = x -f() - -x /*;;*/ /*;;*/ -f() - -function z() { - x - f() - - if (1) { - x - f() - } -} - -let a = {} -f() - -let b = () => {} -f() - -function c() { -} -f() - -class D { -} -f() - -{ - x -} -f() -`) - }, - { time: 5000 }, -) - -const file = - 'packages/vite/src/node/ssr/__tests__/node_modules/.cache/_chunk-YE4AM67Y.js' -const js = fs.readFileSync(file, 'utf-8') - -bench( - 'large', - async () => { - await ssrTransformSimpleCode(js) - }, - { time: 5000 }, -)