karma.base.config.js 904 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const alias = require('../../scripts/alias')
  2. const webpack = require('webpack')
  3. const webpackConfig = {
  4. mode: 'development',
  5. resolve: {
  6. alias: alias
  7. },
  8. module: {
  9. rules: [
  10. {
  11. test: /\.js$/,
  12. loader: 'babel-loader',
  13. exclude: /node_modules/
  14. }
  15. ]
  16. },
  17. plugins: [
  18. new webpack.DefinePlugin({
  19. __WEEX__: false,
  20. 'process.env': {
  21. TRANSITION_DURATION: process.env.CI ? 100 : 50,
  22. TRANSITION_BUFFER: 10
  23. }
  24. })
  25. ],
  26. devtool: '#inline-source-map'
  27. }
  28. // shared config for all unit tests
  29. module.exports = {
  30. frameworks: ['jasmine'],
  31. files: [
  32. './index.js'
  33. ],
  34. preprocessors: {
  35. './index.js': ['webpack', 'sourcemap']
  36. },
  37. webpack: webpackConfig,
  38. webpackMiddleware: {
  39. noInfo: true
  40. },
  41. plugins: [
  42. 'karma-jasmine',
  43. 'karma-mocha-reporter',
  44. 'karma-sourcemap-loader',
  45. 'karma-webpack'
  46. ]
  47. }