Running intern with PhantomJS: window is undefined

I've followed all the steps described here: https://github.com/theintern/intern/wiki/Using-Intern-with-PhantomJS

My intern config is ~ as follows:

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)/
});

I run phantomJS with

.\node_modules\.bin\phantomjs --webdriver 4444 --webdriver-loglevel='debug' 

and it listens on 4444.

I even disabled Windows Firewall, but still I get

ReferenceError: window is not defined
    at ***.js:348:142
    at Function.vm.runInThisContext (***\node_modules\intern\node_modules\istanbul\lib\hook.js:163:16)
    at ***\node_modules\intern\node_modules\dojo\dojo.js:757:8
    at fs.js:266:14
    at Object.oncomplete (fs.js:107:15)

as though Intern is running on node, not in Phatom. Phantom's console is also completely silent.

What am I missing? Or is there a way to debug Intern's actions? Thx

Answers


OK, I've finally figured this out.

I've been running intern using

.\node_modules\.bin\intern-client config=test/intern

while it should've been

.\node_modules\.bin\intern-runner config=test/intern

Thing is that intern-runner and intern-client are two different applications, one is for running with browsers via WebDriver, the other one for running with Node. It didn't catch my eye even though I was reading and re-reading the docs much more than once. Probably the distinction should be highlighted there.

Hope this helps someone )


Need Your Help

Calling Watson Personality Insights from localhost

node.js ibm-cloud ibm-watson personality-insights

I have already downloaded Personality Insights from Bluemix,and I can run it on my command line successfully, but how can i insert it on my webpage and run it locally?