feat: add jest basic config

This commit is contained in:
Herrington Darkholme 2020-07-24 16:44:56 +08:00
parent 0c483880ad
commit b42f434c1e
5 changed files with 1951 additions and 41 deletions

16
jest.config.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
preset: 'ts-jest',
globals: {
// work around: https://github.com/kulshekhar/ts-jest/issues/748#issuecomment-423528659
'ts-jest': {
diagnostics: {
ignoreCodes: [151001],
},
},
},
testEnvironment: 'jsdom',
transform: {
"^.+\\.vue$": "vue-jest"
},
moduleFileExtensions: ['vue', 'json', 'ts', 'tsx', 'js', 'json']
}

View File

@ -6,6 +6,7 @@
"dev": "vite",
"build": "vite build",
"cz": "npx git-cz",
"test": "lerna run test --stream",
"gc": "sh ./scripts/gc.sh"
},
"dependencies": {
@ -13,9 +14,11 @@
"vue-router": "^4.0.0-beta.2"
},
"devDependencies": {
"@types/jest": "^26.0.7",
"@vue/compiler-sfc": "^3.0.0-rc.1",
"cz-conventional-changelog": "^3.2.0",
"lerna": "^3.22.1",
"typescript": "^3.9.7",
"vite": "^1.0.0-rc.1"
},
"config": {

View File

@ -0,0 +1,6 @@
describe('Button.vue', () => {
test('hello world', () => {
const bestGirl = 'Rem'
expect(bestGirl).not.toMatch('Emilia')
})
})

View File

@ -3,7 +3,16 @@
"version": "0.0.0",
"main": "dist/index.js",
"license": "MIT",
"scripts": {
"test": "jest --config ../../jest.config.js --rootDir ."
},
"dependencies": {
"vue": "^3.0.0-rc.1"
},
"devDependencies": {
"@vue/test-utils": "^2.0.0-beta.0",
"jest": "^26.1.0",
"ts-jest": "^26.1.3",
"vue-jest": "5.0.0-alpha.1"
}
}

1958
yarn.lock

File diff suppressed because it is too large Load Diff