Skip to content

Instantly share code, notes, and snippets.

@carboleda
Last active August 19, 2022 13:07
Show Gist options
  • Save carboleda/0358b87333aee4c81ed3b021f20a66cf to your computer and use it in GitHub Desktop.
Save carboleda/0358b87333aee4c81ed3b021f20a66cf to your computer and use it in GitHub Desktop.
Improving the Jest tests performance in CI environments when using Typescript - Medium Story
pipeline {
agent { docker { image 'node:18.7-alpine' } }
stages {
stage('test') {
steps {
sh 'npm run test:ci'
}
}
}
}
const isolatedModules = process.env.ISOLATED_MODULES === 'true';
module.exports = {
// [...]
globals: {
'ts-jest': {
isolatedModules
}
}
};
{
"scripts": {
"test": "jest",
"test:ci": "ISOLATED_MODULES=true node --expose-gc ./node_modules/.bin/jest --runInBand"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment