Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent subsequent hooks from being called if we are --bailing. #835

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e4a4744
adding before hook to --bail test
aearly May 4, 2013
3f2d701
prevent hooks from being called if we are bailing
aearly May 5, 2013
e45b52f
added complicated bail test
aearly May 5, 2013
d72dd5c
augmented bail test
aearly May 5, 2013
f307c88
fine-grained bailing working
aearly May 5, 2013
48224f9
initial parallel prototype
aearly May 8, 2013
0a05d96
working on parallelism
aearly May 9, 2013
633ae91
made bailing suites still call hooks if they were the source of the e…
aearly May 9, 2013
9782562
made bailing suites still call hooks if they were the source of the e…
aearly May 9, 2013
2f68097
breaking in the runner to see what assumptions it is making
aearly May 12, 2013
ca8e030
running suites in child runner objects
aearly May 12, 2013
c3b6f5b
changing hookUp and hookDown to use runners
aearly May 12, 2013
6f5b12f
working on runner end
aearly May 13, 2013
0e804f2
trying to fix globals
aearly May 13, 2013
3b8a9b5
fixed global detection
aearly May 13, 2013
ad656e4
refactored runSuites to use an eachSeries method
aearly May 13, 2013
521e4fa
added .jshinrc
aearly May 13, 2013
9792d45
refactored runSuite to use eachParallel when suite._parallel == true
aearly May 13, 2013
bc97cc3
working test for parallel suites
aearly May 13, 2013
ca7826e
fixed ordering of events for parallel reporting
aearly May 13, 2013
c97216b
parallel failing working, as well as bailing
aearly May 14, 2013
4f12a5e
merge from feature branch
aearly May 14, 2013
d593e38
made fails more specific
aearly May 15, 2013
30b26a7
fixed pending tests
aearly May 15, 2013
f5c0d95
Merge branch 'feature/parallel-suites'
aearly May 15, 2013
0f4eb7b
adding --parallel CLI option
aearly May 16, 2013
e1e88ba
fixed parallel reporting with child suites
aearly May 16, 2013
fe730b7
cleaned up the api, added .parallel() accessor to Suite
aearly May 16, 2013
00a57ff
merge from feature branch
aearly May 16, 2013
e3735bb
removing extraneous debugger statement
aearly May 17, 2013
a61ab0b
Update Readme with new CI image.
aearly May 17, 2013
94d9e48
fixed exit code always being 0, regardless of failures
aearly May 20, 2013
fc9e6c0
made parallel suites run in domains (and made them a node-only feature)
aearly May 20, 2013
fb6b902
Merge branch 'feature/parallel-suites'
aearly May 20, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"asi": true
"laxcomma": true,
"white": false,
"onevar": false,
"curly": false,
"plusplus": false,
"bitwise": false,
"eqeqeq": false,
"latedef": false,
"proto": true,
"boss": true,
"eqnull": false,
"scripturl": true
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ test-bail:
@./bin/mocha \
--reporter $(REPORTER) \
--bail \
test/acceptance/misc/bail
test/acceptance/misc/bail*

test-async-only:
@./bin/mocha \
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://secure.travis-ci.org/visionmedia/mocha.png)](http://travis-ci.org/visionmedia/mocha)
[![Build Status](https://secure.travis-ci.org/aearly/mocha.png)](http://travis-ci.org/aearly/mocha)

[![Mocha test framework](http://f.cl.ly/items/3l1k0n2A1U3M1I1L210p/Screen%20Shot%202012-02-24%20at%202.21.43%20PM.png)](http://visionmedia.github.com/mocha)

Expand Down
5 changes: 5 additions & 0 deletions bin/_mocha
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ program
.option('-d, --debug', "enable node's debugger, synonym for node --debug")
.option('-b, --bail', "bail after first test failure")
.option('-A, --async-only', "force all tests to take a callback (async)")
.option('-p, --parallel', "run all root-level suites in parallel")
.option('--recursive', 'include sub directories')
.option('--debug-brk', "enable node's debugger breaking on the first line")
.option('--globals <names>', 'allow the given comma-delimited global [names]', list, [])
Expand Down Expand Up @@ -237,6 +238,10 @@ if (program.growl) mocha.growl();

if (program.asyncOnly) mocha.asyncOnly();

// --parallel

if (program.parallel) mocha.parallel();

// --globals

mocha.globals(globals);
Expand Down
13 changes: 13 additions & 0 deletions lib/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,18 @@ Mocha.prototype.asyncOnly = function(){
return this;
};

/**
* Makes root-level suites run in parallel
*
* @return {Mocha}
* @api public
*/

Mocha.prototype.parallel = function(){
this.options.parallel = true;
return this;
};

/**
* Run tests and invoke `fn()` when complete.
*
Expand All @@ -309,6 +321,7 @@ Mocha.prototype.run = function(fn){
var reporter = new this._reporter(runner);
runner.ignoreLeaks = false !== options.ignoreLeaks;
runner.asyncOnly = options.asyncOnly;
runner.suite.parallel(options.parallel);
if (options.grep) runner.grep(options.grep, options.invert);
if (options.globals) runner.globals(options.globals);
if (options.growl) this._growl(runner, reporter);
Expand Down
Loading