Skip to content

Commit 6c6a1f4

Browse files
committed
test: add test framework
1 parent 95729e2 commit 6c6a1f4

File tree

4 files changed

+2768
-72
lines changed

4 files changed

+2768
-72
lines changed

package.json

+22-4
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@
88
},
99
"devDependencies": {
1010
"@types/node": "^8.0.28",
11+
"@types/sinon": "^2.3.4",
12+
"ava": "^0.22.0",
1113
"npm-run-all": "^4.1.1",
1214
"shx": "^0.2.2",
15+
"sinon": "^3.3.0",
16+
"tap-diff": "^0.1.1",
1317
"ts-node": "^3.3.0",
1418
"tslint": "^5.7.0",
1519
"tslint-eslint-rules": "^4.1.1",
1620
"typescript": "^2.5.2"
1721
},
1822
"scripts": {
19-
"build_cjs": "npm-run-all clean_cjs compile_cjs",
20-
"clean_cjs": "shx rm -rf lib",
21-
"compile_cjs": "tsc -p ./src/tsconfig.json",
23+
"build:src": "npm-run-all clean:cjs tsc:src",
24+
"clean:cjs": "shx rm -rf lib",
2225
"lint": "tslint -c tslint.json --project ./src/tsconfig.json --type-check",
23-
"test": "echo \"Error: no test specified\" && exit 1"
26+
"test": "ava | tap-diff",
27+
"tsc:src": "tsc -p ./src/tsconfig.json",
28+
"watch": "npm-run-all -p watch:src watch:ava",
29+
"watch:ava": "sleep 1 && ava -w --color | tap-diff",
30+
"watch:src": " npm run tsc:src -- -w --diagnostics --pretty"
2431
},
2532
"keywords": [
2633
"Relation",
@@ -36,5 +43,16 @@
3643
"bugs": {
3744
"email": "[email protected]",
3845
"url": "https://github.com/ReactiveDB/Relational-Database/issues"
46+
},
47+
"ava": {
48+
"files": [
49+
"test/**/*.js"
50+
],
51+
"source": [
52+
"lib/**/*.js"
53+
],
54+
"failWithoutAssertions": true,
55+
"tap": true,
56+
"color": true
3957
}
4058
}

src/tsconfig.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"target": "es5",
55
"module": "commonjs",
66
"outDir": "../lib",
7-
"declaration": true
8-
}
7+
"declaration": true,
8+
"lib": [
9+
"es2015"
10+
]
11+
},
12+
"include": [
13+
"./**/*.ts"
14+
]
915
}

test/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const test = require('ava')
2+
const { version } = require('../lib')
3+
4+
test('version should equal to package.json', t => {
5+
t.deepEqual(version, require('../package.json').version)
6+
})

0 commit comments

Comments
 (0)