Uncaught SyntaxError: Unexpected token 'export' - Karma config setup - Angular.js 1.x - javascript

625 views Asked by At

What needs to be changed in below karma.config in order to resolve below error

 module.exports = function(config) {
config.set({
    basePath: '',
    frameworks: ['jasmine'],
    files: [
        
       // 'node_modules/@zxing/library/*.js'
       // 'assets/@zxing/library/esm/browser/BrowserMultiFormatReader.js'
       'assets/@zxing/library/*.js',
    ],

    exclude: [
        "assets/other.min.js"
    ],
    preprocessors: {
        'app/**/*.html': "ng-html2js",
        'app/views/**/!(*spec).js': ['coverage']
    },

    reporters: ['progress', 'html', 'coverage'],
    port: 3000,
    colors: true,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: true,
    concurrency: Infinity,
    coverageReporter : {
      type : 'html',
      dir : 'coverage/',
      subdir: '.',
      check: {
            global: {
                ....,
                .....
            },
            each: {
               ....,
               ....
            }
        }
    },
    htmlReporter: {
        outputDir: 'karma_html',
        namedFiles: true, 
        reportName: 'sample_spec_report' 
    }
})

}

error

Chrome 85.0.4183 (Windows 10.0.0) ERROR
  Uncaught SyntaxError: Unexpected token 'export'
  at assets/@zxing/library/esm/browser.js:2

Chrome 85.0.4183 (Windows 10.0.0) ERROR
  Uncaught SyntaxError: Unexpected token 'export'
  at assets/@zxing/library/esm/browser.js:2

JavaScript Test Case Exit Code 1
JavaScript Test Case Fails

I'm, trying to make use of zxing.js in my Angular.1x app. MY CI/CD getting failed due to this error. library is working properly inside the app. im facing this issue the moment I use gulp karmaRunDebug. So need experts advice to resolve this. I'm struggling to fix this problem for past two.

I've no clue what needs to be done as am completely new setting up gulp and karma test environment.

zxing -> library

Thanks

0

There are 0 answers