diff --git a/jest.config.js b/jest.config.js index a94b37b7c9fd..043a5c2f14aa 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,4 +10,5 @@ module.exports = { ], testPathIgnorePatterns: ["/node_modules/", "/clients/client-.*"], coveragePathIgnorePatterns: ["/node_modules/", "/clients/client-.*", "/__fixtures__/"], + setupFilesAfterEnv: ["/scripts/jest/forceGlobalGc.js"], }; diff --git a/package.json b/package.json index d5f1a9bf3da3..56aeb047d48b 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/jest/forceGlobalGc.js b/scripts/jest/forceGlobalGc.js new file mode 100644 index 000000000000..3467479df0dc --- /dev/null +++ b/scripts/jest/forceGlobalGc.js @@ -0,0 +1,3 @@ +afterEach(() => { + if (global.gc) global.gc(); +});