From 6c9756d5e678fc841a806d14f87d3665445a5e35 Mon Sep 17 00:00:00 2001
From: Simen Bekkhus <sbekkhus91@gmail.com>
Date: Tue, 7 Nov 2017 07:26:02 +0100
Subject: [PATCH 1/4] Build on node 9 on Circle

---
 .circleci/config.yml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 7d697d0c6de4..7ca2a14e01bc 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:

From 743749bea1ae839ef706a5a8bb2af901c03266eb Mon Sep 17 00:00:00 2001
From: Simen Bekkhus <sbekkhus91@gmail.com>
Date: Tue, 7 Nov 2017 07:28:05 +0100
Subject: [PATCH 2/4] Actually trigger node 9 buid as well

---
 .circleci/config.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 7ca2a14e01bc..632f77768ea5 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -109,5 +109,6 @@ workflows:
     jobs:
       - test-node-8
       - test-node-6
+      - test-node-9
       - test-browser
       - test-and-deploy-website

From 78bf1b925149fdc7be1a1f0d8ad2134bea9580ea Mon Sep 17 00:00:00 2001
From: Simen Bekkhus <sbekkhus91@gmail.com>
Date: Wed, 8 Nov 2017 08:11:08 +0100
Subject: [PATCH 3/4] Run full ci on node 8 instead of node 6

---
 .circleci/config.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 632f77768ea5..91395bda0848 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -76,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
@@ -87,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

From 9c6f33b8dd064a37ad71769a7e127d9e18286f59 Mon Sep 17 00:00:00 2001
From: Simen Bekkhus <sbekkhus91@gmail.com>
Date: Wed, 8 Nov 2017 11:08:24 +0100
Subject: [PATCH 4/4] Fix test for node 9

---
 integration_tests/__tests__/failures.test.js | 34 +++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

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();
 });