Skip to content

Commit

Permalink
[BUGFIX] reified should not be explicitly retained
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Jun 7, 2017
1 parent 2132baf commit 7c37574
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/loader/loader.js
Expand Up @@ -132,6 +132,7 @@ var loader, define, requireModule, require, requirejs;
this.reify();

var result = this.callback.apply(this, this.reified);
this.reified.length = 0;
this.state = 'finalized';

if (!(this.hasExportsAsDep && result === undefined)) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -21,6 +21,7 @@
"testem": "^1.0.0"
},
"scripts": {
"build": "node build",
"test": "testem ci && jshint lib tests && jscs lib tests",
"test:dev": "testem",
"prepublish": "./build.js"
Expand Down
11 changes: 11 additions & 0 deletions tests/all.js
Expand Up @@ -1580,6 +1580,17 @@ test('redefining a module when "pending" should no-op', function(assert) {
assert.notOk(second, 'second module definition never used');
});

test('reify should release', function(assert) {
define('foo', ['bar'], function() { });
define('bar', ['bar'], function() { });

require('foo');
require('bar');

assert.deepEqual(require.entries['foo'].reified, []);
assert.deepEqual(require.entries['bar'].reified, []);

});
test('redefining a module when "reifying" should no-op', function(assert) {
var first = false;
var second = false;
Expand Down

0 comments on commit 7c37574

Please sign in to comment.