forked from mochajs/mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix required test files caching, closes mochajs#736
- Loading branch information
Dmitry Sorin
committed
Aug 13, 2016
1 parent
2a51080
commit fec9198
Showing
5 changed files
with
62 additions
and
1 deletion.
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,4 @@ | ||
module.exports = function() { | ||
global[__filename] = global[__filename] || 0; | ||
global[__filename]++; | ||
}; |
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,20 @@ | ||
var Mocha = require('../../../') | ||
, assert = require('assert') | ||
, path = require('path'); | ||
|
||
var testFile = path.resolve(__dirname, 'spec.js'); | ||
var includeFile = path.resolve(__dirname, 'include.js'); | ||
|
||
var set1 = new Mocha(); | ||
set1.addFile(testFile); | ||
|
||
var set2 = new Mocha(); | ||
set2.addFile(testFile); | ||
|
||
set1.run(function () { | ||
assert.strictEqual(global[includeFile], 1, 'JSAPI test #1 didn\'t run'); | ||
|
||
set2.run(function () { | ||
assert.strictEqual(global[includeFile], 2, 'JSAPI test #2 didn\'t run'); | ||
}); | ||
}); |
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,8 @@ | ||
var path = require('path'); | ||
var increment = require('./include'); | ||
|
||
describe('Mocha', function () { | ||
it('should increment global counter', function () { | ||
increment(); | ||
}); | ||
}); |