karma.base.config.js 989 B

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