index.js 652 B

12345678910111213141516171819202122
  1. module.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
  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. module.exports.defaultModes = {
  19. 'test:unit': 'test'
  20. }