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.

prettierPath only works via CLI option, not config

See original GitHub issue

🐛 Bug Report

When specifying the prettierPath option in a config file or JSON object, it is ignored. Jest prints the warning:

    Jest: Inline Snapshots requires Prettier.
    Please ensure "prettier" is installed in your project.

By putting a console.log in the module at the specified prettierPath, it is apparent that Jest never even attempts to import the supplied path. The value that eventually makes it to getPrettier() in the jest-jasmine2 package is null.

Using the same value with --prettierPath via the CLI works.

To Reproduce

Specify the prettierPath option in a config file or --config JSON object.

Expected behavior

The provided path will be used for Prettier.

Link to repl or repo (highly encouraged)

Please provide either a repl.it demo or a minimal repository on GitHub.

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

Paste the results here:

npx: installed 1 in 2.496s

  System:
    OS: macOS 10.14.1
    CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
  Binaries:
    Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v8.9.4/bin/npm
  npmPackages:
    jest: ^23.6.0 => 23.6.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
SimenBcommented, Nov 26, 2018

I refuse to believe this is intentional (if it is I’ll argue against it), so PR very much welcome 🙂

1reaction
azzcommented, Nov 26, 2018

Definately not intentional

Read more comments on GitHub >

github_iconTop Results From Across the Web

In VS Code, I'm getting this error, 'Failed to load module ...
When I go into VS Code settings, I search for Prettier Path . I see 2 options here, Prettier:Config Path and Prettier: Prettier...
Read more >
CLI - Prettier
Use the `prettier` command to run Prettier from the command line. ... If no config file is found, CLI options will evaluate as...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
This blog post shows how to configure Prettier to work from command ... In the VSCode global settings, set this option to only...
Read more >
Configuring Jest
The bail config option can be used here to have Jest stop running tests ... This option is only supported using the default...
Read more >
Configuring Jest compiled - w3resource
When you are using the --config option, the JSON file should not contain ... The Jest philosophy works great by default, but there...
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