"TypeError: deps.map is not a function" importing URI.js from intern.js unit tests

320 Views Asked by At

I am getting a build error when trying to use URI.js from intern.js unit tests. I saw "TypeError: deps.map is not a function" in resolveDepMaps() of node_modules/dojo/dojo.js but none of the answers seem to apply to my case.

Any ideas?

1

There are 1 best solutions below

0
On BEST ANSWER

Quoting jason0x43:

One of the dependencies in the attached project, punycode, uses an AMD define call of the form define(id, factory). This is a case that isn't currently handled by Intern's internal loader.

The easiest fix would be to use an alternative AMD loader for tests, such as the normal Dojo loader or RequireJS. For example, to use requirejs, install requirejs as a project dependency and add the following property to the test config:

loaders: {
    'host-node': '../../node_modules/requirejs'
},

This workaround fixed the problem for me.