I am trying to use Intern to unit test one of my modules, tested.js
, which has a dependency on another module, dependency.js
. Because I am using Browserify, tested.js
includes the line:
var dep = require('./lib/dependency.js');
Intern throws the following error:
Warning: Error: Attempt to require unloaded module lib/dependency.js
This is the start of my test file:
define([
'intern!object',
'intern/chai!assert',
'src/js/tested'
], function (registerSuite, assert, tested) {
registerSuite({
// ...
My Intern config file uses the default Dojo loader. I have tried using RequireJS instead but couldn't make it work properly (it seems that Intern has some ongoing issues with using alternative AMD loaders: https://github.com/theintern/intern/issues/147, https://github.com/theintern/intern/pull/132#issuecomment-33403157).
How can I get Intern to properly load the required dependency?
EDIT: I'm using grunt-browserify, but I'm unit-testing the un-Browserified module- I only mentioned Browserify to explain why I am using "require".