What should I do when I run npm command?
--
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.)
source to share