Updated travis to run mutations on changed files only

This commit is contained in:
Alejandro Celaya 2019-04-22 10:04:41 +02:00
parent b83c0e0aba
commit 32f171d861
4 changed files with 14 additions and 11 deletions

View file

@ -1,5 +1,6 @@
build: build:
environment: environment:
node: v10.4.1 node: v10.15.3
tools: tools:
external_code_coverage: true external_code_coverage:
timeout: 1200

View file

@ -13,11 +13,14 @@ services:
install: install:
- npm ci - npm ci
before_script:
- export MUTATION_FILES=$(git diff ${TRAVIS_COMMIT_RANGE:-origin/master} --name-only | grep src/ | paste -sd ",")
script: script:
- npm run lint - npm run lint
- npm run test:ci - npm run test:ci
- if [[ -z $TRAVIS_TAG ]]; then docker build -t shlink-web-client:test . ; fi - if [[ -z $TRAVIS_TAG ]]; then docker build -t shlink-web-client:test . ; fi
- if [[ -z $TRAVIS_TAG ]]; then npm run mutate ; fi - if [[ -z $TRAVIS_TAG ]]; then npm run mutate:ci ; fi
after_success: after_success:
- node_modules/.bin/ocular coverage/clover.xml - node_modules/.bin/ocular coverage/clover.xml

View file

@ -16,7 +16,8 @@
"test": "node scripts/test.js --env=jsdom --colors", "test": "node scripts/test.js --env=jsdom --colors",
"test:ci": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary --coverageReporters=clover", "test:ci": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary --coverageReporters=clover",
"test:pretty": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary --coverageReporters=html", "test:pretty": "npm run test -- --coverage --coverageReporters=text --coverageReporters=text-summary --coverageReporters=html",
"mutate": "./node_modules/.bin/stryker run" "mutate": "./node_modules/.bin/stryker run",
"mutate:ci": "npm run mutate -- --mutate=$MUTATION_FILES"
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.6.3", "@fortawesome/fontawesome-free": "^5.6.3",

View file

@ -1,15 +1,10 @@
const jestConfig = require(`${__dirname}/jest.config.js`); const jestConfig = require(`${__dirname}/jest.config.js`);
// reporters: clear-text
module.exports = (config) => config.set({ module.exports = (config) => config.set({
mutate: jestConfig.collectCoverageFrom, mutate: jestConfig.collectCoverageFrom,
mutator: { mutator: 'javascript',
name: 'javascript',
excludedMutations: [ 'BooleanSubstitution', 'StringLiteral' ],
},
testRunner: 'jest', testRunner: 'jest',
reporters: [ 'progress' ], reporters: [ 'progress', 'clear-text' ],
coverageAnalysis: 'off', coverageAnalysis: 'off',
jest: { jest: {
projectType: 'custom', projectType: 'custom',
@ -21,4 +16,7 @@ module.exports = (config) => config.set({
low: 60, low: 60,
break: null, break: null,
}, },
clearTextReporter: {
logTests: false,
},
}); });