Skip to content

Instantly share code, notes, and snippets.

@ali-kamalizade
Created September 16, 2022 20:45
Show Gist options
  • Save ali-kamalizade/8d80bca17a7fde7abd2d1a237cef8732 to your computer and use it in GitHub Desktop.
Save ali-kamalizade/8d80bca17a7fde7abd2d1a237cef8732 to your computer and use it in GitHub Desktop.
A Jest configuration with globalSetup and globalTeardown
/**
* @type {import("ts-jest/dist/types").InitialOptionsTsJest}
*/
module.exports = {
globalSetup: './jest-global-setup.ts',
globalTeardown: './jest-global-teardown.ts',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
isolatedModules: true
}
},
testEnvironment: 'node',
transform: {
'^.+\\.ts$': 'ts-jest'
},
moduleFileExtensions: ['ts', 'js'],
setupFilesAfterEnv: ['./setup-jest.js']
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment