-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix timeout/slow string values and duplicate arguments
- Loading branch information
Showing
9 changed files
with
137 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
var runMocha = require('./helpers').runMocha; | ||
|
||
describe('when non-array argument is provided multiple times', function() { | ||
describe('when the same argument name is used', function() { | ||
it('should prefer the last value', function(done) { | ||
runMocha( | ||
'passing-sync', | ||
['--no-async-only', '--async-only', '--no-async-only'], | ||
function(err, result) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(result, 'to have passed'); | ||
done(); | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
describe('when a different argument name is used', function() { | ||
it('should prefer the last value', function(done) { | ||
runMocha('passing-async', ['--timeout', '100', '-t', '10'], function( | ||
err, | ||
result | ||
) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(result, 'to have failed'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
describe('a suite', function() { | ||
it('should succeed in 500ms', function(done) { | ||
setTimeout(done, 500); | ||
}); | ||
|
||
it('should succeed in 1.5s', function(done) { | ||
setTimeout(done, 1500); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
describe('a suite', function() { | ||
it('should succeed in 50ms', function(done) { | ||
setTimeout(done, 50); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
describe('a suite', function() { | ||
it('should succeed', function() { | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
|
||
var helpers = require('../helpers'); | ||
var runMochaJSON = helpers.runMochaJSON; | ||
|
||
describe('--timeout', function() { | ||
it('should allow human-readable string value', function(done) { | ||
runMochaJSON('options/slow-test', ['--timeout', '1s'], function(err, res) { | ||
if (err) { | ||
done(err); | ||
return; | ||
} | ||
expect(res, 'to have failed') | ||
.and('to have passed test count', 1) | ||
.and('to have failed test count', 1); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should allow numeric value', function(done) { | ||
runMochaJSON('options/slow-test', ['--timeout', '1000'], function( | ||
err, | ||
res | ||
) { | ||
if (err) { | ||
done(err); | ||
return; | ||
} | ||
expect(res, 'to have failed') | ||
.and('to have passed test count', 1) | ||
.and('to have failed test count', 1); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should allow numeric value', function(done) { | ||
runMochaJSON('options/slow-test', ['--timeout', '1000'], function( | ||
err, | ||
res | ||
) { | ||
if (err) { | ||
done(err); | ||
return; | ||
} | ||
expect(res, 'to have failed') | ||
.and('to have passed test count', 1) | ||
.and('to have failed test count', 1); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters