Skip to content

Commit

Permalink
Merge pull request #535 from stealjs/circ
Browse files Browse the repository at this point in the history
Adds test showing ES6 circular dependencies working with Babel
  • Loading branch information
matthewp authored Oct 26, 2016
2 parents ad6cac4 + a3e7b98 commit 3e47575
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/circular/bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { getBar, name as fooName } from './foo';

export let name = 'bar';

export function getFoo() {
return fooName;
}
3 changes: 3 additions & 0 deletions test/circular/dev.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script src="../../bower_components/steal/steal.js"
base-url="./"
config="package.json!npm"></script>
7 changes: 7 additions & 0 deletions test/circular/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { getFoo, name as barName } from './bar';

export let name = 'foo';

export function getBar() {
return barName;
}
6 changes: 6 additions & 0 deletions test/circular/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { getBar } from './foo';
import { getFoo } from './bar';

// true in dev, false in production
window.circularWorks = (getBar() === 'bar') &&
(getFoo() === 'foo');
8 changes: 8 additions & 0 deletions test/circular/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "circular",
"main": "main.js",
"version": "1.0.0",
"system": {
"transpiler": "babel"
}
}
5 changes: 5 additions & 0 deletions test/circular/prod.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script src="../../bower_components/steal/steal.js"
base-url="./"
config="package.json!npm"
main="circular/main"
env="production"></script>
21 changes: 21 additions & 0 deletions test/multibuild_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,28 @@ describe("multi build", function(){
});
});

it("Circular refs works with Babel", function(done){
rmdir(__dirname+"/circular/dist", function(error){
if(error){
done(error);
return;
}

multiBuild({
config: __dirname+"/circular/package.json!npm",
}, {
quiet: true,
minify: false
}).then(function(){
open("test/circular/prod.html",function(browser, close){
find(browser,"circularWorks", function(result){
assert.equal(result, true, "circular refs worked");
close();
}, close);
}, done);
}, done);
});
});

describe("with plugins", function(){
this.timeout(60000);
Expand Down

0 comments on commit 3e47575

Please sign in to comment.