Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Run npm scripts in series

    Elijah ManorElijah Manor

    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.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




    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.

    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.

    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.