--
as an argument on its own is standardized across all UNIX commands: It means that further arguments should be treated as positional arguments, not options. See Guideline 10 in POSIX Utility Syntax Conventions.
To give you a non-NPM-based example, ls -- -l
will look for a file named -l
, because the --
specified that all subsequent arguments are positional.
In this context, it means that --coverage
isn’t an option to npm
itself; presumably, then, it’s subsequently read by the test
subcommand. For a tool that were following the conventions properly this wouldn’t be necessary, because Guideline 9 specifies that all options shall be given before any arguments (thus that in this context --coverage
should be treated as an argument since it comes after the argument test
); however, inasmuch as NPM is only partially following the guidelines, this is a foreseeable result.
(Long --option
-style options are actually a GNU extension as a whole, so what we have here is a mismash of multiple parsing styles; such is life, unfortunately).