[Vuejs]-Testing Single-File Components with Mocha + webpack got RUNTIME EXCEPTION Exception occurred while loading your tests in unit test on vuejs

-1👍

modifying the webpack.config file

like

 var path = require('path')
 var webpack = require('webpack')
 module.exports = {
   entry: ['./src/main.js'],
   output: {
   path: path.resolve(__dirname, './dist'),
   publicPath: '/dist/',
   filename: 'build.js'
 },
 module: {
   rules: [
   {
      test: /\.css$/,
      use: [
      'vue-style-loader',
      'css-loader'
     ],
   },
   {
     test: /\.scss$/,
     use: [
      'vue-style-loader',
      'css-loader',
      'sass-loader'
    ],
  },
  {
    test: /\.sass$/,
    use: [
      'vue-style-loader',
      'css-loader',
      'sass-loader?indentedSyntax'
    ],
  },
  { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' },
  {
    test: /\.vue$/,
    loader: 'vue-loader',
    options: {
      loaders: {.
        'scss': [
          'vue-style-loader',
          'css-loader',
          'sass-loader'
        ],
        'sass': [
          'vue-style-loader',
          'css-loader',
          'sass-loader?indentedSyntax'
        ]
      }
      // other vue-loader options go here
    }
  },
  {
    test: /\.js$/,
    loader: 'babel-loader',
    include: [
      path.resolve(__dirname, "src"),
      path.resolve(__dirname, "node_modules/vuex-loading"),
      // path.resolve(__dirname, "node_modules/vue-authenticate")
    ],
  },
  {
    test: /\.(png|jpg|gif|svg)$/,
    loader: 'file-loader',
    options: {
      name: '[name].[ext]?[hash]'
    }
  }
  ]
},
 plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery',
      $t: 'VueI18n',
      $router: 'vue-router'
    })
  ],
resolve: {
  alias: {
   'vue$': 'vue/dist/vue.esm.js'
 },
 extensions: ['*', '.js', '.vue', '.json'],
 modules: [
  path.resolve('./src'),
  path.resolve('./node_modules')
 ]
},
devServer: {
  historyApiFallback: true,
  noInfo: true,
  overlay: true,
  inline:true,
  port: 8082
 },
 performance: {
  hints: false
 },
 devtool: '#eval-source-map'
}
}

Leave a comment