From 78741aa20ceb2b526fd57e4db291a94a275187c5 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 11 Dec 2017 16:35:32 +0100 Subject: [PATCH] Build on node 9 on Circle (#4851) * Build on node 9 on Circle * Actually trigger node 9 buid as well * Run full ci on node 8 instead of node 6 * Fix test for node 9 --- .circleci/config.yml | 16 +++++++-- integration_tests/__tests__/failures.test.js | 34 +++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d697d0c6de4..91395bda0848 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,6 +56,17 @@ jobs: - save-cache: *save-cache - run: yarn run test-ci-es5-build-in-browser + test-node-9: + working_directory: ~/jest + docker: + - image: circleci/node:9 + steps: + - checkout + - restore-cache: *restore-cache + - run: yarn --no-progress + - save-cache: *save-cache + - run: yarn run test-ci-partial + test-node-8: working_directory: ~/jest docker: @@ -65,7 +76,7 @@ jobs: - restore-cache: *restore-cache - run: yarn --no-progress - save-cache: *save-cache - - run: yarn run test-ci-partial + - run: yarn run test-ci test-node-6: working_directory: ~/jest @@ -76,7 +87,7 @@ jobs: - restore-cache: *restore-cache - *yarn-install - save-cache: *save-cache - - run: yarn run test-ci + - run: yarn run test-ci-partial test-and-deploy-website: working_directory: ~/jest @@ -98,5 +109,6 @@ workflows: jobs: - test-node-8 - test-node-6 + - test-node-9 - test-browser - test-and-deploy-website diff --git a/integration_tests/__tests__/failures.test.js b/integration_tests/__tests__/failures.test.js index 154ce1f77944..c163b00f297e 100644 --- a/integration_tests/__tests__/failures.test.js +++ b/integration_tests/__tests__/failures.test.js @@ -56,5 +56,37 @@ test('not throwing Error objects', () => { test('works with node assert', () => { const {stderr} = runJest(dir, ['node_assertion_error.test.js']); - expect(normalizeDots(extractSummary(stderr).rest)).toMatchSnapshot(); + let summary = normalizeDots(extractSummary(stderr).rest); + + // Node 9 started to include the error for `doesNotThrow` + // https://github.com/nodejs/node/pull/12167 + if (Number(process.versions.node.split('.')[0]) >= 9) { + expect(summary).toContain(` + assert.doesNotThrow(function) + + Expected the function not to throw an error. + Instead, it threw: + [Error: err!] + + Message: + Got unwanted exception. + err! + err! + + at __tests__/node_assertion_error.test.js:71:10 +`); + + summary = summary.replace( + `Message: + Got unwanted exception. + err! + err! +`, + `Message: + Got unwanted exception. +`, + ); + } + + expect(summary).toMatchSnapshot(); });