diff --git a/package.json b/package.json index 03b663764..8b218f30c 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,8 @@ }, "scripts": { "test": "yarn vitest", - "test:build": "yarn vitest -use-build", + "test:watch": "yarn vitest --watch", + "test:build": "yarn vitest --mode test-build", "tsd": "tsc -p test-dts/tsconfig.tsd.json", "build": "yarn rollup -c rollup.config.js", "lint": "eslint --ext .ts src/ tests/", diff --git a/setup.js b/setup.js index 2a13e3a72..e5f4b859f 100644 --- a/setup.js +++ b/setup.js @@ -14,6 +14,10 @@ console.info = (...args) => { originalConsole(...args) } -if (__USE_BUILD__) { - vi.mock('./src', () => vi.importActual('./dist/vue-test-utils.cjs')) -} +vi.mock('./src', () => { + if (!__DEV__) { + return vi.importActual('./dist/vue-test-utils.cjs') + } else { + return vi.importActual('./src') + } +}) diff --git a/vitest.config.ts b/vitest.config.ts index 4fc50c88e..47968ed71 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,7 +6,7 @@ import jsx from '@vitejs/plugin-vue-jsx' export default defineConfig({ plugins: [vue(), jsx()], define: { - __USE_BUILD__: process.argv.indexOf('-use-build') >= 0, + __DEV__: process.env.NODE_ENV !== 'test-build', __BROWSER__: true, __USE_PREFIX_IDENTIFIERS__: true },