Skip to content

Commit

Permalink
Merge branch 'fix-979-module.exports' of github.com:arian/requirejs i…
Browse files Browse the repository at this point in the history
…nto arian-fix-979-module.exports
  • Loading branch information
jrburke committed Jan 4, 2014
2 parents 80a9ee8 + fef207e commit bb13c3a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion require.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ var requirejs, require, define;
getOwn(config.config, mod.map.id);
return c || {};
},
exports: defined[mod.map.id]
exports: handlers.exports(mod)
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ doh.registerUrl("skipDataMain", "../dataMain/skipDataMain/skipDataMain.html");
doh.registerUrl("dataMainIndex", "../dataMain/dataMainIndex/dataMainIndex.html");
doh.registerUrl("dataMainBaseUrl", "../dataMain/baseUrl/dataMainBaseUrl.html");

doh.registerUrl("moduleExports", "../commonjs/tests/modules/1.0/moduleExports/program.html");

if (hasToString) {
doh.registerUrl("anonSimple", "../anon/anonSimple.html");
doh.registerUrl("cjsSpace", "../cjsSpace/cjsSpace.html");
Expand Down
20 changes: 20 additions & 0 deletions tests/commonjs/tests/modules/1.0/moduleExports/program.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>Program Runner</title>
<script src="../../../../../../require.js"></script>
<script>
require({
baseUrl: './',
paths: {
system: '../system',
test: '../test'
}
}, ['program']);
</script>
</head>
<body>
<h1>Program Runner</h1>
<p>Check console for results.</p>
</body>
</html>
5 changes: 5 additions & 0 deletions tests/commonjs/tests/modules/1.0/moduleExports/program.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
define(["module", "exports", "test"], function(module, exports, test) {
test.assert(module.exports === exports, 'exports equals module.exports');
test.print('DONE', 'info');

});
18 changes: 18 additions & 0 deletions tests/commonjs/tests/modules/1.0/moduleExports/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
define(["require", "exports", "module", "system"], function(require, exports, module) {

exports.print = typeof print !== "undefined" ? print : function () {
var system = require("system");
var stdio = system.stdio;
stdio.print.apply(stdio, arguments);
};

exports.assert = function (guard, message) {
if (guard) {
exports.print('PASS ' + message, 'pass');
} else {
exports.print('FAIL ' + message, 'fail');
}
};


});

0 comments on commit bb13c3a

Please sign in to comment.