karma.conf.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Karma configuration file, see link for more information
  2. // https://karma-runner.github.io/1.0/config/configuration-file.html
  3. process.env.CHROME_BIN = require('puppeteer').executablePath()
  4. module.exports = function (config) {
  5. config.set({
  6. basePath: '',
  7. frameworks: ['jasmine', '@angular-devkit/build-angular'],
  8. plugins: [
  9. require('karma-jasmine'),
  10. require('karma-chrome-launcher'),
  11. require('karma-jasmine-html-reporter'),
  12. require('karma-coverage-istanbul-reporter'),
  13. require('@angular-devkit/build-angular/plugins/karma')
  14. ],
  15. client: {
  16. clearContext: false // leave Jasmine Spec Runner output visible in browser
  17. },
  18. coverageIstanbulReporter: {
  19. dir: require('path').join(__dirname, '../coverage'),
  20. reports: ['html', 'lcovonly'],
  21. fixWebpackSourcePaths: true
  22. },
  23. reporters: ['progress', 'kjhtml'],
  24. port: 9876,
  25. colors: true,
  26. logLevel: config.LOG_INFO,
  27. autoWatch: true,
  28. browsers: ['ChromeHeadless'],
  29. customLaunchers: {
  30. ChromeHeadlessCI: {
  31. base: 'ChromeHeadless',
  32. flags: ['--no-sandbox']
  33. }
  34. },
  35. singleRun: false,
  36. // TODO: this whole "webpack" section is a hack to get around this issue with
  37. // the graphql-js lib: https://github.com/aws-amplify/amplify-js/issues/686#issuecomment-387710340
  38. // also: https://github.com/graphql/graphql-js/issues/1272
  39. // Once v14.0.0 is out it may be possible to remove it. Check that the apollo codegen
  40. // script still works (may need to upgrade apollo package too at that point)
  41. webpack: {
  42. module: {
  43. rules: [
  44. ...config.buildWebpack.webpackConfig.module.rules,
  45. {
  46. test: /\.mjs$/,
  47. include: /node_modules/,
  48. type: "javascript/auto",
  49. }
  50. ]
  51. }
  52. }
  53. });
  54. };