From 585f8db04207812756925c33c3296893940dc6e3 Mon Sep 17 00:00:00 2001 From: James Ide Date: Fri, 22 May 2015 23:58:02 -0700 Subject: [PATCH] [Tests] Update tests to run on io.js with the latest version of jest 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. --- .travis.yml | 4 ++-- package.json | 2 +- .../react-packager/src/JSTransformer/__tests__/Cache-test.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7da54bdf4076ac..629d74af1149a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/package.json b/package.json index 19226bc0851bc6..b786abbeb545bc 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/packager/react-packager/src/JSTransformer/__tests__/Cache-test.js b/packager/react-packager/src/JSTransformer/__tests__/Cache-test.js index f91490ba0f3927..db9e362161725c 100644 --- a/packager/react-packager/src/JSTransformer/__tests__/Cache-test.js +++ b/packager/react-packager/src/JSTransformer/__tests__/Cache-test.js @@ -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(); }); });