Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.85 KB | None | 0 0
  1. var webpack = require("webpack");
  2. module.exports = function(config) {
  3.  
  4. var appBase = 'src/'; // transpiled app JS and map files
  5. var appSrcBase = appBase; // app source TS files
  6.  
  7. // Testing helpers (optional) are conventionally in a folder called `testing`
  8. var testingBase = '/'; // transpiled test JS and map files
  9. var testingSrcBase = '/'; // test source TS files
  10. var path = require('path');
  11. var webpackConfig = require('./webpackhbjjh.config');
  12. var entry = path.resolve(webpackConfig.context, webpackConfig.entry);
  13. var preprocessors = {};
  14. preprocessors[entry] = ['webpack'];
  15. var es2015 = require('babel-preset-es2017');
  16.  
  17. config.set({
  18. basePath: '',
  19. frameworks: ['jasmine'],
  20.  
  21. plugins: [
  22. 'karma-babel-preprocessor',
  23. require('karma-webpack'),
  24. 'babelify',
  25. require('karma-jasmine'),
  26. require('babelify'),
  27. require('browserify'),
  28. require('karma-chrome-launcher'),
  29. require('karma-jasmine-html-reporter'),
  30. ],
  31. webpack: webpackConfig,
  32. webpackMiddleware: {
  33. noInfo:true
  34. },
  35. client: {
  36. builtPaths: [appBase, testingBase], // add more spec base paths as needed
  37. clearContext: false // leave Jasmine Spec Runner output visible in browser
  38. },
  39.  
  40. customLaunchers: {
  41. // From the CLI. Not used here but interesting
  42. // chrome setup for travis CI using chromium
  43. Chrome_travis_ci: {
  44. base: 'Chrome',
  45. flags: ['--no-sandbox']
  46. }
  47. },
  48.  
  49. files: [
  50. // System.js for module loading
  51. 'node_modules/systemjs/dist/system.src.js',
  52.  
  53. // Polyfills
  54. 'node_modules/core-js/client/shim.js',
  55.  
  56. // zone.js
  57. 'node_modules/zone.js/dist/zone.js',
  58. 'node_modules/zone.js/dist/long-stack-trace-zone.js',
  59. 'node_modules/zone.js/dist/proxy.js',
  60. 'node_modules/zone.js/dist/sync-test.js',
  61. 'node_modules/zone.js/dist/jasmine-patch.js',
  62. 'node_modules/zone.js/dist/async-test.js',
  63. 'node_modules/zone.js/dist/fake-async-test.js',
  64. 'node_modules/zone.js/dist/fake-async-test.js',
  65. 'test-main.js',
  66. 'node_modules/karma-typescript-angular2-transform/src/test/transform.spec.ts',
  67. 'node_modules/angular-2-local-storage/dist/**/*.js',
  68. 'node_modules/moment/**/*.js',
  69.  
  70. // RxJs
  71. { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
  72. { pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
  73.  
  74. // Paths loaded via module imports:
  75. // Angular itself
  76. { pattern: 'node_modules/@angular/**/*.js', included: false, watched: false },
  77. { pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false },
  78.  
  79. { pattern: appBase + '/systemjs.config.js', included: false, watched: false },
  80. { pattern: appBase + '/systemjs.config.extras.js', included: false, watched: false },
  81. 'karma-test-shim.js', // optionally extend SystemJS mapping e.g., with barrels
  82.  
  83. // transpiled application & spec code paths loaded via module imports
  84. { pattern: appBase + '**/*.js', included: false, watched: true },
  85. { pattern: testingBase + '**/*.js', included: false, watched: true },
  86.  
  87.  
  88. // Asset (HTML & CSS) paths loaded via Angular's component compiler
  89. // (these paths need to be rewritten, see proxies section)
  90. { pattern: appBase + '**/*.html', included: false, watched: true },
  91. { pattern: appBase + '**/*.css', included: false, watched: true },
  92.  
  93. // Paths for debugging with source maps in dev tools
  94. { pattern: appBase + '**/*.ts', included: false, watched: false },
  95. { pattern: appBase + '**/*.js.map', included: false, watched: false },
  96. { pattern: testingSrcBase + '**/*.ts', included: false, watched: false },
  97. { pattern: testingBase + '**/*.js.map', included: false, watched: false}
  98. ],
  99.  
  100. // Proxied base paths for loading assets
  101. proxies: {
  102. // required for modules fetched by SystemJS
  103. '/base/src/node_modules/': '/base/node_modules/'
  104. },
  105. preprocessors: {
  106. '**/*.spec.ts': ['webpack'],
  107. 'node-modules/moment*/**/*.js': ['webpack'],
  108. 'node-modules/babel*/**/*.js': ['webpack'],
  109. 'node-modules/karma*/**/*.js': ['webpack'],
  110. 'node-modules/rxjs/**/*.js': ['webpack'],
  111. 'node-modules/ts*/**/*.js': ['webpack'],
  112. 'node-modules/uuid*/**/*.js': ['webpack'],
  113. 'node-modules/node-uuid/**/*.js': ['webpack'],
  114. },
  115. exclude: [],
  116. reporters: ['progress', 'kjhtml'],
  117. browserify: {
  118. debug: true,
  119. extensions: ['.js', '.json', '.ts'],
  120. transform: [['babelify',{presets: [es2015]},{presets: ["es6"]}
  121. ]],
  122. plugin: ['tsify']
  123. },
  124. port: 9876,
  125. colors: true,
  126. logLevel: config.LOG_INFO,
  127. autoWatch: true,
  128. browsers: ['Chrome'],
  129. singleRun: false
  130. })
  131. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement