Skip to content

Commit

Permalink
[Tests] Update tests to run on io.js with the latest version of jest
Browse files Browse the repository at this point in the history
Updates the tests in small ways so they run on io.js with two updates:

 - The animation tests use `toBeCloseTo` since there are small math discrepancies between versions of V8
 - The Cache test which relies on Promises uses `runAllImmediates` for modern versions of Node because bluebird uses `setImmediate` instead of `process.nextTick` for Node >0.10.

Test Plan: Run `npm test` with the latest version of jest.
  • Loading branch information
ide committed Jun 12, 2015
1 parent 5ee24bf commit 585f8db
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ install:
- cp $(brew --prefix nvm)/nvm-exec .nvm/
- export NVM_DIR=.nvm
- source $(brew --prefix nvm)/nvm.sh
- nvm install v0.10
- nvm install iojs-v2.2
- npm config set spin=false
- npm install

script:
- |
nvm use v0.10
nvm use iojs-v2.2
if [ "$TEST_TYPE" = objc ]
then
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"yargs": "1.3.2"
},
"devDependencies": {
"jest-cli": "0.4.5",
"jest-cli": "ide/jest#iojs",
"babel-eslint": "3.1.5",
"eslint": "0.21.2",
"eslint-plugin-react": "2.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ describe('JSTransformer Cache', function() {
return Promise.resolve('baz value');
});

jest.runAllTicks();
jest.runAllTicks(); // Node 0.10 (bluebird uses nextTick)
jest.runAllImmediates(); // Node 0.12+
expect(fs.writeFile).toBeCalled();
});
});
Expand Down

0 comments on commit 585f8db

Please sign in to comment.