forked from karma-runner/karma
-
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.
test(tasks): add extra mocha-globals for tasks test
Because we can't reuse the same file for both unit and tasks tests. When all tests are run by grunt, it's run inside a single VM and Node.js caches the module and evaluate only once.
- Loading branch information
Showing
4 changed files
with
40 additions
and
38 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 was deleted.
Oops, something went wrong.
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,12 @@ | ||
sinon = require 'sinon' | ||
chai = require 'chai' | ||
|
||
global.expect = chai.expect | ||
global.sinon = null | ||
|
||
|
||
beforeEach -> | ||
global.sinon = sinon.sandbox.create() | ||
|
||
afterEach -> | ||
global.sinon.restore() |
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,26 @@ | ||
sinon = require 'sinon' | ||
chai = require 'chai' | ||
logger = require '../../lib/logger' | ||
|
||
# publish globals that all specs can use | ||
global.timer = require 'timer-shim' | ||
global.expect = chai.expect | ||
global.should = chai.should() | ||
global.sinon = sinon | ||
|
||
# chai plugins | ||
chai.use(require 'chai-as-promised') | ||
chai.use(require 'sinon-chai') | ||
|
||
# TODO(vojta): remove this global stub | ||
sinon.stub(timer, 'setTimeout').callsArg 0 | ||
|
||
beforeEach -> | ||
global.sinon = sinon.sandbox.create() | ||
|
||
# set logger to log INFO, but do not append to console | ||
# so that we can assert logs by logger.on('info', ...) | ||
logger.setup 'INFO', false, [] | ||
|
||
afterEach -> | ||
global.sinon.restore() |