Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Resolve warnings in tests #3873

Merged
merged 9 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -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));

Expand Down Expand Up @@ -31,15 +30,11 @@ export default (projectDir) => {
rootDir = '../../';
}

const coverageReporters = ['lcov', 'html'];
if (!isCI) {
coverageReporters.push('text-summary');
}
const config = {
rootDir,
displayName: name,
verbose: true,
testEnvironment: 'node',
testTimeout: 60 * 1000,
setupFilesAfterEnv: ['jest-extended/all'],
testMatch: [`${packageRoot}/test/**/*-spec.{ts,js}`, `${packageRoot}/test/*-spec.{ts,js}`],
testPathIgnorePatterns: [
Expand All @@ -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'],
},
Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
10 changes: 10 additions & 0 deletions patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 12 additions & 0 deletions patches/jest-config+29.7.0.patch
Original file line number Diff line number Diff line change
@@ -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$': '<rootDir>/preprocessor.js'
},
Loading