UNPKG

667 BJavaScriptView Raw
1module.exports = api => {
2 api.registerCommand('test:unit', {
3 description: 'run unit tests with jest',
4 usage: 'vue-cli-service test:unit [options] <regexForTestFiles>',
5 options: {
6 '--watch': 'run tests in watch mode'
7 },
8 details:
9 `All jest command line options are supported.\n` +
10 `See https://facebook.github.io/jest/docs/en/cli.html for more details.`
11 }, (args, rawArgv) => {
12 // for @vue/babel-preset-app <= v4.0.0-rc.7
13 process.env.VUE_CLI_BABEL_TARGET_NODE = true
14 process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = true
15 require('jest').run(rawArgv)
16 })
17}
18
19module.exports.defaultModes = {
20 'test:unit': 'test'
21}