Skip to content

Commit 2f8e3fc

Browse files
committed
fix(tests): add filter infra to ConfigTestCases
1 parent 199ac33 commit 2f8e3fc

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎test/ConfigTestCases.test.js‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,25 @@ describe("ConfigTestCases", function() {
2222
});
2323
categories.forEach(function(category) {
2424
describe(category.name, function() {
25-
category.tests.forEach(function(testName) {
25+
category.tests.filter(function(testName) {
26+
var testDirectory = path.join(casesPath, category.name, testName);
27+
var filterPath = path.join(testDirectory, "test.filter.js");
28+
var config = require(path.join(testDirectory, "webpack.config.js"));
29+
if(fs.existsSync(filterPath) && !require(filterPath)(config)) {
30+
describe.skip(testName, function() {
31+
it('filtered');
32+
});
33+
return false;
34+
}
35+
return true;
36+
}).forEach(function(testName) {
37+
var testDirectory = path.join(casesPath, category.name, testName);
38+
var filterPath = path.join(testDirectory, "test.filter.js");
39+
var options = require(path.join(testDirectory, "webpack.config.js"));
2640
var suite = describe(testName, function() {});
2741
it(testName + " should compile", function(done) {
2842
this.timeout(30000);
29-
var testDirectory = path.join(casesPath, category.name, testName);
3043
var outputDirectory = path.join(__dirname, "js", "config", category.name, testName);
31-
var options = require(path.join(testDirectory, "webpack.config.js"));
3244
var optionsArr = [].concat(options);
3345
optionsArr.forEach(function(options, idx) {
3446
if(!options.context) options.context = testDirectory;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var supportsES6 = require("../../../helpers/supportsES6");
22

33
module.exports = function(config) {
4-
return !config.minimize && supportsES6();
4+
return supportsES6();
55
};

0 commit comments

Comments
 (0)