Skip to content

Commit

Permalink
tests: Change test setup so it will output to both console and xml
Browse files Browse the repository at this point in the history
Also added some additional configuration for using chaip-as-promised
  • Loading branch information
corycaywood committed Apr 23, 2020
1 parent bde6830 commit 55106dd
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 1,183 deletions.
7 changes: 7 additions & 0 deletions js-miniapp-sdk/.mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = {
require: ['ts-node/register', './test/setup'],
reporter: 'mocha-multi',
reporterOptions: 'spec=-,xunit=test-results/mocha/results.xml'
};
8 changes: 6 additions & 2 deletions js-miniapp-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@types/chai": "^4.2.11",
"@types/chai-as-promised": "^7.1.2",
"@types/mocha": "^7.0.2",
"@types/node": "^10.0.3",
"@types/sinon": "^9.0.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"gts": "^1.1.2",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.23.3",
"mocha-multi": "^1.1.3",
"nyc": "^15.0.0",
"sinon": "^9.0.1",
"sinon-chai": "^3.5.0",
"source-map-support": "^0.5.16",
"ts-node": "^8.8.1",
"tslint": "^6.1.0",
Expand All @@ -30,7 +34,7 @@
"prebuild": "npm run clean && npm run lint",
"buildSdk": "gts check && tsc -p . && npm run test",
"fix": "gts fix",
"test": "mocha -r ts-node/register tests/**/*.spec.ts --reporter mocha-junit-reporter --reporter-options mochaFile=./test-results/mocha/results.xml",
"test": "mocha test/**/*.spec.ts",
"coverage": "nyc npm test",
"version": "npx -c 'echo $npm_package_version'",
"docs": "scripts/docs.sh"
Expand Down
6 changes: 6 additions & 0 deletions js-miniapp-sdk/test/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

const chai = require('chai');

chai.use(require('chai-as-promised'))
chai.use(require('sinon-chai'));
7 changes: 0 additions & 7 deletions js-miniapp-sdk/tests/test.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion js-miniapp-sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
},
"include": [
"src/**/*.ts",
"tests/**/*.ts"
"test/**/*.ts"
]
}
Loading

0 comments on commit 55106dd

Please sign in to comment.