From f2d0e170a079e0d2cb1b49fbb57a5e9ff8ffe1ef Mon Sep 17 00:00:00 2001 From: sotojn Date: Wed, 11 Dec 2024 09:33:25 -0700 Subject: [PATCH 1/9] remove invalid config options in jest base config --- jest.config.base.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/jest.config.base.js b/jest.config.base.js index 8c5a1e7a2ae..1af827cdff5 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -31,14 +31,9 @@ export default (projectDir) => { rootDir = '../../'; } - const coverageReporters = ['lcov', 'html']; - if (!isCI) { - coverageReporters.push('text-summary'); - } const config = { rootDir, displayName: name, - verbose: true, testEnvironment: 'node', setupFilesAfterEnv: ['jest-extended/all'], testMatch: [`${packageRoot}/test/**/*-spec.{ts,js}`, `${packageRoot}/test/*-spec.{ts,js}`], @@ -57,14 +52,10 @@ export default (projectDir) => { }, moduleFileExtensions: ['ts', 'js', 'json', 'node', 'pegjs', 'mjs'], extensionsToTreatAsEsm: ['.ts'], - collectCoverage: true, coveragePathIgnorePatterns: ['/node_modules/', '/test/'], watchPathIgnorePatterns: [], - coverageReporters, coverageDirectory: `${packageRoot}/coverage`, - watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'], workerIdleMemoryLimit: '200MB', - testTimeout: 60 * 1000, globals: { availableExtensions: ['.js', '.ts', '.mjs', 'cjs'], }, From fbf7ff79e30ac8808bc6897de6e0c4782318feeb Mon Sep 17 00:00:00 2001 From: sotojn Date: Wed, 11 Dec 2024 09:34:14 -0700 Subject: [PATCH 2/9] mirgate intended configs to global jest config --- jest.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jest.config.js b/jest.config.js index 1a9b873c4e4..a726ba7a896 100644 --- a/jest.config.js +++ b/jest.config.js @@ -35,6 +35,8 @@ if (!isCI) { export default { rootDir: '.', verbose: true, + testTimeout: 60 * 1000, + watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'], projects, globals: { availableExtensions: ['.js', '.ts', '.mjs', '.cjs'], From b04d16ee88cec109c40f9ebc15f68bfc1898dedb Mon Sep 17 00:00:00 2001 From: sotojn Date: Thu, 12 Dec 2024 16:27:37 -0700 Subject: [PATCH 3/9] add testTimeout back to base jest config --- jest.config.base.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.base.js b/jest.config.base.js index 1af827cdff5..36329f5cf7c 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -35,6 +35,7 @@ export default (projectDir) => { rootDir, displayName: name, testEnvironment: 'node', + testTimeout: 60 * 1000, setupFilesAfterEnv: ['jest-extended/all'], testMatch: [`${packageRoot}/test/**/*-spec.{ts,js}`, `${packageRoot}/test/*-spec.{ts,js}`], testPathIgnorePatterns: [ From 2daa538d78a455bcbcf207915e5cc3159c4abf43 Mon Sep 17 00:00:00 2001 From: sotojn Date: Fri, 13 Dec 2024 10:42:26 -0700 Subject: [PATCH 4/9] remove unused import --- jest.config.base.js | 1 - 1 file changed, 1 deletion(-) diff --git a/jest.config.base.js b/jest.config.base.js index 36329f5cf7c..4ab521251c8 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -1,7 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { isCI } from '@terascope/utils'; const dirname = path.dirname(fileURLToPath(import.meta.url)); From ca15bbe2437e247c1884a03bfc86fc8c4f76154f Mon Sep 17 00:00:00 2001 From: sotojn Date: Fri, 13 Dec 2024 10:48:29 -0700 Subject: [PATCH 5/9] patch jest-config fot testTimout warn bug --- patches/jest-config+29.7.0.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 patches/jest-config+29.7.0.patch diff --git a/patches/jest-config+29.7.0.patch b/patches/jest-config+29.7.0.patch new file mode 100644 index 00000000000..613f2a5851c --- /dev/null +++ b/patches/jest-config+29.7.0.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/jest-config/build/ValidConfig.js b/node_modules/jest-config/build/ValidConfig.js +index 0c1250c..823448a 100644 +--- a/node_modules/jest-config/build/ValidConfig.js ++++ b/node_modules/jest-config/build/ValidConfig.js +@@ -324,6 +324,7 @@ const initialProjectOptions = { + userAgent: 'Agent/007' + }, + testLocationInResults: false, ++ testTimeout: 5000, + testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], + testPathIgnorePatterns: [NODE_MODULES_REGEXP], + testRegex: (0, _jestValidate().multipleValidOptions)( From f2479d8c9de1c7cee991980e8a5b7a200a51aa8b Mon Sep 17 00:00:00 2001 From: sotojn Date: Fri, 13 Dec 2024 14:44:20 -0700 Subject: [PATCH 6/9] remove old jest-config patch --- patches/jest-config+29.7.0.patch | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 patches/jest-config+29.7.0.patch diff --git a/patches/jest-config+29.7.0.patch b/patches/jest-config+29.7.0.patch deleted file mode 100644 index 613f2a5851c..00000000000 --- a/patches/jest-config+29.7.0.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/node_modules/jest-config/build/ValidConfig.js b/node_modules/jest-config/build/ValidConfig.js -index 0c1250c..823448a 100644 ---- a/node_modules/jest-config/build/ValidConfig.js -+++ b/node_modules/jest-config/build/ValidConfig.js -@@ -324,6 +324,7 @@ const initialProjectOptions = { - userAgent: 'Agent/007' - }, - testLocationInResults: false, -+ testTimeout: 5000, - testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], - testPathIgnorePatterns: [NODE_MODULES_REGEXP], - testRegex: (0, _jestValidate().multipleValidOptions)( From d6781b43f2da51f4db349a922daf599c4fa7e083 Mon Sep 17 00:00:00 2001 From: sotojn Date: Fri, 13 Dec 2024 14:51:00 -0700 Subject: [PATCH 7/9] add correct jest-config patch --- patches/@jest+core++jest-config+29.7.0.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 patches/@jest+core++jest-config+29.7.0.patch diff --git a/patches/@jest+core++jest-config+29.7.0.patch b/patches/@jest+core++jest-config+29.7.0.patch new file mode 100644 index 00000000000..59824d9f25b --- /dev/null +++ b/patches/@jest+core++jest-config+29.7.0.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js +index 0c1250c..67e586e 100644 +--- a/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js ++++ b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js +@@ -331,6 +331,7 @@ const initialProjectOptions = { + ['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$'] + ), + testRunner: 'circus', ++ testTimeout: 5000, + transform: { + '\\.js$': '/preprocessor.js' + }, From 040ddb0c1536354a8bd16114a3149ac9532c28ac Mon Sep 17 00:00:00 2001 From: sotojn Date: Tue, 17 Dec 2024 10:44:18 -0700 Subject: [PATCH 8/9] add jest-config patch reasoning in readme --- patches/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/patches/README.md b/patches/README.md index 5ca715403e4..dc083ad0664 100644 --- a/patches/README.md +++ b/patches/README.md @@ -23,3 +23,13 @@ npx patch-package package/another-package ### Updating patches Use exactly the same process as for making patches in the first place, i.e. make more changes, run patch-package, commit the changes to the patch file. + +## Current Patches + +### jest-config + +`jest-config` needed a patch that fixes an issue that's stated here: + +[Unknown option testTimeout validation warning when used in project specific config](https://github.com/jestjs/jest/issues/14513) + +This is fixed on jest version 30 but it's still in beta. Once out of beta, this patch can be removed. From d82cc67e8d0128e93892099e016c0b471b93b7f5 Mon Sep 17 00:00:00 2001 From: sotojn Date: Tue, 17 Dec 2024 10:53:49 -0700 Subject: [PATCH 9/9] fix patch directory of jest-config package --- patches/@jest+core++jest-config+29.7.0.patch | 12 ------------ patches/jest-config+29.7.0.patch | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 patches/@jest+core++jest-config+29.7.0.patch create mode 100644 patches/jest-config+29.7.0.patch diff --git a/patches/@jest+core++jest-config+29.7.0.patch b/patches/@jest+core++jest-config+29.7.0.patch deleted file mode 100644 index 59824d9f25b..00000000000 --- a/patches/@jest+core++jest-config+29.7.0.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js -index 0c1250c..67e586e 100644 ---- a/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js -+++ b/node_modules/@jest/core/node_modules/jest-config/build/ValidConfig.js -@@ -331,6 +331,7 @@ const initialProjectOptions = { - ['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$'] - ), - testRunner: 'circus', -+ testTimeout: 5000, - transform: { - '\\.js$': '/preprocessor.js' - }, diff --git a/patches/jest-config+29.7.0.patch b/patches/jest-config+29.7.0.patch new file mode 100644 index 00000000000..5cf26e4624d --- /dev/null +++ b/patches/jest-config+29.7.0.patch @@ -0,0 +1,12 @@ +diff --git a/node_modules/jest-config/build/ValidConfig.js b/node_modules/jest-config/build/ValidConfig.js +index 0c1250c..67e586e 100644 +--- a/node_modules/jest-config/build/ValidConfig.js ++++ b/node_modules/jest-config/build/ValidConfig.js +@@ -331,6 +331,7 @@ const initialProjectOptions = { + ['/__tests__/\\.test\\.[jt]sx?$', '/__tests__/\\.spec\\.[jt]sx?$'] + ), + testRunner: 'circus', ++ testTimeout: 5000, + transform: { + '\\.js$': '/preprocessor.js' + },