2

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.

4
  • Not sure why you run each command twice in the script. Also where are you calling the script? Commented Dec 6, 2018 at 4:56
  • @smac89 I will call as CMD ["/scripts/test.sh"] Because for my test scripts, app is required to run first that's why that unit test could be able to test that app's api. Commented Dec 6, 2018 at 6:51
  • Is your issue fixed? Commented Dec 7, 2018 at 21:47
  • @Bsquare yap. Could u pls check my answer? Commented Dec 8, 2018 at 5:37

1 Answer 1

3
#!/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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.