Run npm scripts in series

Elijah Manor
InstructorElijah Manor
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 5 years ago

After creating several npm script it becomes useful to run multiple scripts back-to-back in series. This is a nice feature because you can enforce that one script needs to complete before starting another one.

[00:01] Before we run our tests, it would be nice to lint our JavaScript and our styles first. What we're going to do is we're going to npm run eslint and then we're going to use the double ampersand in order to run multiple scripts in series. Then we'll also run our style lint script to lint our SaaS. The nice thing about this is that if any of the linting fails, then the rest of the command is aborted.

[00:24] Let's quit to our terminal and run npm test or npmt, and you'll see first it's linting our JavaScript and linting our SaaS, then running our tests. In this case, all the linting passed, so the tests will run at the end. This time, let's go into our index CSS file and change one of our colors to green, then we'll save that.

[00:46] We'll run our tests, but this time, the JavaScript linting passed, but our style lint failed, because we're using a named color and that's one of our rules, so we'll need to address that linting error, if we want the test to run.

~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today