我是实习生的新手,正在努力尝试在我的环境中运行一个简单的测试。我能够让教程测试运行,但我试图设置一个测试,其中测试文件位于我的应用程序目录层次结构中。正在测试的模块位于此处:
sandbox/web/libs/ev/grids/FilterGrid.js
测试文件位于此处:
sandbox/web/libs/ev/tests/FilterGrid.js
我的实习生配置文件位于此处:
sandbox/tests/intern.js
我的加载器和套件对象如下所示:
loader: {
packages: [
{ name: 'dojo', location: 'web/libs/dojo' },
{ name: 'dijit', location: 'web/libs/dijit },
{ name: 'dgrid', location: 'web/libs/dgrid' },
{ name: 'put-selector', location: 'web/libs/put-selector' },
{ name: 'xstyle', location: 'web/libs/xstyle' },
{ name: 'ev', location: 'web/libs/ev' }
]
},
suites: ['ev/tests/FilterGrid'],
当加载器尝试加载它时,我得到:
Defaulting to "console" reporter
ReferenceError: document is not defined
at /home/bholm/Projects/src/sandbox/web/libs/dojo/selector/_loader.js:5:15
at execModule (/home/bholm/Projects/src/sandbox/node_modules/intern/node_module
/dojo/dojo.js:512:54)
at /home/bholm/Projects/src/sandbox/node_modules/intern/node_modules/dojo/dojo.js:579:7
at guardCheckComplete (/home/bholm/Projects/src/sandbox/node_modules/intern/node_modules/dojo/dojo.js:563:4)
at checkComplete (/home/bholm/Projects/src/sandbox/node_modules/intern/node_modules/dojo/dojo.js:571:27)
at onLoadCallback (/home/bholm/Projects/src/sandbox/node_modules/intern/node_modules/dojo/dojo.js:653:7)
at /home/bholm/Projects/src/sandbox/node_modules/intern/node_modules/dojo/dojo.js:746:5
at fs.js:266:14
at Object.oncomplete (fs.js:107:15)
使用 Intern 的单元测试是否需要定义 DOM 文档?我还注意到 Intern 将 dojo2_core 列为依赖项。所以它使用的是未发布的代码?
对此的任何帮助将不胜感激!