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

Using --testURL as a CLI option results in Unrecognized CLI Parameter" #8889

Closed
zoeyg opened this issue Aug 29, 2019 · 12 comments · Fixed by #10595
Closed

Using --testURL as a CLI option results in Unrecognized CLI Parameter" #8889

zoeyg opened this issue Aug 29, 2019 · 12 comments · Fixed by #10595

Comments

@zoeyg
Copy link

zoeyg commented Aug 29, 2019

Bug Report

When running jest via the command line with a --testURL argument it says the parameter is unrecognized.

╭─zg@a-computer ~/repos/test 
╰─$ jest --testURL "https://localhost"                                                                                                                                                              128 ↵
● Unrecognized CLI Parameter:

  Unrecognized option "testURL". Did you mean "testURL"?

  CLI Options Documentation:
  https://jestjs.io/docs/en/cli.html

To Reproduce

Install jest and then run jest --testURL "https://localhost"

Expected behavior

Jest runs with the appropriate testURL as part of the configuration

envinfo

╭─zg@a-computer ~/repos/test 
╰─$ npx envinfo --preset jest
npx: installed 1 in 10.374s

  System:
    OS: macOS 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
  Binaries:
    Node: 10.2.1 - ~/.nvm/versions/node/v10.2.1/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v10.2.1/bin/npm
@SimenB
Copy link
Member

SimenB commented Aug 30, 2019

Haha, what a dumb error 😅 Workaround: jest --config '{"testURL": "https://localhost"}'.


Do you wanna send a PR fixing this? The error is here: https://github.com/facebook/jest/blob/95688ac9c81c19ca1bbda3aaad2a278c2a60461f/packages/jest-validate/src/validateCLIOptions.ts#L80-L89

In particular, making sure to check allowedOptions both with and without camelcase seemingly fixes this issue from my quick editing in node_modules.

@zoeyg
Copy link
Author

zoeyg commented Aug 30, 2019

My coworker, @cchanse, would like to take a stab at it

@SimenB
Copy link
Member

SimenB commented Aug 30, 2019

That's awesome, go for it!

@clentfort
Copy link
Contributor

Arguments starting with a -- (double dash) are commonly referred to as "long options". If they expect an argument you usually would "assign" it.1 So in this case you would have to use --testURL="http://localhost". This works at least on latest master. The error message in this case should explain that an argument was expected but none was received.

@leonardovillela
Copy link
Contributor

Can i help in this issue in someway?

@snitin315
Copy link
Contributor

I will take this up.

@snitin315
Copy link
Contributor

@SimenB I made a change are wrote a unit test for same. How can I run a single unit test only?

@victorphoenix3
Copy link
Contributor

May I work on this issue?

@snitin315
Copy link
Contributor

@victorphoenix3 yes!

@alexkubica
Copy link

@victorphoenix3 let me know if you're not working on it, I'd love to take a try 😄

@victorphoenix3
Copy link
Contributor

Hi @alexkubica ! I am almost done with the PR. Maybe you could help review it :)

@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 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
7 participants