karma.conf.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. const dataFiles = [
  2. 'test/images/*.jpg',
  3. 'test/images/*.png',
  4. 'test/data/*.json',
  5. 'test/data/*.weights',
  6. 'test/media/*.mp4',
  7. 'weights/**/*',
  8. 'weights_uncompressed/**/*',
  9. 'weights_unused/**/*'
  10. ].map(pattern => ({
  11. pattern,
  12. watched: false,
  13. included: false,
  14. served: true,
  15. nocache: false
  16. }))
  17. let exclude = (
  18. process.env.UUT
  19. ? [
  20. 'dom',
  21. 'faceLandmarkNet',
  22. 'faceRecognitionNet',
  23. 'ssdMobilenetv1',
  24. 'tinyFaceDetector'
  25. ]
  26. : []
  27. )
  28. .filter(ex => ex !== process.env.UUT)
  29. .map(ex => `test/tests/${ex}/*.ts`)
  30. // exclude nodejs tests
  31. exclude = exclude.concat(['**/*.node.test.ts'])
  32. exclude = exclude.concat(['test/env.node.ts'])
  33. exclude = exclude.concat(['test/tests-legacy/**/*.ts'])
  34. module.exports = function(config) {
  35. const args = []
  36. if (process.env.BACKEND_CPU) {
  37. args.push('backend_cpu')
  38. }
  39. config.set({
  40. frameworks: ['jasmine', 'karma-typescript'],
  41. files: [
  42. 'src/**/*.ts',
  43. 'test/**/*.ts'
  44. ].concat(dataFiles),
  45. exclude,
  46. preprocessors: {
  47. '**/*.ts': ['karma-typescript']
  48. },
  49. karmaTypescriptConfig: {
  50. tsconfig: 'tsconfig.test.json'
  51. },
  52. browsers: ['Chrome'],
  53. browserNoActivityTimeout: 120000,
  54. browserDisconnectTolerance: 3,
  55. browserDisconnectTimeout : 120000,
  56. captureTimeout: 60000,
  57. client: {
  58. jasmine: {
  59. timeoutInterval: 60000,
  60. args
  61. }
  62. }
  63. })
  64. }