What should I do when I run npm command?

A double dash or two hyphens is used as an example --

:

npm test -- --coverage

      

Running npm

without trailing double label does not start in the coating operation, so it seems that he adds the following flags is right? I couldn't find any documentation on this.

+3


source to share


1 answer


--

as an argument itself is standardized across all UNIX commands: this means that further arguments should be treated as positional arguments, not parameters. See Manual 10 on POSIX Utility Syntax Conventions .

To give you a non-NPM based example ls -- -l

would look for a file named -l

because it --

specified that all subsequent arguments are positional.



In this context, it means that --coverage

it is not an argument itself npm

; presumably then it is subsequently read by a subcommand test

. For a tool that followed conventions, this would not be necessary, since Guideline 9 states that all parameters must be specified before any arguments (thus, in this context --coverage

it should be considered an argument, since it occurs after the argument test

); however, since the NPM is only partially compliant with the guidelines, this is a predictable result.

(Long --option

-style options are actually an extension of GNU as a whole, so we have a few parsing styles mismatch here, that's unfortunately life.)

+7


source







All Articles