Unable to get options.configPath working
See original GitHub issueIs it possible to add a warning log when the custom config path does not exist? I am unable to troubleshoot why the jest angular builder cannot find my custom jest config.
The current custom-config.resolver.ts
static resolveForProject(projectRoot: Path, configPath: string){
const jestConfigPath = getSystemPath(join(projectRoot, configPath));
return existsSync(jestConfigPath) && require(jestConfigPath) || {};
}
I propose adding:
console.log(`warning: unable to locate custom jest configuration at path "${jestConfigPath}"`);
The final code might look like:
static resolveForProject(projectRoot: Path, configPath: string){
const jestConfigPath = getSystemPath(join(projectRoot, configPath));
const exists = existsSync(jestConfigPath);
if (!exists) {
console.log(`warning: unable to locate custom jest configuration file at path "${jestConfigPath}"`);
return {};
}
return require(jestConfigPath);
}
I would be more than happy to submit the PR myself if the concept is well received. Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Unable to get options.configPath working · Issue #84 - GitHub
I am unable to troubleshoot why the jest angular builder cannot find my custom jest config. The current custom-config.resolver.ts. static ...
Read more >Prettier vscode extension ignoring config files - Stack Overflow
Basically Prettier: Config Path Path to the prettier configuration file option overrides all other config files regardless of placement.
Read more >NuGetCommand@2 - NuGet v2 task | Microsoft Learn
Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet.
Read more >Command Line Interface | API | Docs - TestCafe
TestCafe tests fail when a page yields a JavaScript error. Use the -e ( --skip-js-errors ) option to ignore JavaScript errors during the...
Read more >CLI options - Terragrunt
Overwrite settings on nested AWS providers to work around several Terraform bugs. Due to issue #13018 and issue #26211, the import command may...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, probably it should be displayed only in certain circumstances. The question is in which circumstances.
Indeed, if you don’t need custom config you’re fine. But if you do need it and you place it in a different place… You probably want to see this warning.
The builder hides complexity behind Jest setup. Part of it is that the user doesn’t have to specify config path explicitly - he can just use the default path and put the custom config under the directory specified in the docs. The builder, however, cannot distinguish between config path that was specified explicitly and the default one since the default comes from the JSON schema which is parsed by architect.
I’m open to suggestions though.
Why does this warning make sense? What if I don’t need custom config and the default one works fine? What if I configure custom configuration in
package.json
and not injest.config.js
?