karma.base.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. module: {
  7. rules: [
  8. {
  9. test: /\.js$/,
  10. loader: 'babel-loader',
  11. exclude: /node_modules/
  12. },
  13. {
  14. test: /\.tsx?$/,
  15. exclude: /node_modules/,
  16. loader: 'ts-loader',
  17. },
  18. ]
  19. },
  20. resolve: {
  21. alias: alias,
  22. extensions: ['.tsx', '.ts', '.js'],
  23. },
  24. plugins: [
  25. new webpack.DefinePlugin({
  26. __WEEX__: false,
  27. 'process.env': {
  28. TRANSITION_DURATION: process.env.CI ? 100 : 50,
  29. TRANSITION_BUFFER: 10,
  30. ...featureFlags
  31. }
  32. })
  33. ],
  34. devtool: '#inline-source-map'
  35. }
  36. // shared config for all unit tests
  37. module.exports = {
  38. frameworks: ['jasmine'],
  39. files: [
  40. './index.js'
  41. ],
  42. preprocessors: {
  43. './index.js': ['webpack', 'sourcemap']
  44. },
  45. webpack: webpackConfig,
  46. webpackMiddleware: {
  47. noInfo: true
  48. },
  49. plugins: [
  50. 'karma-jasmine',
  51. 'karma-mocha-reporter',
  52. 'karma-sourcemap-loader',
  53. 'karma-webpack'
  54. ]
  55. }