0

We have tried to implement Istanbul and Karma both in separate workspaces.

Istanbul:- We have installed nyc packages to run test cases. After that when we run nyc qunit, we are getting below error in config.js file. not ok 1 test\config.js > Failed to load the test file with error: ReferenceError: requirejs is not defined

For Karma: In other case with Karma, Here also I am getting error of requirejs is not defined, config.js file is not required when we are working with Karma. Here we are getting an error in the main.js file. Its not accepting import statement "import ../src/js/tests/unit/align.js" I tried to use require instead of import but again its giving error (convert to ES6 module)

For test runner we are using puppeteer, But i am not sure if we can see code coverage with puppeteer

  • Very good example: https://www.testim.io/blog/qunit-code-coverage/ – Nadeem Taj Aug 25 '21 at 18:08
  • i have tried this example . But i am facing error with this like requirejs is not defined in config.js file. I have included requirejs in index.html as global module // Init RequireJS. requirejs.config({ 'baseUrl': '/src/js', 'paths': paths, urlArgs: 'v=' + (new Date()).getTime() }); – suresh sangra Aug 26 '21 at 04:18
  • Share exact error please. – Nadeem Taj Aug 26 '21 at 04:20
  • not ok 1 test\config.js > Failed to load the test file with error: ReferenceError: requirejs is not defined at Object. (C:\Users\suresh.kumar\Documents\test-nyc\editor-project\test\config.js:8:1) – suresh sangra Aug 26 '21 at 05:21
  • // this is config.js file. var paths = { 'app': '/test/app', 'fa': '/test/fa' }; // Init RequireJS. requirejs.config({ 'baseUrl': '/src/js', 'paths': paths, urlArgs: 'v=' + (new Date()).getTime() }); – suresh sangra Aug 26 '21 at 05:22
  • // index.html file – suresh sangra Aug 26 '21 at 05:23

0 Answers0