Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 89f7095

Browse files
authored
set up test framework for client, server and the travis (#59)
* set up test framework for client, server and the travis Signed-off-by: xufengli <[email protected]> * Change the code coverage report to be 0 for at moment. Update the client json script Add Apach 2 copyright to the test files Add one invalid test file Add tslint to check all *.ts format. update minor changes. remove the failued test case. Signed-off-by: xufengli <[email protected]>
1 parent d46c19a commit 89f7095

File tree

19 files changed

+991
-414
lines changed

19 files changed

+991
-414
lines changed

.travis.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1+
sudo: false
2+
os:
3+
- osx
4+
- linux
5+
16
language: node_js
27
node_js:
3-
- '6'
8+
- '8'
49
dist: trusty
10+
11+
before_install:
12+
- if [ $TRAVIS_OS_NAME == "linux" ]; then
13+
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
14+
sh -e /etc/init.d/xvfb start;
15+
sleep 3;
16+
fi
517
install: |
6-
./.travis/install.sh
18+
./.travis/install.sh
719
script: |
820
./.travis/script.sh
921
deploy:

.travis/script.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ set -o pipefail
66

77
cd ./server
88
npm run compile:server
9+
npm test --silent
910

1011
cd ../client
1112

1213
npm run package:vsix
1314
npm install -g vsce
1415

15-
npm test 2>&1 | tee
16+
npm test --silent

client/.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
{
33
"version": "0.2.0",
44
"configurations": [
5+
{
6+
"type": "node",
7+
"request": "launch",
8+
"name": "Mocha Tests",
9+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
10+
"args": [
11+
"-u",
12+
"tdd",
13+
"--no-timeouts",
14+
"--compilers",
15+
"ts:ts-node/register",
16+
"--colors",
17+
"${workspaceFolder}/test/**/*.test.ts"
18+
],
19+
"cwd": "${workspaceFolder}",
20+
"protocol": "inspector",
21+
"internalConsoleOptions": "openOnSessionStart"
22+
},
523
{
624
"name": "Launch Client Extension",
725
"type": "extensionHost",

client/.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ test/**
55
src/**
66
**/*.map
77
.gitignore
8+
.eslintignore
89
tsconfig.json
910
vsc-extension-quickstart.md

client/package.json

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"publisher": "HyperledgerComposer",
1616
"icon": "icon.png",
1717
"engines": {
18-
"vscode": "^1.15.1"
18+
"vscode": "^1.19.2"
1919
},
2020
"repository": {
2121
"type": "git",
@@ -248,21 +248,56 @@
248248
},
249249
"scripts": {
250250
"compile:client": "tsc -p ./",
251-
"watch:client": "tsc -w -p ./",
251+
"watch:client": "tsc -w -p ./",
252252
"update-vscode": "node ./node_modules/vscode/bin/install",
253253
"postinstall": "node ./node_modules/vscode/bin/install",
254254
"package:vsix": "node ./node_modules/vsce/out/vsce package",
255255
"prepublish": "tsc -p ./",
256-
"test": ""
256+
"pretest": "npm run lint",
257+
"test": "nyc node ./node_modules/vscode/bin/test --compilers ts:ts-node/register ./test/*.test.ts",
258+
"tslint": "tslint",
259+
"lint": "npm run tslint 'src/**/*.ts' 'test/extension.test.ts'"
257260
},
258261
"devDependencies": {
262+
"@types/chai": "^3.5.2",
259263
"@types/mocha": "^2.2.33",
260264
"@types/node": "^6.0.52",
261-
"typescript": "^2.1.5",
262-
"vscode": "^1.1.5",
263-
"vsce": "^1.30.0"
265+
"angular-tslint-rules": "^1.2.1",
266+
"chai": "^4.1.2",
267+
"mocha": "^5.0.0",
268+
"nyc": "^11.4.1",
269+
"ts-node": "^4.1.0",
270+
"tslint": "^5.9.1",
271+
"tslint-loader": "^3.3.0",
272+
"typescript": "^2.6.2",
273+
"vsce": "^1.30.0",
274+
"vscode": "^1.1.5"
264275
},
265276
"dependencies": {
266-
"vscode-languageclient": "^3.3.0"
277+
"vscode-languageclient": "^3.5.0"
278+
},
279+
"nyc": {
280+
"include": [
281+
"src/**/*.ts",
282+
"test/data"
283+
],
284+
"extension": [
285+
".ts"
286+
],
287+
"exclude": [
288+
"out/**",
289+
"server/**",
290+
"coverage/**"
291+
],
292+
"reporter": [
293+
"text-summary",
294+
"html"
295+
],
296+
"all": true,
297+
"check-coverage": true,
298+
"statements": 0,
299+
"branches": 0,
300+
"functions": 0,
301+
"lines": 0
267302
}
268-
}
303+
}

0 commit comments

Comments
 (0)