diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ad17a8c8..9fd679533 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,4 +30,5 @@ jobs: - run: yarn build env: CI: true + - run: yarn test:build - run: yarn tsd diff --git a/jest.config.js b/jest.config.js index 64079a0d7..dff0697d7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,8 @@ module.exports = { preset: 'ts-jest', - globals: {}, + globals: { + __USE_BUILD__: process.argv.indexOf('-use-build') >= 0 + }, testEnvironment: 'jsdom', transform: { "^.+\\.vue$": "vue-jest", diff --git a/package.json b/package.json index c42dcfaa5..ac17fa1ba 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ }, "scripts": { "test": "yarn jest --runInBand tests", + "test:build": "yarn jest --runInBand tests -use-build", "tsd": "tsd", "build": "yarn rollup -c rollup.config.js", "lint": "prettier -c --parser typescript \"(src|tests)/**/*.ts?(x)\"", diff --git a/setup.js b/setup.js index cbc44511d..fa8fc5156 100644 --- a/setup.js +++ b/setup.js @@ -10,4 +10,8 @@ console.info = (...args) => { } originalConsole(...args) -} \ No newline at end of file +} + +if (__USE_BUILD__) { + jest.mock('./src', () => jest.requireActual('./dist/vue-test-utils.cjs')) +}