Skip to content

Commit

Permalink
chore: run tests unit test dependent on node version
Browse files Browse the repository at this point in the history
Co-Authored-By: Jakob Hellermann <[email protected]>
Co-Authored-By: Sebastian Köhnen <[email protected]>
Co-Authored-By: Daniel Knapp <[email protected]>
  • Loading branch information
4 people committed Sep 23, 2020
1 parent 2eb30e0 commit e89bc00
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ install:
- npm install
script:
- npm run bundle
- npm run test:unit
- ./run_unit_tests.sh
- npm run test:integration
notifications:
slack:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"test:dev": "jest --selectProjects node dom --watch",
"test:dev:coverage": "jest --selectProjects node dom --watch --coverage",
"test:unit": "jest --selectProjects node dom",
"test:unit:noDom": "jest --selectProjects node",
"test:unit:coverage": "jest --selectProjects node dom --coverage",
"test:integration": "npm run bundle && jest --selectProjects bundle",
"bundle": "browserify -r ./lib/browser.ts:sipgate-io -p tsify -g uglifyify > ./bundle/sipgate-io.js && terser --compress --mangle -o ./bundle/sipgate-io.min.js -- ./bundle/sipgate-io.js",
Expand Down Expand Up @@ -49,7 +50,7 @@
],
"husky": {
"hooks": {
"pre-commit": "./update_version.sh && npm run test:unit && lint-staged"
"pre-commit": "./update_version.sh && ./run_unit_tests.sh && lint-staged"
}
},
"lint-staged": {
Expand Down
10 changes: 10 additions & 0 deletions run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

nodeVersion=$(node -v)

if [[ $nodeVersion == *"v10"* ]]; then
npm run test:unit:noDom
else
npm run test:unit
fi

0 comments on commit e89bc00

Please sign in to comment.