Pyae Phyoe Shein
Pyae Phyoe Shein

Reputation: 13787

How to run npm test after npm start in bash script

In my docker file, I want to run test script inside it after app is up in Docker dev version. Problem is when I created a bash script and add like that, test script is not working.

Here is my package json file:

"scripts": {
    "build": "./node_modules/babel-cli/bin/babel.js src --out-dir lib --copy-files lib --plugins transform-react-jsx --presets es2015",
    "bundle": "./node_modules/browserify/bin/cmd.js lib/client.js -o public/js/bundle.js",
    "start": "npm run build && npm run bundle && node lib/server.js",
    "test": "mocha ./src/*.test.js"
},

and here is bash script file

#!/bin/bash
npm start
npm run start

npm test
npm run test

Please let me know how to fix it, thanks much.

Upvotes: 1

Views: 11396

Answers (1)

Pyae Phyoe Shein
Pyae Phyoe Shein

Reputation: 13787

#!/bin/bash
npm run build
npm run bundle
forever start ./lib/server.js

npm test

I've found solution that I need to install forever or pm2 first.

Upvotes: 2

Related Questions