POST
|
Right after I posted this I was able to get this working. Just to post in case someone else runs into this problem, the error I got was: Suite chrome 67.0.3396.87 on Windows NT FAILED Error: scriptError at makeError <node_modules\dojo\dojo.js:125:15> at HTMLScriptElement.<anonymous> <node_modules\dojo\dojo.js:1752:21> In short, the problem is caused because Intern fails to resolve a path it was pointed to. I ran into this when I gave the "suites" property a specific file with an extension (should be "myTest", not "myTest.js") and when Intern could find a copy of dojo for use during testing, which is separate from the dojo library used for the Intern loader (further explained below). This problem may appear to be caused by the dojo Intern loader, but actually is not. You can test this by creating and running a blank dojo loaded test, one with no AMD dependencies: define([
],
function (
) {
var registerSuite = intern.getInterface("object").registerSuite;
var assert = intern.getPlugin("chai").assert;
registerSuite('Component', {
tests: {
'Is intern dojo working?'() {
assert.ok(true);
}
}
});
}); As is described in this article, the dojo library used by the Intern dojo loader in your intern.json file is distinct from the dojo library used by your injected packages in tests (Dojo FAQ: How can I run Dojo tests locally with Intern? - Blog | SitePen ). So, you must be sure that the path you provide in the "packages" intern.json object for dojo is accurate from the directory structure where intern is executing, not from the directory structure that might be used to resolve dojo in a deployed WAB instance. For most people, this would be in node_modules but things can get tricky in Web App Builder. In my case, that meant manually copying the arcgis API libraries (including dojo) into a directory where they would be available to intern: myproject/
-app/
--arcgis-js-api-3.24/
---dojo/
---esri/
---and others/
-tests/
--tests go here
-src
intern.json And my intern.json (my problem was caused by the "dojo" entry not actually pointing at this local copy of the dojo library, which caused tests with an injected Class with dojo as a dependency not to to be able to retrieve dojo): {
"suites": ["tests/myTest"],
"tunnelOptions": {
"drivers": ["chrome"]
},
"loader": {
"script": "dojo",
"options": {
"async": true,
"tlmSiblingOfDojo": false,
"has": {
"extend-esri": 1
},
"packages": [{
"name": "dojo",
"location": "apps/arcgis-js-api-3.24/dojo"
}, {
"name": "dijit",
"location": "apps/arcgis-js-api-3.24/dijit"
}, {
"name": "dojox",
"location": "apps/arcgis-js-api-3.24/dojox"
}, {
"name": "esri",
"location": "apps/arcgis-js-api-3.24/esri"
}, {
"name": "src",
"location": "src"
}, {
"name": "tests",
"location": "tests"
}, {
"name": "apps",
"location": "apps"
}]
}
},
"environments": [{
"browserName": "chrome",
"fixSessionCapabilities": "no-detect",
"chromeOptions": {
"args": ["headless", "disable-gpu"]
}
}],
"coverage": false,
"debug": false
} I hope this helps someone who runs into a similar issue getting unit tests running in WAB.
... View more
06-15-2018
11:58 AM
|
0
|
0
|
1035
|
POST
|
Did you ever find a solution to this? I am also trying to get Intern to work with a WAB project and am running into the exact same problem.
... View more
06-15-2018
10:20 AM
|
0
|
2
|
1035
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|