Skip to content

Commit

Permalink
chore(repo): fix ci pipeline (#2706)
Browse files Browse the repository at this point in the history
* chore(repo): increase workers

* chore(repo): add ci flag

* chore(test-utils): add afterall

* chore(repo): update node versions in circle CI

* chore(repo): move node 16 to previous version due to memory leak issues with jest

* chore(deps-dev): upgrade jest

* fix(repo): add workerIdleMemoryLimit

* chore(repo): upgrade jest

* chore(repo): remove node 12
  • Loading branch information
mnaumanali94 authored Oct 4, 2024
1 parent 4e52c90 commit dfe614b
Show file tree
Hide file tree
Showing 5 changed files with 950 additions and 483 deletions.
11 changes: 5 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ defaults:
tags:
only: /^v.*/
node-versions: &node-versions
- "12.22"
- "14.21"
- &node-maintenance-lts "16.20"
- &node-active-lts "18.18"
- &node-current "20.5"
- &node-active-lts "18.20"
- &node-current "20.17"
pkg-cache-path: &pkg-cache-path /tmp/pkg-node-binaries
ldid-version: &ldid-version 2.1.5-procursus7 # https://github.com/ProcursusTeam/ldid

Expand Down Expand Up @@ -193,12 +192,12 @@ commands:
parameters:
max-workers:
type: integer
default: 1
default: 3
steps:
- run: yarn pretest
- run:
name: Run node tests
command: yarn test.jest --maxWorkers=<< parameters.max-workers >>
command: yarn test.jest --ci --maxWorkers=<< parameters.max-workers >>

test-harness:
parameters:
Expand Down Expand Up @@ -276,7 +275,7 @@ jobs:
- test-harness:
os: linux
node-version: << parameters.node-version >>
max-workers: 1
max-workers: 3

test-browser:
docker:
Expand Down
8 changes: 7 additions & 1 deletion jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*eslint-env node*/
import { pathsToModuleNameMapper } from 'ts-jest';
import { ConfigSet, pathsToModuleNameMapper } from 'ts-jest';
import * as path from 'path';
import * as fs from 'fs';
import { fileURLToPath } from 'url';
Expand All @@ -20,6 +20,10 @@ const projectDefault = {
},
};

const config = {
workerIdleMemoryLimit: '1024MB',
};

export default {
projects: [
{
Expand Down Expand Up @@ -111,4 +115,6 @@ export default {
},
],
collectCoverageFrom: ['<rootDir>/packages/*/src/**/*.ts', '!<rootDir>/packages/*/src/**/__*__/**/*.ts'],
...config,
};

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
"@semantic-release/npm": "^9.0.2",
"@semantic-release/release-notes-generator": "^10.0.3",
"@swc/core": "^1.2.210",
"@swc/jest": "^0.2.21",
"@swc/jest": "^0.2.36",
"@types/file-entry-cache": "^5.0.2",
"@types/jest": "^28.1.6",
"@types/jest": "^29.5.13",
"@types/karma": "^6.3.3",
"@types/lodash": "^4.14.176",
"@types/node": "^18.17.7",
Expand All @@ -109,8 +109,8 @@
"fetch-mock": "^9.11.0",
"file-entry-cache": "^6.0.1",
"husky": "^7.0.4",
"jest": "^28.1.3",
"jest-mock": "^27.5.1",
"jest": "^29.7.0",
"jest-mock": "^29.7.0",
"karma": "^6.4.0",
"karma-chrome-launcher": "^3.1.1",
"karma-jasmine": "^5.1.0",
Expand All @@ -123,7 +123,7 @@
"patch-package": "^6.4.7",
"prettier": "^2.4.1",
"semantic-release": "^19.0.5",
"ts-jest": "^28.0.5",
"ts-jest": "^29.2.5",
"ts-node": "^10.8.2",
"typescript": "^4.4.4"
},
Expand Down
12 changes: 10 additions & 2 deletions test-utils/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ const fs = new Proxy(nodeFs, {
},
});

afterEach(() => {
const cleanup = () => {
nock.cleanAll();
try {
fs.rmdirSync(__dirname, { recursive: true });
} catch {
//
// Handle error if necessary
}
};

afterEach(() => {
cleanup();
});

afterAll(() => {
cleanup();
});

type Body = string | Record<string, unknown>;
Expand Down
Loading

0 comments on commit dfe614b

Please sign in to comment.