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 ); 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` `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 assert = require( 'assert' );
var warned;
module.exports = { module.exports = {
description: 'resolves pathological cyclical dependencies gracefully', description: 'resolves pathological cyclical dependencies gracefully',
babel: true, babel: true,
exports: function ( exports ) { options: {
assert.ok( exports.a.isA ); onwarn: function ( message ) {
assert.ok( exports.b1.isA ); 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 ) );
assert.ok( exports.b1.isB ); warned = true;
assert.ok( exports.b2.isA ); }
assert.ok( exports.b2.isB ); },
assert.ok( exports.c1.isC ); runtimeError: function () {
assert.ok( exports.c1.isD ); assert.ok( warned );
assert.ok( exports.c2.isC );
assert.ok( exports.c2.isD );
assert.ok( exports.d.isD );
} }
}; };

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

@ -1,15 +1,16 @@
var assert = require( 'assert' ); var assert = require( 'assert' );
var warned;
module.exports = { module.exports = {
description: 'does not treat references inside IIFEs as weak dependencies', // edge case encountered in THREE.js codebase description: 'does not treat references inside IIFEs as weak dependencies', // edge case encountered in THREE.js codebase
exports: function ( exports ) { options: {
assert.ok( exports.a1.isA ); onwarn: function ( message ) {
assert.ok( exports.b1.isB ); 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 ) );
assert.ok( exports.c1.isC ); warned = true;
assert.ok( exports.d1.isD ); }
assert.ok( exports.a2.isA ); },
assert.ok( exports.b2.isB ); runtimeError: function () {
assert.ok( exports.c2.isC ); assert.ok( warned );
assert.ok( exports.d2.isD );
} }
}; };

Loading…
Cancel
Save