Skip to content

Instantly share code, notes, and snippets.

@Roms1383
Last active January 16, 2020 04:47
Show Gist options
  • Save Roms1383/e149de4b259442cd36ffeb6e1e130848 to your computer and use it in GitHub Desktop.
Save Roms1383/e149de4b259442cd36ffeb6e1e130848 to your computer and use it in GitHub Desktop.
Medium - Dynamically matching files in Jest - using different configuration files
module.exports = {
...require('./jest.config'),
testMatch: ['**/?(*.)+(test).js']
}
module.exports = {
roots: [
'<rootDir>/dist/',
],
testEnvironment: 'node',
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
testMatch: ['**/?(*.)+(spec|test).js']
}
module.exports = {
...require('./jest.config'),
testMatch: ['**/?(*.)+(spec).js']
}
{
...
"scripts": {
...
"build": "rm -rf dist && tsc",
"prespec": "yarn build",
"spec": "yarn jest --config jest.config.spec.only.js --passWithNoTests",
"preintegration": "yarn build",
"integration": "yarn jest --config jest.config.integration.only.js --passWithNoTests",
"pretest": "yarn build",
"test": "yarn jest --passWithNoTests"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment