Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm run removes quotes from given parameters #7743

Closed
@mantoni

Description

I'm using npm as a build tool and ran into the following issue with npm run and quoted parameters.

This is the interesting part of the "scripts" section in my package.json:

"scripts": {
  "test": "mochify",
  "cover": "npm run test -- --plugin [ mochify-istanbul --report cobertura --exclude '**/*.mustache' ]"
}

Running npm run cover prints this:

> npm run test -- --plugin [ mochify-istanbul --report cobertura --exclude '**/*.mustache' ]
...
> mochify --plugin [ mochify-istanbul --report cobertura --exclude **/*.mustache ]

You can see that **/*.mustache is quoted on the first line, but the quotes are removed on the second line. This causes the script to fail because I have to pass the glob expression as a plain string.

If I change the cover script to this:

"cover": "mochify --plugin [ mochify-istanbul --report cobertura --exclude '**/*.mustache' ]"

... calling npm run cover works fine and npm prints the quotes as expected:

> mochify --plugin [ mochify-istanbul --report cobertura --exclude '**/*.mustache' ]

Thanks for looking into it!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions