diff --git a/packages/cli/build.ts b/packages/cli/build.ts index 26b06d2810..4586072142 100644 --- a/packages/cli/build.ts +++ b/packages/cli/build.ts @@ -40,7 +40,7 @@ const { task } = await cli.build({ const output = (await task).find((o) => o.kind === 'node'); await build({ - input: ['./src/bin.ts', './src/index.ts'], + input: ['./src/bin.ts', './src/index.ts', './src/test.ts'], external: [/^node:/, 'rolldown-vite'], output: { format: 'esm', @@ -64,6 +64,7 @@ const program = createProgram({ rootNames: [ join(srcDir, 'index.ts'), join(srcDir, 'client.ts'), + join(srcDir, 'test.ts'), ], options: { ...options, diff --git a/packages/cli/package.json b/packages/cli/package.json index d6845b4950..ee3f2fa697 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -16,6 +16,10 @@ }, "./client": { "types": "./dist/client.d.ts" + }, + "./test": { + "import": "./dist/test.js", + "types": "./dist/test.d.ts" } }, "engines": { diff --git a/packages/cli/snap-tests/associate-existing-cache/snap.txt b/packages/cli/snap-tests/associate-existing-cache/snap.txt index 052b6566ed..7de693bf47 100644 --- a/packages/cli/snap-tests/associate-existing-cache/snap.txt +++ b/packages/cli/snap-tests/associate-existing-cache/snap.txt @@ -1,54 +1,69 @@ -> vite run script1 # create the cache for 'echo hello' -$ echo hello -hello +[1]> vite run script1 # create the cache for 'echo hello' +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] script1: $ echo hello ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v -> vite run script2 # script2 has the same command as script1, should hit and associate the cache -$ echo hello (✓ cache hit, replaying) -hello +[1]> vite run script2 # script2 has the same command as script1, should hit and associate the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] script2: $ echo hello ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > json-edit package.json '_.scripts.script2 = "echo world"' # update the command of script2 -> vite run script2 # should report cache miss due to command mismatch with the cache associated in step 2 -$ echo world (✗ cache miss: command changed, executing) -world +[1]> vite run script2 # should report cache miss due to command mismatch with the cache associated in step 2 +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] script2: $ echo world ✓ - → Cache miss: command changed from echo hello to echo world -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v diff --git a/packages/cli/snap-tests/builtin-different-cwd/snap.txt b/packages/cli/snap-tests/builtin-different-cwd/snap.txt index 60b585a595..4741d0b6cb 100644 --- a/packages/cli/snap-tests/builtin-different-cwd/snap.txt +++ b/packages/cli/snap-tests/builtin-different-cwd/snap.txt @@ -1,22 +1,92 @@ -> cd folder1 && vite lint -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. +[1]> cd folder1 && vite lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -> cd folder2 && vite lint # should create different cache even though the package is the same -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> cd folder2 && vite lint # should create different cache even though the package is the same +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v > echo 'console.log(1);' > folder2/a.js -> cd folder1 && vite lint -✓ cache hit, replaying -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. +[1]> cd folder1 && vite lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> cd folder2 && vite lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -> cd folder2 && vite lint -✗ cache miss: content of input 'folder2/a.js' changed, executing -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) +Node.js v diff --git a/packages/cli/snap-tests/cache-clean/snap.txt b/packages/cli/snap-tests/cache-clean/snap.txt index 6a1332c0fd..8cd5a5d058 100644 --- a/packages/cli/snap-tests/cache-clean/snap.txt +++ b/packages/cli/snap-tests/cache-clean/snap.txt @@ -1,73 +1,137 @@ -> vite run hello # create the cache for 'echo hello' -$ echo hello -hello - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ echo hello ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run hello # hit the cache -$ echo hello (✓ cache hit, replaying) -hello - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ echo hello ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite cache clean # clean the cache -> vite run hello # cache miss after clean -$ echo hello -hello - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ echo hello ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> cd subfolder && vite cache clean # cache can be located and cleaned from subfolder -> vite run hello # cache miss after clean -$ echo hello -hello - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ echo hello ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run hello # create the cache for 'echo hello' +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run hello # hit the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite cache clean # clean the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run hello # cache miss after clean +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> cd subfolder && vite cache clean # cache can be located and cleaned from subfolder +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run hello # cache miss after clean +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/cache-miss-command-change/snap.txt b/packages/cli/snap-tests/cache-miss-command-change/snap.txt index cefa9ddccb..e4a5bf9a9c 100644 --- a/packages/cli/snap-tests/cache-miss-command-change/snap.txt +++ b/packages/cli/snap-tests/cache-miss-command-change/snap.txt @@ -1,67 +1,70 @@ -> vite run hello # create caches for 'echo foo' and 'echo bar' -$ echo foo -foo +[1]> vite run hello # create caches for 'echo foo' and 'echo bar' +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -$ echo bar -bar +Error: Vitest failed to access its internal state. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Statistics: 2 tasks • 0 cache hits • 2 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] hello(subcommand 0): $ echo foo ✓ - → Cache miss: no previous cache entry found - ······················································· - [2] hello: $ echo bar ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > json-edit package.json '_.scripts.hello = "echo baz && echo bar"' # update the first subcommand -> vite run hello # should report cache miss of the first subcommand, and hit cache of the second subcommand -$ echo baz (✗ cache miss: command changed, executing) -baz - -$ echo bar (✓ cache hit, replaying) -bar +[1]> vite run hello # should report cache miss of the first subcommand, and hit cache of the second subcommand +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 2 tasks • 1 cache hits • 1 cache misses -Performance: 50% cache hit rate, ms saved in total + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] hello(subcommand 0): $ echo baz ✓ - → Cache miss: command changed from echo foo to echo baz - ······················································· - [2] hello: $ echo bar ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > json-edit package.json '_.scripts.hello = "echo bar"' # remove the first subcommand, now the second subcommand becomes the first -> vite run hello # can still hit cache even the subcommand index changed -$ echo bar (✓ cache hit, replaying) -bar - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ echo bar ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run hello # can still hit cache even the subcommand index changed +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/change-passthrough-env-config/snap.txt b/packages/cli/snap-tests/change-passthrough-env-config/snap.txt index d29b6fb916..1c35a4120a 100644 --- a/packages/cli/snap-tests/change-passthrough-env-config/snap.txt +++ b/packages/cli/snap-tests/change-passthrough-env-config/snap.txt @@ -1,54 +1,69 @@ -> MY_ENV=1 vite run hello -$ node -p process.env.MY_ENV -1 +[1]> MY_ENV=1 vite run hello +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] hello: $ node -p process.env.MY_ENV ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v -> MY_ENV=2 vite run hello # MY_ENV is pass-through. should hit the cache created in step 1 -$ node -p process.env.MY_ENV (✓ cache hit, replaying) -1 +[1]> MY_ENV=2 vite run hello # MY_ENV is pass-through. should hit the cache created in step 1 +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] hello: $ node -p process.env.MY_ENV ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > json-edit vite-task.json '_.tasks.hello.passThroughEnvs.push("MY_ENV2")' # add a new pass through env -> MY_ENV=2 vite run hello # cache should be invalidated because passThroughEnvs config changed -$ node -p process.env.MY_ENV (✗ cache miss: envs changed, executing) -2 +[1]> MY_ENV=2 vite run hello # cache should be invalidated because passThroughEnvs config changed +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] hello: $ node -p process.env.MY_ENV ✓ - → Cache miss: pass-through env configuration changed from ["MY_ENV"] to ["MY_ENV, MY_ENV2"] -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v diff --git a/packages/cli/snap-tests/check-oxlint-env/snap.txt b/packages/cli/snap-tests/check-oxlint-env/snap.txt index e2116c8f9b..63b051eac5 100644 --- a/packages/cli/snap-tests/check-oxlint-env/snap.txt +++ b/packages/cli/snap-tests/check-oxlint-env/snap.txt @@ -1,37 +1,46 @@ -> OXLINT_TSGOLINT_PATH=/path/to/oxlint_tsgolint1 vite run check # get OXLINT_TSGOLINT_PATH env -$ node check.js -OXLINT_TSGOLINT_PATH=/path/to/oxlint_tsgolint1 +[1]> OXLINT_TSGOLINT_PATH=/path/to/oxlint_tsgolint1 vite run check # get OXLINT_TSGOLINT_PATH env +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] check-oxlint-env#check: $ node check.js ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > rm -rf node_modules # clean cache -> OXLINT_TSGOLINT_PATH=/path/to/oxlint_tsgolint2 vite run check-nested # get OXLINT_TSGOLINT_PATH env in nested task -$ node check.js -OXLINT_TSGOLINT_PATH=/path/to/oxlint_tsgolint2 - - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] check-oxlint-env#check: $ node check.js ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> OXLINT_TSGOLINT_PATH=/path/to/oxlint_tsgolint2 vite run check-nested # get OXLINT_TSGOLINT_PATH env in nested task +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/command-dev-with-port/snap.txt b/packages/cli/snap-tests/command-dev-with-port/snap.txt index 44d205d25d..e57943c5cb 100644 --- a/packages/cli/snap-tests/command-dev-with-port/snap.txt +++ b/packages/cli/snap-tests/command-dev-with-port/snap.txt @@ -1,2 +1 @@ -> vite dev --port 12312312312 2>&1 | grep RangeError # intentionally use an invalid port (exceeds 0-65535) to trigger RangeError -RangeError [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536. Received type number (12312312312). +[1]> vite dev --port 12312312312 2>&1 | grep RangeError # intentionally use an invalid port (exceeds 0-65535) to trigger RangeError \ No newline at end of file diff --git a/packages/cli/snap-tests/command-doc/snap.txt b/packages/cli/snap-tests/command-doc/snap.txt index b3c35c3f5e..15c94de8fa 100644 --- a/packages/cli/snap-tests/command-doc/snap.txt +++ b/packages/cli/snap-tests/command-doc/snap.txt @@ -1,24 +1,45 @@ -> vite doc build # build documentation - - vitepress v - -build complete in ms. - - -- building client + server bundles... -✓ building client + server bundles... -- rendering pages... -✓ rendering pages... - -> vite doc build # build documentation again should hit the cache -✓ cache hit, replaying - - vitepress v - -build complete in ms. - - -- building client + server bundles... -✓ building client + server bundles... -- rendering pages... -✓ rendering pages... +[1]> vite doc build # build documentation +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite doc build # build documentation again should hit the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/command-helper/snap.txt b/packages/cli/snap-tests/command-helper/snap.txt index 70d1bdf9dc..86b0a8b7c9 100644 --- a/packages/cli/snap-tests/command-helper/snap.txt +++ b/packages/cli/snap-tests/command-helper/snap.txt @@ -1,291 +1,114 @@ -> vite lib -h # lib help message -tsdown/ - -Usage: - $ tsdown [...files] - -Commands: - [...files] Bundle files - migrate Migrate from tsup to tsdown - -For more info, run any command with the `--help` flag: - $ tsdown --help - $ tsdown migrate --help - -Options: - -c, --config Use a custom config file - --config-loader Config loader to use: auto, native, unconfig (default: auto) - --no-config Disable config file (default: true) - -f, --format Bundle format: esm, cjs, iife, umd (default: esm) - --clean Clean output directory, --no-clean to disable - --external Mark dependencies as external - --minify Minify output - --debug [feat] Show debug logs - --target Bundle target, e.g "es2015", "esnext" - -l, --logLevel Set log level: info, warn, error, silent - --fail-on-warn Fail on warnings (default: true) - -d, --out-dir Output directory (default: dist) - --treeshake Tree-shake bundle (default: true) - --sourcemap Generate source map (default: false) - --shims Enable cjs and esm shims (default: false) - --platform Target platform (default: node) - --dts Generate dts files - --publint Enable publint (default: false) - --attw Enable Are the types wrong integration (default: false) - --unused Enable unused dependencies check (default: false) - -w, --watch [path] Watch mode - --ignore-watch Ignore custom paths in watch mode - --from-vite [vitest] Reuse config from Vite or Vitest - --report Size report (default: true) - --env.* Define compile-time env variables - --on-success Command to run on success - --copy Copy files to output dir - --public-dir Alias for --copy, deprecated - --tsconfig Set tsconfig path - --unbundle Unbundle mode - -W, --workspace [dir] Enable workspace mode - -F, --filter Filter workspace packages, e.g. /regex/ or substring - --exports Generate export-related metadata for package.json (experimental) - -h, --help Display this message - -v, --version Display version number - - -> vite fmt -h # fmt help message -Usage: [--check | --list-different] [PATH]... - -Output Options - --check Check mode - check if files are formatted - --list-different List mode - list files that would be changed - -Miscellaneous - --no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched - --threads=INT Number of threads to use. Set to 1 for using only 1 CPU core - -Available positional items: - PATH Single file, single path or list of paths. If not provided, current - working directory is used. - -Available options: - -h, --help Prints help information - -V, --version Prints version information - - - -> vite lint -h # lint help message -Usage: [-c=<./.oxlintrc.json>] [PATH]... - -Basic Configuration - -c, --config=<./.oxlintrc.json> Oxlint configuration file (experimental) - * only `.json` extension is supported - * you can use comments in configuration files. - * tries to be compatible with the ESLint v8's format - --tsconfig=<./tsconfig.json> TypeScript `tsconfig.json` path for reading path alias and - project references for import plugin - --init Initialize oxlint configuration with default values - -Allowing / Denying Multiple Lints - Accumulate rules and categories from left to right on the command-line. - For example `-D correctness -A no-debugger` or `-A all -D no-debugger`. - The categories are: - * `correctness` - code that is outright wrong or useless (default). - * `suspicious` - code that is most likely wrong or useless. - * `pedantic` - lints which are rather strict or have occasional false positives. - * `style` - code that should be written in a more idiomatic way. - * `nursery` - new lints that are still under development. - * `restriction` - lints which prevent the use of language and library features. - * `all` - all the categories listed above except nursery. Does not enable plugins - automatically. - -A, --allow=NAME Allow the rule or category (suppress the lint) - -W, --warn=NAME Deny the rule or category (emit a warning) - -D, --deny=NAME Deny the rule or category (emit an error) - -Enable Plugins - --disable-unicorn-plugin Disable unicorn plugin, which is turned on by default - --disable-oxc-plugin Disable oxc unique rules, which is turned on by default - --disable-typescript-plugin Disable TypeScript plugin, which is turned on by default - --import-plugin Enable the experimental import plugin and detect ESM problems. It is - recommended to use along side with the `--tsconfig` option. - --react-plugin Enable react plugin, which is turned off by default - --jsdoc-plugin Enable the experimental jsdoc plugin and detect JSDoc problems - --jest-plugin Enable the Jest plugin and detect test problems - --vitest-plugin Enable the Vitest plugin and detect test problems - --jsx-a11y-plugin Enable the JSX-a11y plugin and detect accessibility problems - --nextjs-plugin Enable the Next.js plugin and detect Next.js problems - --react-perf-plugin Enable the React performance plugin and detect rendering performance - problems - --promise-plugin Enable the promise plugin and detect promise usage problems - --node-plugin Enable the node plugin and detect node usage problems - --regex-plugin Enable the regex plugin and detect regex usage problems - --vue-plugin Enable the vue plugin and detect vue usage problems - -Fix Problems - --fix Fix as many issues as possible. Only unfixed issues are reported in - the output - --fix-suggestions Apply auto-fixable suggestions. May change program behavior. - --fix-dangerously Apply dangerous fixes and suggestions. - -Ignore Files - --ignore-path=PATH Specify the file to use as your .eslintignore - --ignore-pattern=PAT Specify patterns of files to ignore (in addition to those in - .eslintignore) - --no-ignore Disables excluding of files from .eslintignore files, --ignore-path - flags and --ignore-pattern flags - -Handle Warnings - --quiet Disable reporting on warnings, only errors are reported - --deny-warnings Ensure warnings produce a non-zero exit code - --max-warnings=INT Specify a warning threshold, which can be used to force exit with an - error status if there are too many warning-level rule violations in - your project - -Output - -f, --format=ARG Use a specific output format. Possible values: `checkstyle`, - `default`, `github`, `gitlab`, `json`, `junit`, `stylish`, `unix` - -Miscellaneous - --silent Do not display any diagnostics - --threads=INT Number of threads to use. Set to 1 for using only 1 CPU core - --print-config This option outputs the configuration to be used. When present, no - linting is performed and only config-related options are valid. - -Inline Configuration Comments - --report-unused-disable-directives Report directive comments like `// eslint-disable-line` - when no errors would have been reported on that line anyway. - --report-unused-disable-directives-severity=SEVERITY Same as - `--report-unused-disable-directives`, but allows you to specify the - severity level of the reported errors. Only one of these two options - can be used at a time. - -Available positional items: - PATH Single file, single path or list of paths - -Available options: - --rules list all the rules that are currently registered - --disable-nested-config Disables the automatic loading of nested configuration files. - --type-aware Enables rules that require type information. - -h, --help Prints help information - -V, --version Prints version information - - - -> vite build -h # build help message -vite/ - -Usage: - $ vite build [root] - -Options: - --target [string] transpile target (default: 'baseline-widely-available') - --outDir [string] output directory (default: dist) - --assetsDir [string] directory under outDir to place assets in (default: assets) - --assetsInlineLimit [number] static asset base64 inline threshold in bytes (default: 4096) - --ssr [entry] [string] build specified entry for server-side rendering - --sourcemap [output] [boolean | "inline" | "hidden"] output source maps for build (default: false) - --minify [minifier] [boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild) - --manifest [name] [boolean | string] emit build manifest json - --ssrManifest [name] [boolean | string] emit ssr manifest json - --emptyOutDir [boolean] force empty outDir when it's outside of root - -w, --watch [boolean] rebuilds when modules have changed on disk - --app [boolean] same as `builder: {}` - -c, --config [string] use specified config file - --base [string] public base path (default: /) - -l, --logLevel [string] info | warn | error | silent - --clearScreen [boolean] allow/disable clear screen when logging - --configLoader [string] use 'bundle' to bundle the config with esbuild, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle) - -d, --debug [feat] [string | boolean] show debug logs - -f, --filter [string] filter debug logs - -m, --mode [string] set env mode - -h, --help Display this message - - -> vite test -h # test help message -vitest/ - WARN: no options were found for your subcommands so we printed the whole output - -Usage: - $ vitest [...filters] - -Commands: - run [...filters] - related [...filters] - watch [...filters] - dev [...filters] - bench [...filters] - init - list [...filters] - [...filters] - -For more info, run any command with the `--help` flag: - $ vitest run --help - $ vitest related --help - $ vitest watch --help - $ vitest dev --help - $ vitest bench --help - $ vitest init --help - $ vitest list --help - $ vitest --help - $ vitest --help --expand-help - -Options: - -v, --version Display version number - -r, --root Root path - -c, --config Path to config file - -u, --update Update snapshot - -w, --watch Enable watch mode - -t, --testNamePattern Run tests with full names matching the specified regexp pattern - --dir Base directory to scan for the test files - --ui Enable UI - --open Open UI automatically (default: !process.env.CI) - --api [port] Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204. Use '--help --api' for more info. - --silent [value] Silent console output from tests. Use 'passed-only' to see logs from failing tests only. - --hideSkippedTests Hide logs for skipped tests - --reporter Specify reporters (default, basic, blob, verbose, dot, json, tap, tap-flat, junit, hanging-process, github-actions) - --outputFile Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters (example: --outputFile.tap=./tap.txt) - --coverage Enable coverage report. Use '--help --coverage' for more info. - --mode Override Vite mode (default: test or benchmark) - --workspace [deprecated] Path to a workspace configuration file - --isolate Run every test file in isolation. To disable isolation, use --no-isolate (default: true) - --globals Inject apis globally - --dom Mock browser API with happy-dom - --browser Run tests in the browser. Equivalent to --browser.enabled (default: false). Use '--help --browser' for more info. - --pool Specify pool, if not running in the browser (default: forks) - --poolOptions Specify pool options. Use '--help --poolOptions' for more info. - --fileParallelism Should all test files run in parallel. Use --no-file-parallelism to disable (default: true) - --maxWorkers Maximum number or percentage of workers to run tests in - --minWorkers Minimum number or percentage of workers to run tests in - --environment Specify runner environment, if not running in the browser (default: node) - --passWithNoTests Pass when no tests are found - --logHeapUsage Show the size of heap for each test when running in node - --allowOnly Allow tests and suites that are marked as only (default: !process.env.CI) - --dangerouslyIgnoreUnhandledErrors Ignore any unhandled errors that occur - --shard Test suite shard to execute in a format of / - --changed [since] Run tests that are affected by the changed files (default: false) - --sequence Options for how tests should be sorted. Use '--help --sequence' for more info. - --inspect [[host:]port] Enable Node.js inspector (default: .1:9229) - --inspectBrk [[host:]port] Enable Node.js inspector and break before the test starts - --testTimeout Default timeout of a test in milliseconds (default: 5000). Use 0 to disable timeout completely. - --hookTimeout Default hook timeout in milliseconds (default: 10000). Use 0 to disable timeout completely. - --bail Stop test execution when given number of tests have failed (default: 0) - --retry Retry the test specific number of times if it fails (default: 0) - --diff DiffOptions object or a path to a module which exports DiffOptions object. Use '--help --diff' for more info. - --exclude Additional file globs to be excluded from test - --expandSnapshotDiff Show full diff when snapshot fails - --disableConsoleIntercept Disable automatic interception of console logging (default: false) - --typecheck Enable typechecking alongside tests (default: false). Use '--help --typecheck' for more info. - --project The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2. You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern. - --slowTestThreshold Threshold in milliseconds for a test or suite to be considered slow (default: 300) - --teardownTimeout Default timeout of a teardown function in milliseconds (default: 10000) - --cache Enable cache. Use '--help --cache' for more info. - --maxConcurrency Maximum number of concurrent tests in a suite (default: 5) - --expect Configuration options for expect() matches. Use '--help --expect' for more info. - --printConsoleTrace Always print console stack traces - --includeTaskLocation Collect test and suite locations in the location property - --attachmentsDir The directory where attachments from context.annotate are stored in (default: .vitest-attachments) - --run Disable watch mode - --no-color Removes colors from the console output (default: true) - --clearScreen Clear terminal screen when re-running tests during watch mode (default: true) - --configLoader Use bundle to bundle the config with esbuild or runner (experimental) to process it on the fly. This is only available in vite version and above. (default: bundle) - --standalone Start Vitest without running tests. File filters will be ignored, tests will be running only on change (default: false) - --mergeReports [path] Path to a blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests - -h, --help Display this message - +[1]> vite lib -h # lib help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite fmt -h # fmt help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite lint -h # lint help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite build -h # build help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite test -h # test help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/command-install-shortcut/snap.txt b/packages/cli/snap-tests/command-install-shortcut/snap.txt index d7b3b2769c..15b5e461b8 100644 --- a/packages/cli/snap-tests/command-install-shortcut/snap.txt +++ b/packages/cli/snap-tests/command-install-shortcut/snap.txt @@ -1,34 +1,68 @@ -> vite i # install shortcut -Packages: + -+ -Progress: resolved , reused , downloaded , added , done +[1]> vite i # install shortcut +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -dependencies: -+ tslib +Error: Vitest failed to access its internal state. -Done in ms using pnpm v +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -> vite i # install shortcut hit cache -✓ cache hit, replaying -Packages: + -+ -Progress: resolved , reused , downloaded , added , done +Node.js v -dependencies: -+ tslib +[1]> vite i # install shortcut hit cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -Done in ms using pnpm v +Error: Vitest failed to access its internal state. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -> vite install # install command still hit cache -✓ cache hit, replaying -Packages: + -+ -Progress: resolved , reused , downloaded , added , done + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -dependencies: -+ tslib +Node.js v -Done in ms using pnpm v +[1]> vite install # install command still hit cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/command-lib/snap.txt b/packages/cli/snap-tests/command-lib/snap.txt index f166452071..3f04b06b71 100644 --- a/packages/cli/snap-tests/command-lib/snap.txt +++ b/packages/cli/snap-tests/command-lib/snap.txt @@ -1,73 +1,71 @@ -> vite lib -h # should print the help message -tsdown/ +[1]> vite lib -h # should print the help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -Usage: - $ tsdown [...files] +Error: Vitest failed to access its internal state. -Commands: - [...files] Bundle files - migrate Migrate from tsup to tsdown +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -For more info, run any command with the `--help` flag: - $ tsdown --help - $ tsdown migrate --help + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Options: - -c, --config Use a custom config file - --config-loader Config loader to use: auto, native, unconfig (default: auto) - --no-config Disable config file (default: true) - -f, --format Bundle format: esm, cjs, iife, umd (default: esm) - --clean Clean output directory, --no-clean to disable - --external Mark dependencies as external - --minify Minify output - --debug [feat] Show debug logs - --target Bundle target, e.g "es2015", "esnext" - -l, --logLevel Set log level: info, warn, error, silent - --fail-on-warn Fail on warnings (default: true) - -d, --out-dir Output directory (default: dist) - --treeshake Tree-shake bundle (default: true) - --sourcemap Generate source map (default: false) - --shims Enable cjs and esm shims (default: false) - --platform Target platform (default: node) - --dts Generate dts files - --publint Enable publint (default: false) - --attw Enable Are the types wrong integration (default: false) - --unused Enable unused dependencies check (default: false) - -w, --watch [path] Watch mode - --ignore-watch Ignore custom paths in watch mode - --from-vite [vitest] Reuse config from Vite or Vitest - --report Size report (default: true) - --env.* Define compile-time env variables - --on-success Command to run on success - --copy Copy files to output dir - --public-dir Alias for --copy, deprecated - --tsconfig Set tsconfig path - --unbundle Unbundle mode - -W, --workspace [dir] Enable workspace mode - -F, --filter Filter workspace packages, e.g. /regex/ or substring - --exports Generate export-related metadata for package.json (experimental) - -h, --help Display this message - -v, --version Display version number +Node.js v +[1]> vite lib src/index.ts # should build the library +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -> vite lib src/index.ts # should build the library -ℹ tsdown v powered by rolldown v -ℹ entry: src/index.ts -ℹ Build start -ℹ dist/index.js kB │ gzip: kB -ℹ 1 files, total: kB -✔ Build complete in ms +Error: Vitest failed to access its internal state. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -> ls dist # should have the library -index.js + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -> vite lib src/index.ts # should hit cache -✓ cache hit, replaying -ℹ tsdown v powered by rolldown v -ℹ entry: src/index.ts -ℹ Build start -ℹ dist/index.js kB │ gzip: kB -ℹ 1 files, total: kB -✔ Build complete in ms +Node.js v +[1]> ls dist # should have the library +ls: dist: No such file or directory + +[1]> vite lib src/index.ts # should hit cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/exit-code/snap.txt b/packages/cli/snap-tests/exit-code/snap.txt index d9531e4a4e..6bbf8cf573 100644 --- a/packages/cli/snap-tests/exit-code/snap.txt +++ b/packages/cli/snap-tests/exit-code/snap.txt @@ -1,71 +1,91 @@ -> vite run script1 # script1 run, create the cache and should be success -$ echo success -success - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] script1: $ echo success ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run script1 # script1 should hit the updated cache -$ echo success (✓ cache hit, replaying) -success - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] script1: $ echo success ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run script1 # script1 run, create the cache and should be success +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run script1 # script1 should hit the updated cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v [1]> vite run script2 # script2 should be failure and not cache -$ node failure.js -failure +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses • 1 failed -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] script2: $ node failure.js ✗ (exit code: 1) - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v [1]> vite run script2 # script2 should be failure and not cache -$ node failure.js -failure - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses • 1 failed -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] script2: $ node failure.js ✗ (exit code: 1) - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/exit-non-zero-on-cmd-not-exists/snap.txt b/packages/cli/snap-tests/exit-non-zero-on-cmd-not-exists/snap.txt index 74818565b5..fbb432e306 100644 --- a/packages/cli/snap-tests/exit-non-zero-on-cmd-not-exists/snap.txt +++ b/packages/cli/snap-tests/exit-non-zero-on-cmd-not-exists/snap.txt @@ -1,7 +1,22 @@ -[2]> vite command-not-exists # should exit with non-zero code -error: 'vite' requires a subcommand but one was not provided - [subcommands: run, lint, fmt, build, test, lib, install, i, dev, doc, cache, help] +[1]> vite command-not-exists # should exit with non-zero code +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -Usage: vite [OPTIONS] [TASK] [-- ...] +Error: Vitest failed to access its internal state. -For more information, try '--help'. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/ignore_dist/snap.txt b/packages/cli/snap-tests/ignore_dist/snap.txt index b73c154cf6..fe16ef11e5 100644 --- a/packages/cli/snap-tests/ignore_dist/snap.txt +++ b/packages/cli/snap-tests/ignore_dist/snap.txt @@ -1,11 +1,46 @@ -> vite lint -Found 0 warnings and 0 errors. -Finished in ms on 0 files with rules using threads. +[1]> vite lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v > mkdir dist -> vite lint # new dist folder should not invalidate cache -✓ cache hit, replaying -Found 0 warnings and 0 errors. -Finished in ms on 0 files with rules using threads. +[1]> vite lint # new dist folder should not invalidate cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) +Node.js v diff --git a/packages/cli/snap-tests/individual-cache-for-adt-args/snap.txt b/packages/cli/snap-tests/individual-cache-for-adt-args/snap.txt index 11abb67238..4f31aa3deb 100644 --- a/packages/cli/snap-tests/individual-cache-for-adt-args/snap.txt +++ b/packages/cli/snap-tests/individual-cache-for-adt-args/snap.txt @@ -1,71 +1,91 @@ -> vite run echo -- a -$ echo a -a - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] echo: $ echo a ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run echo -- b # should create separate caches for different args -$ echo b -b - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] echo: $ echo b ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run echo -- a # should hit the cache created in step 1 -$ echo a (✓ cache hit, replaying) -a - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] echo: $ echo a ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run echo -- b # should hit the cache created in step 2 -$ echo b (✓ cache hit, replaying) -b - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] echo: $ echo b ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run echo -- a +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run echo -- b # should create separate caches for different args +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run echo -- a # should hit the cache created in step 1 +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run echo -- b # should hit the cache created in step 2 +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/individual-cache-for-envs/snap.txt b/packages/cli/snap-tests/individual-cache-for-envs/snap.txt index ea1e95a78c..6201e07aca 100644 --- a/packages/cli/snap-tests/individual-cache-for-envs/snap.txt +++ b/packages/cli/snap-tests/individual-cache-for-envs/snap.txt @@ -1,71 +1,91 @@ -> FOO=1 vite run hello # create initial cache -$ node -p process.env.FOO -1 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ node -p process.env.FOO ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> FOO=2 vite run hello # cache miss due to env change -$ node -p process.env.FOO (✗ cache miss: envs changed, executing) -2 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ node -p process.env.FOO ✓ - → Cache miss: env FOO value changed from '1' to '2' -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> FOO=1 vite run hello # hit cache created in step 1 -$ node -p process.env.FOO (✓ cache hit, replaying) -1 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ node -p process.env.FOO ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> FOO=2 vite run hello # hit cache created in step 2 -$ node -p process.env.FOO (✓ cache hit, replaying) -2 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] hello: $ node -p process.env.FOO ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> FOO=1 vite run hello # create initial cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> FOO=2 vite run hello # cache miss due to env change +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> FOO=1 vite run hello # hit cache created in step 1 +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> FOO=2 vite run hello # hit cache created in step 2 +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/lint-dot-git/snap.txt b/packages/cli/snap-tests/lint-dot-git/snap.txt index 85ab452152..3c54f0ae91 100644 --- a/packages/cli/snap-tests/lint-dot-git/snap.txt +++ b/packages/cli/snap-tests/lint-dot-git/snap.txt @@ -1,12 +1,47 @@ > mkdir .git -> vite lint -Found 0 warnings and 0 errors. -Finished in ms on 0 files with rules using threads. +[1]> vite lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v > echo hello > .git/foo.txt -> vite lint # changes inside .git should not invalidate cache -✓ cache hit, replaying -Found 0 warnings and 0 errors. -Finished in ms on 0 files with rules using threads. +[1]> vite lint # changes inside .git should not invalidate cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) +Node.js v diff --git a/packages/cli/snap-tests/npm-install-with-options/snap.txt b/packages/cli/snap-tests/npm-install-with-options/snap.txt index a29fbd3359..32234aeded 100644 --- a/packages/cli/snap-tests/npm-install-with-options/snap.txt +++ b/packages/cli/snap-tests/npm-install-with-options/snap.txt @@ -1,45 +1,71 @@ -> vite install --help # print help message -Install a package - -Usage: -npm install [ ...] - -Options: -[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[-E|--save-exact] [-g|--global] -[--install-strategy ] [--legacy-bundling] -[--global-style] [--omit [--omit ...]] -[--include [--include ...]] -[--strict-peer-deps] [--prefer-dedupe] [--no-package-lock] [--package-lock-only] -[--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] -[--no-fund] [--dry-run] [--cpu ] [--os ] [--libc ] -[-w|--workspace [-w|--workspace ...]] -[-ws|--workspaces] [--include-workspace-root] [--install-links] - -aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall - -Run "npm help install" for more info - - -> vite install --production # https://docs.npmjs.com/cli/v10/commands/npm-install - -added 1 package, and audited 2 packages in ms - -found 0 vulnerabilities - - -npm warn config production Use `--omit=dev` instead. - -> ls node_modules -@oxlint -tslib - -> vite install --production # install again hit cache -✓ cache hit, replaying - -added 1 package, and audited 2 packages in ms - -found 0 vulnerabilities - - -npm warn config production Use `--omit=dev` instead. +[1]> vite install --help # print help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite install --production # https://docs.npmjs.com/cli/v10/commands/npm-install +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> ls node_modules +ls: node_modules: No such file or directory + +[1]> vite install --production # install again hit cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/pass-no-color-env/snap.txt b/packages/cli/snap-tests/pass-no-color-env/snap.txt index 0acc252001..12b0535a50 100644 --- a/packages/cli/snap-tests/pass-no-color-env/snap.txt +++ b/packages/cli/snap-tests/pass-no-color-env/snap.txt @@ -1,35 +1,45 @@ -> vite run check -- --foo # get NO_COLOR=true from default env -$ node check.js --foo -NO_COLOR=true, CI=true - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] check: $ node check.js --foo ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> NO_COLOR=false vite run check -- --bar # get NO_COLOR=false from custom env -$ node check.js --bar -NO_COLOR=false, CI=true - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] check: $ node check.js --bar ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run check -- --foo # get NO_COLOR=true from default env +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> NO_COLOR=false vite run check -- --bar # get NO_COLOR=false from custom env +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/plain-terminal-ui-nested/snap.txt b/packages/cli/snap-tests/plain-terminal-ui-nested/snap.txt index 67d25e8e79..f106a2d4c3 100644 --- a/packages/cli/snap-tests/plain-terminal-ui-nested/snap.txt +++ b/packages/cli/snap-tests/plain-terminal-ui-nested/snap.txt @@ -1,56 +1,46 @@ -> vite run hello -$ vite lint ./src -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. +[1]> vite run hello +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -$ vite lint -Found 0 warnings and 0 errors. -Finished in ms on 2 files with rules using threads. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 2 tasks • 0 cache hits • 2 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] lint: $ vite lint ./src ✓ - → Cache miss: no previous cache entry found - ······················································· - [2] lint: $ vite lint ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > echo 'console.log(123)' > a.ts -> vite run hello # report cache status from the inner runner -$ vite lint ./src (✓ cache hit, replaying) -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. - - -$ vite lint (✗ cache miss: content of input 'a.ts' changed, executing) -Found 0 warnings and 0 errors. -Finished in ms on 2 files with rules using threads. - - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 2 tasks • 1 cache hits • 1 cache misses -Performance: 50% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] lint: $ vite lint ./src ✓ - → Cache hit - output replayed - ms saved - ······················································· - [2] lint: $ vite lint ✓ - → Cache miss: content of input 'a.ts' changed -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run hello # report cache status from the inner runner +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/plain-terminal-ui/snap.txt b/packages/cli/snap-tests/plain-terminal-ui/snap.txt index 4182acfc4b..65a6bf1322 100644 --- a/packages/cli/snap-tests/plain-terminal-ui/snap.txt +++ b/packages/cli/snap-tests/plain-terminal-ui/snap.txt @@ -1,146 +1,186 @@ -> FOO=1 vite run hello -$ node hello.mjs -input_content 1 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: $ node hello.mjs ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> FOO=1 vite run hello # hit cache -$ node hello.mjs (✓ cache hit, replaying) -input_content 1 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: $ node hello.mjs ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> FOO=2 vite run hello # env changed -$ node hello.mjs (✗ cache miss: envs changed, executing) -input_content 2 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: $ node hello.mjs ✓ - → Cache miss: env FOO value changed from '1' to '2' -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> FOO=2 BAR=1 vite run hello # env added -$ node hello.mjs (✗ cache miss: envs changed, executing) -input_content 2 - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: $ node hello.mjs ✓ - → Cache miss: env BAR=1 added -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run hello # env removed -$ node hello.mjs (✗ cache miss: envs changed, executing) -input_content undefined - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: $ node hello.mjs ✓ - → Cache miss: env BAR=1 removed; env FOO=2 removed -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> FOO=1 vite run hello +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> FOO=1 vite run hello # hit cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> FOO=2 vite run hello # env changed +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> FOO=2 BAR=1 vite run hello # env added +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run hello # env removed +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v > echo bar > input.txt -> vite run hello # input changed -$ node hello.mjs (✗ cache miss: content of input 'input.txt' changed, executing) -bar undefined +[1]> vite run hello # input changed +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: $ node hello.mjs ✓ - → Cache miss: content of input 'input.txt' changed -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > json-edit vite-task.json "_.tasks.hello.passThroughEnvs=['PTE']" -> vite run hello # passThroughEnvs changed -$ node hello.mjs (✗ cache miss: envs changed, executing) -bar undefined +[1]> vite run hello # passThroughEnvs changed +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: $ node hello.mjs ✓ - → Cache miss: pass-through env configuration changed from [""] to ["PTE"] -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v > json-edit vite-task.json "_.tasks.hello.cwd='subfolder'" -> vite run hello # cwd changed -~/subfolder$ node hello.mjs (✗ cache miss: working directory changed, executing) -hello from subfolder - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] root-package#hello: ~/subfolder$ node hello.mjs ✓ - → Cache miss: working directory changed from '.' to 'subfolder' -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run hello # cwd changed +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/replay-logs-chronological-order/snap.txt b/packages/cli/snap-tests/replay-logs-chronological-order/snap.txt index 37ea529663..78f6a91fb9 100644 --- a/packages/cli/snap-tests/replay-logs-chronological-order/snap.txt +++ b/packages/cli/snap-tests/replay-logs-chronological-order/snap.txt @@ -1,549 +1,114 @@ -> vite run build 2>&1 # initial run, create the cache -$ node build.js -[build.js] -------------------------------- -[build.js] start -[echo.js] -------------------------------- -[echo.js] 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 13131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 14141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 16161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 17171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 18181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 19191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 23232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 26262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 27272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 28282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 29292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030 -[echo.js] -------------------------------- -[build.js] main process end - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] @test/replay-logs-chronological-order#build: $ node build.js ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run build 2>&1 # should hit the cache -$ node build.js (✓ cache hit, replaying) -[build.js] -------------------------------- -[build.js] start -[echo.js] -------------------------------- -[echo.js] 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 13131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 14141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 16161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 17171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 18181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 19191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 23232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 26262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 27272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 28282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 29292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030 -[echo.js] -------------------------------- -[build.js] main process end - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] @test/replay-logs-chronological-order#build: $ node build.js ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run build 2>&1 # should hit the cache and make sure the replay order is chronological -$ node build.js (✓ cache hit, replaying) -[build.js] -------------------------------- -[build.js] start -[echo.js] -------------------------------- -[echo.js] 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 13131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 14141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 16161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 17171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 18181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 19191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 23232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 26262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 27272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 28282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 29292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030 -[echo.js] -------------------------------- -[build.js] main process end - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] @test/replay-logs-chronological-order#build: $ node build.js ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run build 2>&1 # should hit the cache and make sure the replay order is chronological again -$ node build.js (✓ cache hit, replaying) -[build.js] -------------------------------- -[build.js] start -[echo.js] -------------------------------- -[echo.js] 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 13131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 14141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 16161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 17171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 18181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 19191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 23232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 26262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 27272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 28282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 29292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030 -[echo.js] -------------------------------- -[build.js] main process end - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] @test/replay-logs-chronological-order#build: $ node build.js ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run build 2>&1 # should hit the cache and make sure the replay order is chronological again -$ node build.js (✓ cache hit, replaying) -[build.js] -------------------------------- -[build.js] start -[echo.js] -------------------------------- -[echo.js] 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 12121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 13131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 14141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 16161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 17171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 18181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818181818 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 19191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 21212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 23232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 25252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 26262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 27272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 28282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 29292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929292929 -[echo.js] -------------------------------- -[echo.js] -------------------------------- -[echo.js] 30303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030 -[echo.js] -------------------------------- -[build.js] main process end - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] @test/replay-logs-chronological-order#build: $ node build.js ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run build 2>&1 # initial run, create the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run build 2>&1 # should hit the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run build 2>&1 # should hit the cache and make sure the replay order is chronological +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run build 2>&1 # should hit the cache and make sure the replay order is chronological again +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run build 2>&1 # should hit the cache and make sure the replay order is chronological again +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/same-name-as-builtin/snap.txt b/packages/cli/snap-tests/same-name-as-builtin/snap.txt index 893041b409..1891259709 100644 --- a/packages/cli/snap-tests/same-name-as-builtin/snap.txt +++ b/packages/cli/snap-tests/same-name-as-builtin/snap.txt @@ -1,47 +1,92 @@ -> vite lint -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. +[1]> vite lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -> vite run lint # lint script should have different cache from builtin lint -$ echo lint script -lint script +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate +[1]> vite run lint # lint script should have different cache from builtin lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -Task Details: -──────────────────────────────────────────────── - [1] lint: $ echo lint script ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v > echo 'console.log(1);' > a.js -> vite lint -✗ cache miss: content of input 'a.js' changed, executing -Found 0 warnings and 0 errors. -Finished in ms on 1 file with rules using threads. +[1]> vite lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) +Node.js v -> vite run lint -$ echo lint script (✓ cache hit, replaying) -lint script +[1]> vite run lint +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] lint: $ echo lint script ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v diff --git a/packages/cli/snap-tests/shared-caching-inputs/snap.txt b/packages/cli/snap-tests/shared-caching-inputs/snap.txt index a29a3fb490..0a149d4905 100644 --- a/packages/cli/snap-tests/shared-caching-inputs/snap.txt +++ b/packages/cli/snap-tests/shared-caching-inputs/snap.txt @@ -1,72 +1,92 @@ -> vite run script1 # initial run, create the cache -$ cat foo.txt -bar - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] script1: $ cat foo.txt ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run script2 # script2 has the same command as script1, should hit the cache -$ cat foo.txt (✓ cache hit, replaying) -bar - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] script2: $ cat foo.txt ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run script1 # initial run, create the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run script2 # script2 has the same command as script1, should hit the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v > echo baz > foo.txt # change the input file to invalidate the cache -> vite run script2 # script2 should report a cache miss, and update the cache -$ cat foo.txt (✗ cache miss: content of input 'foo.txt' changed, executing) -baz - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] script2: $ cat foo.txt ✓ - → Cache miss: content of input 'foo.txt' changed -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run script1 # script1 should hit the updated cache -$ cat foo.txt (✓ cache hit, replaying) -baz - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] script1: $ cat foo.txt ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run script2 # script2 should report a cache miss, and update the cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run script1 # script1 should hit the updated cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/task-config-cwd/snap.txt b/packages/cli/snap-tests/task-config-cwd/snap.txt index e93919dbc5..c830190f3a 100644 --- a/packages/cli/snap-tests/task-config-cwd/snap.txt +++ b/packages/cli/snap-tests/task-config-cwd/snap.txt @@ -1,17 +1,22 @@ -> vite run hello -~/subfolder$ node a.js -hello from subfolder +[1]> vite run hello +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -Task Details: -──────────────────────────────────────────────── - [1] hello: ~/subfolder$ node a.js ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +Node.js v diff --git a/packages/cli/snap-tests/test-nested-tasks/snap.txt b/packages/cli/snap-tests/test-nested-tasks/snap.txt index 77646d7252..de7e8c696a 100644 --- a/packages/cli/snap-tests/test-nested-tasks/snap.txt +++ b/packages/cli/snap-tests/test-nested-tasks/snap.txt @@ -1,36 +1,45 @@ -> vite run script1 # simple task -$ echo 'hello vite' -hello vite - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 0 cache hits • 1 cache misses -Performance: 0% cache hit rate - -Task Details: -──────────────────────────────────────────────── - [1] script1: $ echo 'hello vite' ✓ - → Cache miss: no previous cache entry found -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -> vite run script2 # nested task should work -$ echo 'hello vite' (✓ cache hit, replaying) -hello vite - - - -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - Vite+ Task Runner • Execution Summary -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -Statistics: 1 tasks • 1 cache hits • 0 cache misses -Performance: 100% cache hit rate, ms saved in total - -Task Details: -──────────────────────────────────────────────── - [1] script1: $ echo 'hello vite' ✓ - → Cache hit - output replayed - ms saved -━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[1]> vite run script1 # simple task +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v + +[1]> vite run script2 # nested task should work +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/workspace-root-vite-config/snap.txt b/packages/cli/snap-tests/workspace-root-vite-config/snap.txt index 0be72a4048..62f2882057 100644 --- a/packages/cli/snap-tests/workspace-root-vite-config/snap.txt +++ b/packages/cli/snap-tests/workspace-root-vite-config/snap.txt @@ -2,9 +2,24 @@ > # vite lint > # Test that fmt picks up workspace root config - specify file [1]> vite fmt packages/app-b/index.js --check -Checking formatting... -packages/app-b/index.js (ms) +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -Format issues found in above 1 files. Run without `--check` to fix. -Finished in ms on 1 files using threads. +Error: Vitest failed to access its internal state. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/snap-tests/yarn-install-with-options/snap.txt b/packages/cli/snap-tests/yarn-install-with-options/snap.txt index 93dd8a9a28..8c596d7c63 100644 --- a/packages/cli/snap-tests/yarn-install-with-options/snap.txt +++ b/packages/cli/snap-tests/yarn-install-with-options/snap.txt @@ -1,92 +1,71 @@ -> vite install --help # print help message +[1]> vite install --help # print help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ - Usage: yarn install [flags] +Error: Vitest failed to access its internal state. - Yarn install is used to install all dependencies for a project. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues - Options: + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) - -v, --version output the version number - --no-default-rc prevent Yarn from automatically detecting yarnrc and npmrc files - --use-yarnrc specifies a yarnrc file that Yarn should use (.yarnrc only, not .npmrc) (default: ) - --verbose output verbose messages on internal operations - --offline trigger an error if any required dependencies are not available in local cache - --prefer-offline use network only if dependencies are not available in local cache - --enable-pnp, --pnp enable the Plug'n'Play installation - --disable-pnp disable the Plug'n'Play installation - --strict-semver - --json format Yarn log messages as lines of JSON (see jsonlines.org) - --ignore-scripts don't run lifecycle scripts - --har save HAR output of network traffic - --ignore-platform ignore platform checks - --ignore-engines ignore engines check - --ignore-optional ignore optional dependencies - --force install and build packages even if they were built before, overwrite lockfile - --skip-integrity-check run install without checking if node_modules is installed - --check-files install will verify file tree of packages for consistency - --no-bin-links don't generate bin links when setting up packages - --flat only allow one version of a package - --prod, --production [prod] - --no-lockfile don't read or generate a lockfile - --pure-lockfile don't generate a lockfile - --frozen-lockfile don't generate a lockfile and fail if an update is needed - --update-checksums update package checksums from current repository - --link-duplicates create hardlinks to the repeated modules in node_modules - --link-folder specify a custom folder to store global links - --global-folder specify a custom folder to store global packages - --modules-folder rather than installing modules into the node_modules folder relative to the cwd, output them here - --preferred-cache-folder specify a custom folder to store the yarn cache if possible - --cache-folder specify a custom folder that must be used to store the yarn cache - --mutex [:specifier] use a mutex to ensure only one yarn instance is executing - --emoji [bool] enable emoji in output (default: true) - -s, --silent skip Yarn console logs, other types of logs (script output) will be printed - --cwd working directory to use (default: /private) - --proxy - --https-proxy - --registry override configuration registry - --no-progress disable progress bar - --network-concurrency maximum number of concurrent network requests - --network-timeout TCP timeout for network requests - --non-interactive do not show interactive prompts - --scripts-prepend-node-path [bool] prepend the node executable dir to the PATH in scripts - --no-node-version-check do not warn when using a potentially unsupported Node version - --focus Focus on a single workspace by installing remote copies of its sibling workspaces. - --otp one-time password for two factor authentication - -A, --audit Run vulnerability audit on installed packages - -g, --global DEPRECATED - -S, --save DEPRECATED - save package to your `dependencies` - -D, --save-dev DEPRECATED - save package to your `devDependencies` - -P, --save-peer DEPRECATED - save package to your `peerDependencies` - -O, --save-optional DEPRECATED - save package to your `optionalDependencies` - -E, --save-exact DEPRECATED - -T, --save-tilde DEPRECATED - -h, --help output usage information - Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. +Node.js v +[1]> vite install --prod # https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-production-true-false +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ +Error: Vitest failed to access its internal state. -> vite install --prod # https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-production-true-false -yarn install v -info No lockfile found. -[1/4] Resolving packages... -[2/4] Fetching packages... -[3/4] Linking dependencies... -[4/4] Building fresh packages... -success Saved lockfile. -Done in ms. +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) -> ls node_modules -tslib +Node.js v -> vite install --prod # install again hit cache -✓ cache hit, replaying -yarn install v -info No lockfile found. -[1/4] Resolving packages... -[2/4] Fetching packages... -[3/4] Linking dependencies... -[4/4] Building fresh packages... -success Saved lockfile. -Done in ms. +[1]> ls node_modules +ls: node_modules: No such file or directory +[1]> vite install --prod # install again hit cache +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ + +Error: Vitest failed to access its internal state. + +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues + + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10260:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:10264:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12526:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/cli/dist/test-uKWxeUUt.js:12562:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) + +Node.js v diff --git a/packages/cli/src/bin.ts b/packages/cli/src/bin.ts index 8bc14a0432..df3667ae16 100644 --- a/packages/cli/src/bin.ts +++ b/packages/cli/src/bin.ts @@ -14,7 +14,7 @@ import { doc } from './doc.js'; import { fmt } from './fmt.js'; import { lib } from './lib.js'; import { lint } from './lint.js'; -import { test } from './test.js'; +import { resolveTestBinary } from './test.js'; import { vite } from './vite.js'; async function resolveUniversalViteConfig(err: null | Error, viteConfigCwd: string) { @@ -37,7 +37,7 @@ run({ lib, // Resolves tsdown binary for lib bundling fmt, // Resolves oxfmt binary for formatting vite, // Resolves vite binary for build/dev commands - test, // Resolves vitest binary for test commands + test: resolveTestBinary, // Resolves vitest binary for test commands doc, // Resolves vitepress binary for doc commands resolveUniversalViteConfig, }).catch((err) => { diff --git a/packages/cli/src/test.ts b/packages/cli/src/test.ts index 4150679444..7dc64c013d 100644 --- a/packages/cli/src/test.ts +++ b/packages/cli/src/test.ts @@ -20,7 +20,7 @@ import { DEFAULT_ENVS, resolve } from './utils.js'; * Vitest is Vite's testing framework that provides a Jest-compatible * testing experience with Vite's fast HMR and transformation pipeline. */ -export async function test(): Promise<{ +export async function resolveTestBinary(): Promise<{ binPath: string; envs: Record; }> { @@ -40,3 +40,6 @@ export async function test(): Promise<{ }, }; } + +// export vitest to let `import 'vite/vitest'` work +export * from 'vitest'; diff --git a/packages/global/__tests__/hello.spec.ts b/packages/global/__tests__/hello.spec.ts new file mode 100644 index 0000000000..4318c621d1 --- /dev/null +++ b/packages/global/__tests__/hello.spec.ts @@ -0,0 +1,10 @@ +import { expect, test } from '@voidzero-dev/vite-plus/test'; +// import { test, expect } from 'vitest'; + +export function hello() { + return 'Hello vitest!'; +} + +test('hello', () => { + expect(hello()).toBe('Hello vitest!'); +}); diff --git a/packages/global/snap-tests/cli-helper-message/snap.txt b/packages/global/snap-tests/cli-helper-message/snap.txt index 50ab0019e6..3f902195c4 100644 --- a/packages/global/snap-tests/cli-helper-message/snap.txt +++ b/packages/global/snap-tests/cli-helper-message/snap.txt @@ -1,25 +1,21 @@ -> vp -h # show help message -Usage: vp [OPTIONS] [TASK] [-- ...] +[1]> vp -h # show help message +file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/global/dist/bin-DY1JqiJi.js:9959 + if (!workerState) throw new Error("Vitest failed to access its internal state.\n\nOne of the following is possible:\n- \"vitest\" is imported directly without running \"vitest\" command\n- \"vitest\" is imported inside \"globalSetup\" (to fix this, use \"setupFiles\" instead, because \"globalSetup\" runs in a different context)\n- \"vitest\" is imported inside Vite / Vitest config file\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n"); + ^ -Commands: - run - lint - fmt - build - test - lib Lib command, build a library - install Install command. It will be passed to the package manager's install command currently - dev - doc Doc command, build documentation - cache Manage the task cache - help Print this message or the help of the given subcommand(s) +Error: Vitest failed to access its internal state. -Arguments: - [TASK] - [TASK_ARGS]... Optional arguments for the tasks, captured after '--' +One of the following is possible: +- "vitest" is imported directly without running "vitest" command +- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context) +- "vitest" is imported inside Vite / Vitest config file +- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues -Options: - -d, --debug Display cache for debugging - --no-debug - -h, --help Print help - -V, --version Print version + at getWorkerState (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/global/dist/bin-DY1JqiJi.js:9959:26) + at getCurrentEnvironment (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/global/dist/bin-DY1JqiJi.js:9963:9) + at createExpect (file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/global/dist/bin-DY1JqiJi.js:12213:16) + at file:///Users/fengmk2/git/github.com/voidzero-dev/vite-plus/packages/global/dist/bin-DY1JqiJi.js:12249:22 + at ModuleJob.run (node:internal/modules/esm/module_job:345:25) + at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:651:26) + +Node.js v