diff --git a/lib/core/index.js b/lib/core/index.js index 2e021a3fa3..01bb3a80e8 100644 --- a/lib/core/index.js +++ b/lib/core/index.js @@ -6,7 +6,8 @@ var axe = axe || {}; axe.version = '<%= pkg.version %>'; if (typeof define === 'function' && define.amd) { - define([], function () { + // Explicitly naming the module to avoid mismatched anonymous define() modules when injected in a page + define('axe-core', [], function () { 'use strict'; return axe; }); diff --git a/test/integration/full/umd/umd-define.js b/test/integration/full/umd/umd-define.js index 39d77f3a4b..9c93d5ea9e 100644 --- a/test/integration/full/umd/umd-define.js +++ b/test/integration/full/umd/umd-define.js @@ -6,8 +6,15 @@ describe('UMD define', function () { assert.equal(defineCalls.length, 1); var call = defineCalls[0]; - assert.isFunction(call[1]); - assert.strictEqual(call[1](), axe); + assert.isFunction(call[2]); + assert.strictEqual(call[2](), axe); + }); + + it('defines module name as axe-core', function () { + assert.equal(defineCalls.length, 1); + + var call = defineCalls[0]; + assert.equal(call[0], 'axe-core'); }); });