Unable to load modules for testing Intern when using Browserify

I'm trying to use the Intern for a unit test one of my modules, tested.jswhich has a dependency on another module dependency.js. Since I use Browserify, it tested.jsincludes the line:

var dep = require('./lib/dependency.js');

The following error is issued by the Internet:

Warning: Error: Attempt to require unloaded module lib/dependency.js

This is the beginning of my test file:

define([

    'intern!object',

    'intern/chai!assert',

    'src/js/tested'

], function (registerSuite, assert, tested) {

    registerSuite({
            // ... 

My Intern config uses the default Dojo bootloader. I tried using RequireJS instead, but could not get it to work properly (Intern seems to have some current problems using alternative AMD bootloaders: https://github.com/theintern/intern/issues/147 , https: / /github.com/theintern/intern/pull/132#issuecomment-33403157 ).

Intern ?

EDIT: grunt-browsify, - Browserify, , "require".

+3
1

CJS/ Node.js Browserify; Browserify. , AMD CJS -, " ".

CJS Node.js Intern, intern/dojo/node :

define([

    'intern!object',

    'intern/chai!assert',

    'intern/dojo/node!src/js/tested'

], function (registerSuite, assert, tested) {

    registerSuite({
            // ... 

AMD .

+4

All Articles