-
-
Save Roms1383/67664bc9c857688613a2520b92aed157 to your computer and use it in GitHub Desktop.
Medium - Dynamically matching files in Jest - using environment variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JEST_FILES_PATTERN="spec" | |
// or JEST_FILES_PATTERN="test" | |
// or JEST_FILES_PATTERN="spec|test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config() | |
module.exports = { | |
roots: [ | |
'<rootDir>/dist/', | |
], | |
testEnvironment: 'node', | |
transform: { | |
'^.+\\.(ts|tsx)$': 'ts-jest', | |
}, | |
testMatch: [`**/?(*.)+(${process.env.JEST_FILES_PATTERN}).js`] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"scripts": { | |
... | |
"build": "rm -rf dist && tsc", | |
"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