Ava + ESM + TypeScript: How do I specify a custom config path for tsconfig.json? #2941
Answered
by
novemberborn
paulshryock
asked this question in
Q&A
-
When my TypeScript config path is # tree
.
├── config
│ ├── ava.config.js
│ └── tsconfig.json
├── .env
└── package.json // ./config/ava.config.js
const config = {
extensions: {
ts: 'module',
},
files: ['src/**/*.test.ts'],
nodeArguments: ['--loader=ts-node/esm'],
}
export default config # ./.env
TS_NODE_PROJECT=config/tsconfig.json // ./package.json
{
"scripts": {
"test": "npx ava --config=./config/ava.config.js --verbose",
"typecheck": "tsc -p config/tsconfig.json"
},
"devDependencies": {
"@types/node": "^17.0.8",
"ava": "^4.0.0",
"esm": "^3.2.25",
"ts-node": "^10.4.0",
"tslib": "^2.3.1",
"typescript": "^4.5.4"
},
"engines": {
"node": "^17.3",
"npm": "^8.3"
}
} I'm looking for a way to pass a custom TypeScript config path to either the CLI or my Ava config. So something like one of these: npx ava --config=./config/ava.config.js --tsConfig=./config/tsconfig.json --verbose or // ./config/ava.config.js
const config = {
extensions: {
ts: 'module',
},
files: ['src/**/*.test.ts'],
nodeArguments: ['--loader=ts-node/esm'],
tsConfig: './config/tsconfig.json',
}
export default config Is there anything like this possible in the latest version of Ava? |
Beta Was this translation helpful? Give feedback.
Answered by
novemberborn
Jan 11, 2022
Replies: 1 comment
-
AVA isn't involved here, it's something for ts-node. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
paulshryock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AVA isn't involved here, it's something for ts-node.