Skip to content

Commit

Permalink
allow browsertesting in older browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Oct 24, 2015
1 parent 6307ed7 commit 383fd71
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"coveralls": "^2.11.2",
"css-loader": "~0.15.0",
"diff": "^2.0.2",
"es6-promise-polyfill": "^1.1.1",
"eslint": "^1.1.0",
"eslint-plugin-nodeca": "^1.0.3",
"express": "~4.13.1",
Expand Down
36 changes: 18 additions & 18 deletions test/browsertest/lib/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,6 @@ describe("main", function() {
window.library2.ok.should.be.eql(true);
});

var testCasesContext = require.context("../../cases", true, /^\.\/[^\/_]+\/[^\/_]+\/index$/);
var testCasesMap = testCasesContext.keys().map(function(key) {
return key.substring(2, key.length - "/index".length).split("/");
}).reduce(function(map, x) {
if(!map[x[0]]) map[x[0]] = [x[1]];
else map[x[0]].push(x[1]);
return map;
}, {});
Object.keys(testCasesMap).forEach(function(category) {
describe(category, function() {
testCasesMap[category].forEach(function(name) {
describe(name, function() {
testCasesContext("./" + category + "/" + name + "/index");
});
});
});
});

describe("web resolving", function() {
it("should load index.web.js instead of index.js", function() {
true.should.be.eql(true);
Expand Down Expand Up @@ -110,6 +92,24 @@ describe("main", function() {
});
});

var testCasesContext = require.context("../../cases", true, /^\.\/[^\/_]+\/[^\/_]+\/index$/);
var testCasesMap = testCasesContext.keys().map(function(key) {
return key.substring(2, key.length - "/index".length).split("/");
}).reduce(function(map, x) {
if(!map[x[0]]) map[x[0]] = [x[1]];
else map[x[0]].push(x[1]);
return map;
}, {});
Object.keys(testCasesMap).forEach(function(category) {
describe(category, function() {
testCasesMap[category].forEach(function(name) {
describe(name, function() {
testCasesContext("./" + category + "/" + name + "/index");
});
});
});
});

});

if(module.hot) {
Expand Down
1 change: 1 addition & 0 deletions test/browsertest/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</head>
<body>
<script src="mocha.js"></script>
<script src="../../node_modules/es6-promise-polyfill/promise.js"></script>
<script>
mocha.setup('bdd');
</script>
Expand Down

0 comments on commit 383fd71

Please sign in to comment.