Skip to content

Commit 62f7044

Browse files
committed
chore: update test tool.
1 parent ae8ce8b commit 62f7044

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- master
6+
67
jobs:
78
build-deploy:
89
runs-on: ubuntu-18.04
@@ -14,7 +15,7 @@ jobs:
1415

1516
- run: npm install
1617
- run: npm run test
17-
- run: npm run build
18+
- run: npm run coverage
1819

1920
- name: Generate Contributors Images
2021
uses: jaywcjlove/github-action-contributors@main

package.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@
1717
"scripts": {
1818
"start": "idoc --watch",
1919
"build": "idoc",
20-
"test": "tap test/*.js",
21-
"coverage": "tap test/*.js --coverage-report=lcov"
20+
"test": "jest",
21+
"coverage": "jest --coverage"
2222
},
2323
"author": "kenny wong <wowohoo@qq.com>",
2424
"license": "MIT",
2525
"devDependencies": {
2626
"idoc": "^1.21.4",
27-
"tap": "^16.3.0"
27+
"jest": "^28.1.2"
28+
},
29+
"jest": {
30+
"coverageReporters": [
31+
"lcov",
32+
"json-summary"
33+
]
2834
}
2935
}

test/test.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
const test = require('tap').test;
21
const whereis = require('../');
32

4-
test("when which found our program", async (t) => {
3+
test('when which found our program', async () => {
54
let where = await whereis('ls');
6-
t.equal(where, '/bin/ls', 'ls was found');
5+
expect(where).toBe('/bin/ls')
76
});
87

9-
test("undefined", async (t) => {
8+
test('undefined', async () => {
109
try {
1110
await whereis();
1211
} catch (error) {
13-
t.equal(error, 'No command name is passed!', 'undefined was found');
14-
t.equal(error.message, undefined, 'undefined was found');
12+
expect(error).toBe('No command name is passed!')
13+
expect(error.message).toBe(undefined)
1514
}
1615
});
1716

18-
test("Empty", async (t) => {
17+
test('Empty', async () => {
1918
try {
2019
await whereis('');
2120
} catch (error) {
22-
t.equal(error, 'No command name is passed!', 'Empty was found');
23-
t.equal(error.message, undefined, 'Empty was found');
21+
expect(error).toBe('No command name is passed!')
22+
expect(error.message).toBe(undefined)
2423
}
2524
});

0 commit comments

Comments
 (0)