diff --git a/require.js b/require.js index 9062d9a..af1ad95 100644 --- a/require.js +++ b/require.js @@ -756,8 +756,9 @@ function _resolveTree(args) { // If we've traversed an unreasonable number of nodes, there's probably a cycle. if (++numberOfTraversedNodes > MAX_TRAVERSAL) { throw new Error( - 'Traversed too many nodes in the dependency tree. Possible cycle at ' + 'Traversed too many nodes in the dependency tree. Possible cycle at module ' + (currentNode.fullModulePath || currentNode.modulePath) + + ' or at a related module.' ); } } diff --git a/test/test.js b/test/test.js index ba9b8e8..538f81b 100644 --- a/test/test.js +++ b/test/test.js @@ -970,7 +970,7 @@ QUnit.test('dependency loops', function(assert) { assert.raises(function(){ require('10-a'); - }, /Traversed too many nodes in the dependency tree. Possible cycle at /, 'dependency loop throws error'); + }, /Traversed too many nodes in the dependency tree. Possible cycle at module .+ or at a related module\./, 'dependency loop throws error'); define('10-d', function() { return {}; }); define('10-e', ['10-d', '10-f'], function() { return {}; }); @@ -979,7 +979,7 @@ QUnit.test('dependency loops', function(assert) { assert.raises(function(){ require('10-e'); - }, /Traversed too many nodes in the dependency tree. Possible cycle at /, 'dependency loop with other dependencies throws error'); + }, /Traversed too many nodes in the dependency tree. Possible cycle at module .+ or at a related module\./, 'dependency loop with other dependencies throws error'); });