Browse Source

update tests

gh-438-b
Rich-Harris 9 years ago
parent
commit
dee23e9bc4
  1. 2
      src/Bundle.js
  2. 21
      test/function/cycles-pathological/_config.js
  3. 19
      test/function/iife-strong-dependencies/_config.js

2
src/Bundle.js

@ -345,7 +345,7 @@ export default class Bundle {
findParent( this.entryModule );
throw new Error(
this.onwarn(
`Module ${a.id} may be unable to evaluate without ${b.id}, but is included first due to a cyclical dependency. Consider swapping the import statements in ${parent} to ensure correct ordering`
);
}

21
test/function/cycles-pathological/_config.js

@ -1,18 +1,17 @@
var assert = require( 'assert' );
var warned;
module.exports = {
description: 'resolves pathological cyclical dependencies gracefully',
babel: true,
exports: function ( exports ) {
assert.ok( exports.a.isA );
assert.ok( exports.b1.isA );
assert.ok( exports.b1.isB );
assert.ok( exports.b2.isA );
assert.ok( exports.b2.isB );
assert.ok( exports.c1.isC );
assert.ok( exports.c1.isD );
assert.ok( exports.c2.isC );
assert.ok( exports.c2.isD );
assert.ok( exports.d.isD );
options: {
onwarn: function ( message ) {
assert.ok( /Module .+B\.js may be unable to evaluate without .+A\.js, but is included first due to a cyclical dependency. Consider swapping the import statements in .+main\.js to ensure correct ordering/.test( message ) );
warned = true;
}
},
runtimeError: function () {
assert.ok( warned );
}
};

19
test/function/iife-strong-dependencies/_config.js

@ -1,15 +1,16 @@
var assert = require( 'assert' );
var warned;
module.exports = {
description: 'does not treat references inside IIFEs as weak dependencies', // edge case encountered in THREE.js codebase
exports: function ( exports ) {
assert.ok( exports.a1.isA );
assert.ok( exports.b1.isB );
assert.ok( exports.c1.isC );
assert.ok( exports.d1.isD );
assert.ok( exports.a2.isA );
assert.ok( exports.b2.isB );
assert.ok( exports.c2.isC );
assert.ok( exports.d2.isD );
options: {
onwarn: function ( message ) {
assert.ok( /Module .+D\.js may be unable to evaluate without .+C\.js, but is included first due to a cyclical dependency. Consider swapping the import statements in .+main\.js to ensure correct ordering/.test( message ) );
warned = true;
}
},
runtimeError: function () {
assert.ok( warned );
}
};

Loading…
Cancel
Save