Skip to content

Commit

Permalink
Use Node 8 on CI (jestjs#3701)
Browse files Browse the repository at this point in the history
* Snapshot only failure messages without summary

* Use yarn in babel-plugin-jest-hoist-test

* Run tests on Node 8 instead of 7 on CI

* Adjust normalizeDots
  • Loading branch information
thymikee authored and cpojer committed May 31, 2017
1 parent bf05b56 commit 8b5fe46
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js

node_js:
- "7"
- "8"

sudo: false

Expand Down
3 changes: 1 addition & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
environment:
matrix:
#- nodejs_version: "4"
- nodejs_version: "6"
- nodejs_version: "8"

install:
- ps: Install-Product node $env:nodejs_version x64
Expand Down
4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ machine:
YARN_VERSION: 0.20.3
PATH: "${PATH}:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
node:
version: 7
version: 8
dependencies:
pre:
- |
Expand All @@ -28,7 +28,7 @@ test:
- yarn run test-ci
- nvm alias default 4
- yarn run test-ci-partial
- nvm alias default 7
- nvm alias default 8
- yarn run test-ci-partial
- DANGER_GITHUB_API_TOKEN="ab0c4d396c935d3abce""fc213176da6bb7b2996ff" yarn run danger
- cd website && yarn run test
Expand Down
64 changes: 12 additions & 52 deletions integration_tests/__tests__/__snapshots__/failures-test.js.snap
Original file line number Diff line number Diff line change
@@ -1,60 +1,35 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`not throwing Error objects 1`] = `
Object {
"rest": " FAIL __tests__/throw-number-test.js
" FAIL __tests__/throw-number-test.js
● Test suite failed to run
Expected an Error, but \\"1\\" was thrown
",
"summary": "Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching \\"throw-number-test.js\\".
",
}
"
`;

exports[`not throwing Error objects 2`] = `
Object {
"rest": " FAIL __tests__/throw-string-test.js
" FAIL __tests__/throw-string-test.js
● Test suite failed to run
Error
banana
",
"summary": "Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching \\"throw-string-test.js\\".
",
}
"
`;

exports[`not throwing Error objects 3`] = `
Object {
"rest": " FAIL __tests__/throw-object-test.js
" FAIL __tests__/throw-object-test.js
● Test suite failed to run
Error: No message was provided
",
"summary": "Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching \\"throw-object-test.js\\".
",
}
"
`;

exports[`not throwing Error objects 4`] = `
Object {
"rest": " FAIL __tests__/assertion-count-test.js
" FAIL __tests__/assertion-count-test.js
● .assertions() › throws
expect(received).toBeTruthy()
Expand Down Expand Up @@ -104,19 +79,11 @@ Object {
.hasAssertions()
✕ throws when there are not assertions
",
"summary": "Test Suites: 1 failed, 1 total
Tests: 4 failed, 4 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching \\"assertion-count-test.js\\".
",
}
"
`;

exports[`works with node assert 1`] = `
Object {
"rest": " FAIL __tests__/node-assertion-error-test.js
" FAIL __tests__/node-assertion-error-test.js
● assert
assert.equal(received, expected) or assert(received)
Expand Down Expand Up @@ -340,7 +307,7 @@ Object {
[Error: err!]
Message:
Got unwanted exception..
Got unwanted exception.
at __tests__/node-assertion-error-test.js:72:10
Expand All @@ -352,7 +319,7 @@ Object {
But it didn't throw anything.
Message:
Missing expected exception..
Missing expected exception.
at __tests__/node-assertion-error-test.js:78:10
Expand All @@ -373,12 +340,5 @@ Object {
✕ assert.doesNotThrow
✕ assert.throws
",
"summary": "Test Suites: 1 failed, 1 total
Tests: 16 failed, 16 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching \\"node-assertion-error-test.js\\".
",
}
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ skipOnWindows.suite();

if (process.platform !== 'win32') {
beforeEach(() => {
run('npm i', DIR);
run('yarn', DIR);
linkJestPackage('babel-plugin-jest-hoist', DIR);
linkJestPackage('babel-jest', DIR);
});
Expand Down
12 changes: 7 additions & 5 deletions integration_tests/__tests__/failures-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ const runJest = require('../runJest');

const dir = path.resolve(__dirname, '../failures');

const normalizeDots = text => text.replace(/\.{1,}$/gm, '.');

skipOnWindows.suite();

test('not throwing Error objects', () => {
let stderr;
stderr = runJest(dir, ['throw-number-test.js']).stderr;
expect(extractSummary(stderr)).toMatchSnapshot();
expect(extractSummary(stderr).rest).toMatchSnapshot();
stderr = runJest(dir, ['throw-string-test.js']).stderr;
expect(extractSummary(stderr)).toMatchSnapshot();
expect(extractSummary(stderr).rest).toMatchSnapshot();
stderr = runJest(dir, ['throw-object-test.js']).stderr;
expect(extractSummary(stderr)).toMatchSnapshot();
expect(extractSummary(stderr).rest).toMatchSnapshot();
stderr = runJest(dir, ['assertion-count-test.js']).stderr;
expect(extractSummary(stderr)).toMatchSnapshot();
expect(extractSummary(stderr).rest).toMatchSnapshot();
});

test('works with node assert', () => {
const {stderr} = runJest(dir, ['node-assertion-error-test.js']);
expect(extractSummary(stderr)).toMatchSnapshot();
expect(normalizeDots(extractSummary(stderr).rest)).toMatchSnapshot();
});

0 comments on commit 8b5fe46

Please sign in to comment.