Skip to content

Commit 0c104a6

Browse files
committed
separate integration and unit tests, use codecov flags
1 parent 168f923 commit 0c104a6

File tree

54 files changed

+183
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+183
-315
lines changed

.istanbul.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
instrumentation:
2+
excludes:
3+
- "**/*.runtime.js"

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ matrix:
1717
env: NO_WATCH_TESTS=1 JOB_PART=lint
1818
- os: linux
1919
node_js: "8"
20-
env: NO_WATCH_TESTS=1 JOB_PART=test
20+
env: NO_WATCH_TESTS=1 JOB_PART=integration
21+
- os: linux
22+
node_js: "8"
23+
env: NO_WATCH_TESTS=1 JOB_PART=unit
2124
- os: linux
2225
node_js: "6"
23-
env: NO_WATCH_TESTS=1 JOB_PART=test
26+
env: NO_WATCH_TESTS=1 JOB_PART=integration
2427
- os: linux
2528
node_js: "4"
26-
env: NO_WATCH_TESTS=1 JOB_PART=test
29+
env: NO_WATCH_TESTS=1 JOB_PART=integration
2730
- os: osx
2831
node_js: "8"
29-
env: NO_WATCH_TESTS=1 JOB_PART=test
32+
env: NO_WATCH_TESTS=1 JOB_PART=integration
3033
allow_failures:
3134
- os: osx
3235
fast_finish: true
@@ -38,7 +41,7 @@ script: npm run travis:$JOB_PART
3841

3942
after_success:
4043
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
41-
- cat ./coverage/coverage.json | node_modules/codecov.io/bin/codecov.io.js
44+
- bash <(curl -s https://codecov.io/bash) -F $JOB_PART
4245
- rm -rf ./coverage
4346

4447
notifications:

appveyor.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ branches:
99
init:
1010
- git config --global core.autocrlf input
1111

12-
clone_depth: 50
13-
1412
# what combinations to test
1513
environment:
1614
matrix:
1715
- nodejs_version: 8
18-
job_part: test
16+
job_part: unit
17+
- nodejs_version: 8
18+
job_part: integration
1919
- nodejs_version: 6
20-
job_part: test
20+
job_part: integration
2121

2222
install:
2323
- ps: Install-Product node $env:nodejs_version x64
@@ -36,3 +36,4 @@ test_script:
3636
- npm --version
3737
- yarn --version
3838
- cmd: npm run appveyor:%job_part%
39+
- cmd: npm install -g codecov && codecov -F %job_part%

codecov.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,29 @@ coverage:
66
range: "70...100"
77
status:
88
project:
9-
default:
9+
default: off
10+
integration:
11+
flags: integration
1012
target: auto
13+
unit:
14+
flags: unit
15+
target: 0%
1116
patch:
12-
default:
13-
target: auto
17+
default: off
18+
integration:
19+
flags: integration
20+
target: 90%
21+
base: pr
22+
unit:
23+
flags: unit
24+
target: 0%
25+
base: pr
1426
changes:
15-
default:
16-
branches: null
17-
comment: off
27+
default: off
28+
integration:
29+
flags: integration
30+
target: 0%
31+
unit:
32+
flags: unit
33+
target: 0%
34+
comment: off

open-bot.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ rules:
164164
pull_request:
165165
mergeable: true
166166
status:
167-
context: "codecov/patch"
167+
context: "codecov/patch/integration"
168168
ensure:
169169
value: "{{status.state}}"
170170
equals: "success"
@@ -181,7 +181,7 @@ rules:
181181
pull_request:
182182
mergeable: true
183183
status:
184-
context: "codecov/patch"
184+
context: "codecov/patch/integration"
185185
ensure:
186186
value: "{{status.state}}"
187187
equals: "failure"
@@ -193,7 +193,7 @@ rules:
193193
pull_request:
194194
mergeable: true
195195
status:
196-
context: "codecov/patch"
196+
context: "codecov/patch/integration"
197197
ensure:
198198
value: "{{status.state}}"
199199
equals: "failure"

package.json

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"benchmark": "^2.1.1",
3434
"bundle-loader": "~0.5.0",
3535
"codacy-coverage": "^2.0.1",
36-
"codecov.io": "^0.1.2",
3736
"coffee-loader": "~0.7.1",
3837
"coffee-script": "^1.10.0",
3938
"coveralls": "^2.11.2",
@@ -58,6 +57,7 @@
5857
"raw-loader": "~0.5.0",
5958
"react": "^15.2.1",
6059
"react-dom": "^15.2.1",
60+
"rimraf": "^2.6.2",
6161
"script-loader": "~0.7.0",
6262
"should": "^11.1.1",
6363
"simple-git": "^1.65.0",
@@ -89,13 +89,17 @@
8989
"schemas/"
9090
],
9191
"scripts": {
92-
"test": "mocha test/*.test.js --max-old-space-size=4096 --harmony --check-leaks",
93-
"travis:test": "npm run cover:min",
92+
"test": "mocha test/*.test.js test/*.unittest.js --max-old-space-size=4096 --harmony --trace-deprecation --check-leaks",
93+
"test:integration": "mocha test/*.test.js --max-old-space-size=4096 --harmony --trace-deprecation --check-leaks",
94+
"test:unit": "mocha test/*.unittest.js --max-old-space-size=4096 --harmony --trace-deprecation --check-leaks",
95+
"travis:integration": "npm run cover:init && npm run cover:integration && npm run cover:report-min",
96+
"travis:unit": "npm run cover:init && npm run cover:unit && npm run cover:report-min",
9497
"travis:lint": "npm run lint-files && npm run nsp",
9598
"travis:benchmark": "npm run benchmark",
96-
"appveyor:test": "node node_modules\\mocha\\bin\\mocha --max-old-space-size=4096 --harmony test/*.test.js",
99+
"appveyor:integration": "npm run cover:init && npm run cover:integration && npm run cover:report-min",
100+
"appveyor:unit": "npm run cover:init && npm run cover:unit && npm run cover:report-min",
97101
"appveyor:benchmark": "npm run benchmark",
98-
"circleci:test": "node node_modules/mocha/bin/mocha --max-old-space-size=4096 --harmony test/*.test.js",
102+
"circleci:test": "node node_modules/mocha/bin/mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.test.js test/*.unittest.js",
99103
"circleci:lint": "npm run lint-files && npm run nsp",
100104
"build:examples": "cd examples && node buildAll.js",
101105
"pretest": "npm run lint-files",
@@ -104,9 +108,14 @@
104108
"fix": "npm run lint -- --fix",
105109
"beautify-lint": "beautify-lint \"lib/**/*.js\" \"hot/**/*.js\" \"bin/**/*.js\" \"benchmark/*.js\" \"test/*.js\"",
106110
"nsp": "nsp check --output summary",
107-
"benchmark": "mocha --max-old-space-size=4096 --harmony test/*.benchmark.js -R spec",
108-
"cover": "node --max-old-space-size=4096 --harmony ./node_modules/istanbul/lib/cli.js cover -x '**/*.runtime.js' node_modules/mocha/bin/_mocha -- test/*.test.js",
109-
"cover:min": "node --max-old-space-size=4096 --harmony ./node_modules/istanbul/lib/cli.js cover -x '**/*.runtime.js' --report lcovonly node_modules/mocha/bin/_mocha -- test/*.test.js",
111+
"benchmark": "mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.benchmark.js -R spec",
112+
"cover": "npm run cover:init && npm run cover:all && npm run cover:report",
113+
"cover:init": "rimraf coverage",
114+
"cover:all": "node --max-old-space-size=4096 --harmony --trace-deprecation ./node_modules/istanbul/lib/cli.js cover --report none node_modules/mocha/bin/_mocha -- test/*.test.js test/*.unittest.js",
115+
"cover:integration": "node --max-old-space-size=4096 --harmony --trace-deprecation ./node_modules/istanbul/lib/cli.js cover --report none node_modules/mocha/bin/_mocha -- test/*.test.js",
116+
"cover:unit": "node --max-old-space-size=4096 --harmony --trace-deprecation ./node_modules/istanbul/lib/cli.js cover --report none node_modules/mocha/bin/_mocha -- test/*.unittest.js",
117+
"cover:report": "istanbul report",
118+
"cover:report-min": "istanbul report --report lcovonly",
110119
"publish-patch": "npm run lint && npm run beautify-lint && mocha && npm version patch && git push && git push --tags && npm publish"
111120
}
112121
}

test/BinTestCases.test.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
const should = require("should");
55
const path = require("path");
66
const fs = require("fs");
7-
const spawn = require("child_process").spawn;
7+
const child_process = require("child_process");
8+
9+
function spawn(args, options) {
10+
if(process.env.running_under_istanbul) {
11+
args = [require.resolve("istanbul/lib/cli.js"), "cover", "--report", "none", "--print", "none", "--include-pid", "--dir", path.resolve("coverage"), "--", require.resolve("./helpers/exec-in-directory.js"), options.cwd].concat(args);
12+
options = Object.assign({}, options, {
13+
cwd: undefined
14+
});
15+
}
16+
return child_process.spawn(process.execPath, args, options);
17+
}
818

919
function loadOptsFile(optsPath) {
1020
// Options file parser from Mocha
@@ -73,7 +83,7 @@ describe("BinTestCases", function() {
7383
describe(testName, function() {
7484
it("should run successfully", function(done) {
7585
this.timeout(10000);
76-
const child = spawn(process.execPath, [cmd].concat(args), opts);
86+
const child = spawn([cmd].concat(args), opts);
7787

7888
child.on("close", function(code) {
7989
env.code = code;
@@ -108,7 +118,7 @@ describe("BinTestCases", function() {
108118
before(function(done) {
109119
this.timeout(20000);
110120

111-
const child = spawn(process.execPath, [cmd].concat(args), opts);
121+
const child = spawn([cmd].concat(args), opts);
112122

113123
child.on("close", function(code) {
114124
env.code = code;
File renamed without changes.

0 commit comments

Comments
 (0)