Why is my intern test failing with “document is not defined”

后端 未结 1 1971
太阳男子
太阳男子 2020-12-20 00:13

I am new to Intern and struggling with trying to get a simple test to run in my environment. I was able to get the tutorial test to run but I\'ve tried to set up a test wher

相关标签:
1条回答
  • 2020-12-20 00:57

    It looks like you’re trying to load some code using the Node.js client that requires a browser environment. This won’t work. You should only load the ev/tests/FilterGrid test suite in a browser. You can do this by modifying your Intern configuration file to look something like this:

    define([ 'intern/node_modules/dojo/has' ], function (has) {
      var suites = [];
    
      if (has('host-browser')) {
        suites.push('ev/tests/FilterGrid');
      }
    
      return {
        // ...your existing configuration...
        suites: suites,
        // ...
      };
    });
    
    0 讨论(0)
提交回复
热议问题