Skip to content

Commit

Permalink
Merge 5d1c043 into ae56f3f
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Mar 17, 2016
2 parents ae56f3f + 5d1c043 commit 1a804eb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/site-build/
/test/tests.html
/test/JasmineRunner.html
/.nyc_output/
12 changes: 1 addition & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,7 @@ test: lint

.PHONY: coverage
coverage:
@NODE_ENV=development ./node_modules/.bin/istanbul cover \
-x unexpected.js \
-x **/vendor/** \
-x **/site/** \
-x **/site-build/** \
-x **/documentation/** \
-x lib/testFrameworkPatch.js \
-x bootstrap-unexpected-markdown.js \
--report text \
--report lcov \
--include-all-sources ./node_modules/mocha/bin/_mocha -- --reporter dot $(TEST_SOURCES)
@./node_modules/.bin/nyc --reporter=lcov --reporter=text --all -- mocha --compilers md:unexpected-markdown test/*.js $(TEST_SOURCES)
@echo google-chrome coverage/lcov-report/index.html

.PHONY: test-browser
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
"chewbacca": "1.8.1",
"coveralls": "2.11.1",
"es5-shim": "4.0.5",
"istanbul": "0.3.16",
"jasmine": "2.2.1",
"jscs": "2.1.1",
"jshint": "2.9.1",
"minimist": "1.1.1",
"mocha": "2.4.5",
"mocha-phantomjs-papandreou": "4.0.2-patch1",
"mocha-slow-reporter": "*",
"nyc": "6.1.1",
"phantomjs-prebuilt": "2.1.3",
"rsvp": "3.0.18",
"serve": "*",
Expand All @@ -53,5 +53,10 @@
"dependencies": {},
"main": "unexpected.js",
"jspmPackage": true
},
"nyc": {
"include": [
"lib/**"
]
}
}
21 changes: 21 additions & 0 deletions test/unexpected.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,4 +795,25 @@ describe('unexpected', function () {
}, 'to throw', '"diff" style cannot be defined, it clashes with a built-in attribute');
});
});

if (typeof process === 'object') {
describe('executed through mocha', function () {
var pathModule = require('path');
var childProcess = require('child_process');
var basePath = pathModule.resolve(__dirname, '..');

it('should report that a promise was created, but not returned by the it block', function () {
return expect.promise(function (run) {
childProcess.execFile(pathModule.resolve(basePath, 'node_modules', '.bin', 'mocha'), [
pathModule.resolve(basePath, 'testdata', 'forgotToReturnPendingPromiseFromItBlock.js')
], {
cwd: basePath
}, run(function (err, stdout, stderr) {
expect(err.code, 'to equal', 1);
expect(stdout, 'to contain', 'Error: should call the callback: You have created a promise that was not returned from the it block');
}));
});
});
});
}
});
5 changes: 5 additions & 0 deletions testdata/forgotToReturnPendingPromiseFromItBlock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var expect = require('../');

it('should call the callback', function () {
expect(setImmediate, 'to call the callback');
});

0 comments on commit 1a804eb

Please sign in to comment.