Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prettierPath only works via CLI option, not config #7406

Closed
exogen opened this issue Nov 25, 2018 · 5 comments · Fixed by #7412
Closed

prettierPath only works via CLI option, not config #7406

exogen opened this issue Nov 25, 2018 · 5 comments · Fixed by #7412

Comments

@exogen
Copy link

exogen commented Nov 25, 2018

🐛 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
@grosto
Copy link
Contributor

grosto commented Nov 25, 2018

It seems that argv has a default value for prettierPath and it overrides config file's prettierPath. I could do a PR, unless I am missing something and the default value is intentional.

@rickhanlonii
Copy link
Member

Hmm, @azz is that intentional?

@SimenB
Copy link
Member

SimenB commented Nov 26, 2018

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

@azz
Copy link
Contributor

azz commented Nov 26, 2018

Definately not intentional

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants