From d97a083b1cbeb8476106eb6e03cd8572780e9543 Mon Sep 17 00:00:00 2001
From: Ryan Senior <ryan@metabase.com>
Date: Mon, 29 Jan 2018 10:48:48 -0600
Subject: [PATCH] Switch jest maxWorkers to 8, fix nested Jest tests

This commit reduces the number of test runner workers for Jest tests
from 10 to 8. This will use less memory and hopefully avoid Circle CI
4GB memory limit test failures. It also fixes some tests that have
nested `it` clauses. This doesn't run correctly on older versions of
Jest and will fail fast on newer versions of Jest.

Fixes #6790
---
 frontend/test/metabase-lib/Mode.unit.spec.js | 6 +++---
 package.json                                 | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/frontend/test/metabase-lib/Mode.unit.spec.js b/frontend/test/metabase-lib/Mode.unit.spec.js
index b111e62aa3d..5cc71c8f8fb 100644
--- a/frontend/test/metabase-lib/Mode.unit.spec.js
+++ b/frontend/test/metabase-lib/Mode.unit.spec.js
@@ -22,7 +22,7 @@ describe("Mode", () => {
         .mode();
 
     describe("forQuestion(question)", () => {
-        it("with structured query question", () => {
+        describe("with structured query question", () => {
             // testbed for generative testing? see http://leebyron.com/testcheck-js
 
             it("returns `segment` mode with raw data", () => {});
@@ -39,11 +39,11 @@ describe("Mode", () => {
             it("returns `default` mode with >=0 aggregations and >=3 breakouts", () => {});
             it("returns `default` mode with >=1 aggregations and >=1 breakouts when first neither date or category", () => {});
         });
-        it("with native query question", () => {
+        describe("with native query question", () => {
             it("returns `NativeMode` for empty query", () => {});
             it("returns `NativeMode` for query with query text", () => {});
         });
-        it("with oddly constructed query", () => {
+        describe("with oddly constructed query", () => {
             it("should throw an error", () => {
                 // this is not the actual behavior atm (it returns DefaultMode)
             });
diff --git a/package.json b/package.json
index 808b5a09393..e85fcafe8ca 100644
--- a/package.json
+++ b/package.json
@@ -158,7 +158,7 @@
     "test": "yarn run test-integrated && yarn run test-unit && yarn run test-karma",
     "test-integrated": "babel-node ./frontend/test/__runner__/run_integrated_tests.js",
     "test-integrated-watch": "babel-node ./frontend/test/__runner__/run_integrated_tests.js --watch",
-    "test-unit": "jest --maxWorkers=10 --config jest.unit.conf.json --coverage",
+    "test-unit": "jest --maxWorkers=8 --config jest.unit.conf.json --coverage",
     "test-unit-watch": "jest --maxWorkers=10 --config jest.unit.conf.json --watch",
     "test-unit-update-snapshot": "jest --maxWorkers=10 --config jest.unit.conf.json --updateSnapshot",
     "test-karma": "karma start frontend/test/karma.conf.js --single-run",
-- 
GitLab