mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-06 06:18:38 -06:00
test: add test-changed script
This commit is contained in:
21
scripts/testChanged.js
Normal file
21
scripts/testChanged.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const execa = require('execa')
|
||||
|
||||
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))
|
||||
|
||||
await execa('jest', [
|
||||
'--env', 'node',
|
||||
'--runInBand',
|
||||
...additionalArgs,
|
||||
'--findRelatedTests', ...files
|
||||
], {
|
||||
stdio: 'inherit'
|
||||
})
|
||||
})().catch(err => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
Reference in New Issue
Block a user