Skip to content

Commit

Permalink
Support AMD "module" import in slim builds
Browse files Browse the repository at this point in the history
Closes #845
  • Loading branch information
m-mujica committed Sep 27, 2017
1 parent 072cbf2 commit 137a64e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -32,7 +32,7 @@
"through2": "^2.0.0",
"tmp": "0.0.33",
"traceur": "0.0.111",
"transpile": "^2.5.3",
"transpile": "^2.5.5",
"uglify-es": "^3.0.26",
"urix": "^0.1.0",
"winston": "^2.2.0",
Expand Down Expand Up @@ -88,7 +88,7 @@
"coverage": "istanbul cover _mocha -- test/test --timeout 600000",
"coverage:upload": "istanbul cover _mocha --report lcovonly -- test/test --timeout 600000 && cat ./coverage/lcov.info | ./node_modules/coveralls-send/bin/coveralls.js",
"test:slim-worker-single": "node test/slim/worker/single/build.js && testee test/slim/worker/single/worker.html --browsers firefox --reporter Spec",
"test:slim-worker-progressive": "node test/slim/worker/progressive/build.js && testee test/slim/worker/progressive/worker.html --browsers firefox --reporter Spec",
"test:slim-worker-progressive": "node test/slim/worker/progressive/build.js && testee test/slim/worker/progressive/worker.html --browsers firefox --reporter Spec",
"test:exports-worker": "node test/exports_worker/exports.js && testee test/exports_worker/worker.html --browsers firefox --reporter Spec"
},
"engines": {
Expand Down
10 changes: 10 additions & 0 deletions test/slim/module/index.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="dist/bundles/main.js"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions test/slim/module/main.js
@@ -0,0 +1,3 @@
define(["module"], function(module) {
window.moduleId = module.id;
});
3 changes: 3 additions & 0 deletions test/slim/module/stealconfig.js
@@ -0,0 +1,3 @@
steal.config({
main: "main"
});
23 changes: 23 additions & 0 deletions test/slim_build_test.js
Expand Up @@ -675,4 +675,27 @@ describe("slim builds", function() {
close();
});
});

it("supports 'module' imports in AMD modules", function() {
var base = path.join(__dirname, "slim", "module");
var config = { config: path.join(base, "stealconfig.js") };

return rmdir(path.join(base, "dist"))
.then(function() {
return optimize(config, { minify: false, quiet: true });
})
.then(function() {
return open(path.join("test", "slim", "module", "index.html"));
})
.then(function(args) {
return Promise.all([args.close, find(args.browser, "moduleId")]);
})
.then(function(data) {
var close = data[0];
var moduleId = data[1];

assert.equal(moduleId, "main", "should set module.id");
close();
});
});
});

0 comments on commit 137a64e

Please sign in to comment.