-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
ensure --debug becomes --inspect; closes #3697 #3698
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,9 +59,9 @@ exports.mixinMochaAssertions = function(expect) { | |
} | ||
) | ||
.addAssertion( | ||
'<RawRunResult|JSONRunResult> [not] to have completed with [exit] code <number>', | ||
'<RawResult|RawRunResult|JSONRunResult> [not] to have [completed with] [exit] code <number>', | ||
function(expect, result, code) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why those additional "[ ... ]"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This rule was duplicated above, so I consolidated it. So this allows you to say I find it's nicer to provide several different ways of expressing the same thing. |
||
expect(result.code, '[not] to be', code); | ||
expect(result, '[not] to have property', 'code', code); | ||
} | ||
) | ||
.addAssertion( | ||
|
@@ -290,17 +290,10 @@ exports.mixinMochaAssertions = function(expect) { | |
}); | ||
} | ||
) | ||
.addAssertion('<RawRunResult> [not] to contain output <any>', function( | ||
expect, | ||
result, | ||
output | ||
) { | ||
expect(result.output, '[not] to satisfy', output); | ||
}) | ||
.addAssertion( | ||
'<RawRunResult|JSONRunResult> to have [exit] code <number>', | ||
function(expect, result, code) { | ||
expect(result.code, 'to be', code); | ||
'<RawResult|RawRunResult> [not] to contain [output] <any>', | ||
function(expect, result, output) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be "[output]" or "output"? I don't know. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there are more examples: "test count" or "[test] count"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
expect(result.output, '[not] to satisfy', output); | ||
} | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// this generic fixture does nothing special and will be used if no fixture is supplied | ||
|
||
'use strict'; | ||
|
||
describe('a suite', function() { | ||
it('should succeed', function(done) { | ||
done(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
var helpers = require('../helpers'); | ||
var invokeMocha = helpers.invokeMocha; | ||
var DEFAULT_FIXTURE = helpers.DEFAULT_FIXTURE; | ||
|
||
describe('--debug', function() { | ||
describe('Node.js v8+', function() { | ||
before(function() { | ||
if (process.version.substring(0, 2) === 'v6') { | ||
this.skip(); | ||
} | ||
}); | ||
|
||
it('should invoke --inspect', function(done) { | ||
invokeMocha( | ||
['--debug', '--file', DEFAULT_FIXTURE], | ||
function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(res, 'to have passed').and( | ||
'to contain output', | ||
/Debugger listening/i | ||
); | ||
done(); | ||
}, | ||
{stdio: 'pipe'} | ||
); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand where the distinction is made between Node >=v8 and Node v6.
We will deprecate
--debug
anyway once support of Node v6 is dropped, right? We could prepare this deprecation and pass the responsibility of choosing the correct Node flag to the user.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree, we should provide a deprecation message when debug is used outside of Node.js v6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I changed my mind. a warning should be printed, but it's a nice convenience for users until Node.js v6 drops out of active maintenance. at that point, we can remove it, because we'll drop v6 support as well.