Skip to content

Commit b3cb42c

Browse files
committed
test: use jest for testing
1 parent e12968b commit b3cb42c

File tree

3 files changed

+3290
-42
lines changed

3 files changed

+3290
-42
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"index.js",
88
"recommended.js"
99
],
10+
"scripts": {
11+
"test": "jest"
12+
},
1013
"publishConfig": {
1114
"access": "public"
1215
},
@@ -29,6 +32,8 @@
2932
"@typescript-eslint/parser": "^2.7.0",
3033
"eslint": "^6.6.0",
3134
"eslint-plugin-vue": "^6.0.1",
35+
"execa": "^3.3.0",
36+
"jest": "^24.9.0",
3237
"typescript": "^3.7.2",
3338
"vue": "^2.6.10",
3439
"vue-property-decorator": "^8.3.0"

test/index.spec.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const path = require('path')
2+
const execa = require('execa')
3+
4+
const eslintPath = path.resolve(__dirname, '../node_modules/.bin/eslint')
5+
6+
async function lintProject (name) {
7+
const projectPath = path.resolve(__dirname, name)
8+
const filesToLint = path.resolve(projectPath, '**')
9+
10+
return await execa(eslintPath, [`${filesToLint}`], {
11+
cwd: projectPath
12+
})
13+
}
14+
15+
test('a default project should pass lint', async () => {
16+
await lintProject('default')
17+
})
18+
19+
test('should lint .ts file', async () => {
20+
// TODO:
21+
})
22+
23+
test('should lint vue sfc', async () => {
24+
// TODO:
25+
})
26+
27+
test('should lint .tsx', async () => {
28+
// TODO:
29+
})

0 commit comments

Comments
 (0)