Files
vuepress/scripts/test.js
T
ULIVZandGitHub e5d8ed4655 feat: refine node api (#1395)
- fix($core): markdown slot doesn‘t work. (regression of c85f62d)
- docs: fresh Node.JS API.
- test: official plugins.
2019-03-04 23:46:13 +08:00

33 lines
754 B
JavaScript

const minimist = require('minimist')
const { createJestRunner } = require('@vuepress/test-utils')
const { createApp } = require('@vuepress/core')
const rawArgs = process.argv.slice(2)
const args = minimist(rawArgs)
let regex
if (args.p) {
const packages = (args.p || args.package).split(',').join('|')
regex = `.*@vuepress/(${packages}|plugin-(${packages}))/.*\\.spec\\.js$`
const i = rawArgs.indexOf('-p')
rawArgs.splice(i, 2)
}
const jestRunner = createJestRunner([
'--config', 'scripts/jest.config.js',
'--runInBand',
...(regex ? [regex] : [])
])
// ensure the basic temp files were genereatod
createApp({
temp: '.temp'
})
.process()
.then(() => jestRunner())
.catch(err => {
console.error(err)
process.exit(1)
})