我已经遵循了这里描述的所有步骤:https://github.com/theintern/intern/wiki/Using-Intern-with-PhantomJS
我的实习生配置是~,如下所示:
define({
proxyPort: 9000,
proxyUrl: 'http://localhost:9000/',
environments: [
{ browserName: 'phantom' }
],
maxConcurrency: 3,
useSauceConnect: false,
webdriver: {
host: 'localhost',
port: 4444
},
reporters: ['runner'],
useLoader: {
'host-node': 'dojo/dojo',
'host-browser': 'node_modules/dojo/dojo.js'
},
loader: {
packages: [
{ name: 'myApp', location: '...' }
],
baseUrl: '...',
paths: {...}
},
suites: [
'test/hello'
],
functionalSuites: [],
excludeInstrumentation: /(^test(/|\)|reporters|node_modules)/
});
我用
运行phantomJS.node_modules.binphantomjs --webdriver 4444 --webdriver-loglevel='debug'
,监听4444。
我甚至禁用了Windows防火墙,但我仍然得到
ReferenceError: window is not defined
at ***.js:348:142
at Function.vm.runInThisContext (***node_modulesinternnode_modulesistanbullibhook.js:163:16)
at ***node_modulesinternnode_modulesdojodojo.js:757:8
at fs.js:266:14
at Object.oncomplete (fs.js:107:15)
好像Intern运行在node上,而不是在Phatom上。魅影的控制台也是完全静音的。
我错过了什么?或者有一种方法来调试实习生的行为?Thx
好了,我终于想通了。
我一直在使用
运行实习生.node_modules.binintern-client config=test/intern
而它应该是
.node_modules.binintern-runner config=test/intern
问题是intern-runner和intern-client是两个不同的应用程序,一个是通过WebDriver在浏览器上运行,另一个是通过Node运行。它没有引起我的注意,即使我读了一遍又一遍的文件。也许应该在这里强调区别。