question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to get options.configPath working

See original GitHub issue

Is 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:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
just-jebcommented, Jun 16, 2019

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.

1reaction
denis-itskovichcommented, Jun 16, 2019

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 in jest.config.js?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found