Reputation: 637
I've been adding some unit tests to my project recently and was wondering is it possible to add those unit tests to my yarn run build process. Or would it be better to create a bash script the runs both cmds like yarn run unit then yarn run build.
How would I go about this?
I'm using VueJs cli along with Jest for the unit testing
Upvotes: 2
Views: 675
Reputation: 6034
You can define additional script with hook 'pre' in package.json
:
"scripts": {
...
"prebuild": "yarn run test"
...
}
So "prebuild" script will run before every build execution automatically.
Or you can just add another script and run it instead of build
:
"scripts": {
...
"testbuild": "yarn run test && yarn run build"
...
}
Upvotes: 5