The answer to this question does not answer my question.
I'd like to load dependencies from outside my project root using the Intern as my testing framework. I'm currently working with the following directory structure:
www/
project1/
app/
lib/
project2/
app/
lib/
intern-tests/
node_modules/
tests/
functional/
project1-tests/
project2-tests/
unit/
project1-tests/
project2-tests/
intern.js
Gruntfile.js
As you can see, I am making intern-tests
its own project, and want this directory to hold all my tests for all of my projects. I've already set up my Gruntfile to execute tests with the grunt exec library converting the grunt projectName
command to grunt test --project=projectName
. All that works fine, but my unit tests cannot load the dependencies in the project1/
and project2/
directories.
For example, this is one of my unit tests:
define([
'intern!object',
'intern/chai!assert',
'jquery',
'../../../../project2/lib/js/var/document',
'../../../../project2/lib/js/exports/file/functions/resizeInput'
], function(registerSuite, assert, $, document, resizeInput) {
registerSuite({
name: 'functions',
resizeInput: function() {
var $input = $(document.createElement('input'));
resizeInput($input, 8, 20, 450, 200);
assert.equal($input.width(), 450);
}
});
});
and running that test gives me the following error:
SUITE ERROR
Error: Failed to load module ../project2/lib/js/var/document from
project2/lib/js/var/document.js (parent: tests/unit/project2/functions)
at HTMLScriptElement.handler <__intern\node_modules\dojo\loader.js:517:27>
How can I include these external files from my other projects?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With