I'm getting this error when I'm trying to run Angular in jsdom.
``` D:\Web\GitHub\angular-test-examples\node_modules\angular\angular.js:2789
var jqLiteContains = Node.prototype.contains || function(arg) {
^
ReferenceError: Node is not defined
``` javascript
'use strict';
var jsdom = require('jsdom').jsdom;
var document = global.document = jsdom('<html><head></head><body></body></html>');
var window = global.window = document.defaultView;
global.navigator = window.navigator = {};
window.mocha = {};
window.beforeEach = global.beforeEach;
window.afterEach = global.afterEach;
require('angular');
Doesn't that mean jsdom doesn't provide the Node global?
Yeah. I provided Node and it worked.
I am new to this, how do you set Node in jsdom?
Just install lower than 1.4.8 angular version, then it should work.
Is there a fix for angular 1.5.7
Just make sure Node is available on window.
@gkalpak Can you give an example for that? How do we be sure that Node is available on window?
@ankakusu , it depends on where the problem comes from. Usually window.Node is available in all browser environments.
E.g. @mato75's problem was that they were trying to use Angular in the context of a web worker (see https://github.com/angular/angular.js/issues/13442#issuecomment-233558421). Other people had similar problems when using jsDom (and not configuring it properly.
Normally, there shouldn't be an issue with window.Node. If you have problems, you need to find out what causes it.
Most helpful comment
@ankakusu , it depends on where the problem comes from. Usually
window.Nodeis available in all browser environments.E.g. @mato75's problem was that they were trying to use Angular in the context of a web worker (see https://github.com/angular/angular.js/issues/13442#issuecomment-233558421). Other people had similar problems when using
jsDom(and not configuring it properly.Normally, there shouldn't be an issue with
window.Node. If you have problems, you need to find out what causes it.