mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-13 19:01:25 -06:00
33 lines
767 B
JavaScript
33 lines
767 B
JavaScript
const execa = require('execa')
|
|
const chalk = require('chalk')
|
|
|
|
const additionalArgs = process.argv.slice(2)
|
|
|
|
;(async () => {
|
|
// get modified files
|
|
const { stdout } = await execa('git', ['ls-files', '--exclude-standard', '--modified', '--others'])
|
|
const files = stdout.split('\n')
|
|
.filter(line => /\.js$/.test(line))
|
|
.filter(line => /^(packages|__mocks__)/.test(line))
|
|
|
|
if (!files.length) {
|
|
console.log(
|
|
`No changed src files found.\n` +
|
|
`To run the full test suite, run ${chalk.cyan(`yarn test-all`)} instead.`
|
|
)
|
|
return
|
|
}
|
|
|
|
await execa('jest', [
|
|
'--env', 'node',
|
|
'--runInBand',
|
|
...additionalArgs,
|
|
'--findRelatedTests', ...files
|
|
], {
|
|
stdio: 'inherit'
|
|
})
|
|
})().catch(err => {
|
|
err
|
|
process.exit(1)
|
|
})
|