Skip to content

Commit

Permalink
fix: patch Jest memory leak by calling GC afterEach
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Oct 5, 2021
1 parent ecb21b5 commit 7aa2dbc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ module.exports = {
],
testPathIgnorePatterns: ["/node_modules/", "<rootDir>/clients/client-.*"],
coveragePathIgnorePatterns: ["/node_modules/", "<rootDir>/clients/client-.*", "/__fixtures__/"],
setupFilesAfterEnv: ["<rootDir>/scripts/jest/forceGlobalGc.js"],
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build:all": "yarn build:crypto-dependencies && lerna run build",
"build-documentation": "yarn remove-documentation && typedoc",
"pretest:all": "yarn build:all",
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope '@aws-sdk/{fetch-http-handler,hash-blob-browser}'",
"test:all": "node --expose-gc ./node_modules/.bin/jest --coverage --passWithNoTests && lerna run test --scope '@aws-sdk/{fetch-http-handler,hash-blob-browser}'",
"test:functional": "jest --config tests/functional/jest.config.js --passWithNoTests",
"test:integration-legacy": "cucumber-js --fail-fast",
"test:integration": "jest --config jest.config.integ.js --passWithNoTests",
Expand Down
3 changes: 3 additions & 0 deletions scripts/jest/forceGlobalGc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
afterEach(() => {
if (global.gc) global.gc();
});

0 comments on commit 7aa2dbc

Please sign in to comment.