Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
okxiaoliang4 committed Jul 2, 2022
1 parent 57721ae commit d6e9602
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
10 changes: 7 additions & 3 deletions setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
})
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down

0 comments on commit d6e9602

Please sign in to comment.