You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project seems a nice fit for constructing dynamic paths within the tsconfig.json where based on e.g. an environment variable a different directory is used to e.g. load different data sets.
The only thing I miss here is how to 'execute' or trigger e.g. the tsconfig.js/once? Maybe I am overthinking things to much, but do I place it within my package.json's script or jest.config.js? In my scenario I use ts-jest and have the following setup;
module.exports={preset: 'ts-jest',testEnvironment: 'node',moduleNameMapper: {// as this file is already a .js file I can user `${process.env.NODE_ENV}` here already pointing to e.g. dev or test'^app/(.*)$': `<rootDir>/${process.env.NODE_ENV}/$1`,}};
tsconfig.json
// tsconfig.json{"compilerOptions": {"baseUrl": ".","paths": {"@app/*": [// ====> here I also would like to use the environment var to point to a different path depending on the env.// `src/${process.env.NODE_ENV}/*`"src/*"]}}}
The text was updated successfully, but these errors were encountered:
Hello @dnmd
Thank you for reaching out! 🙂
I'm sorry for the late reply, I'm swamped with other work.
Regarding your query, I'm actually unsure what exactly you are trying to accomplish, but I'll try to help towards what I understand. It's been quite some time since I've used jest, so I may be overlooking something. Please elaborate accordingly.
In order to trigger a single run before any run of npm test, you can just add a pretest script to your package.json, like so:
This project seems a nice fit for constructing dynamic
paths
within thetsconfig.json
where based on e.g. an environment variable a different directory is used to e.g. load different data sets.The only thing I miss here is how to 'execute' or trigger e.g. the
tsconfig.js/once
? Maybe I am overthinking things to much, but do I place it within mypackage.json
's script orjest.config.js
? In my scenario I usets-jest
and have the following setup;( minimal repo: https://github.com/dnmd/ts-jest-tsconfig.js )
package.json
jest.config.js
tsconfig.json
The text was updated successfully, but these errors were encountered: