Skip to content

Commit 3ba9ed9

Browse files
committed
fix existing tests that failed schema validaton
1 parent ab1d1d0 commit 3ba9ed9

4 files changed

Lines changed: 28 additions & 24 deletions

File tree

lib/validateSchema.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const Ajv = require("ajv");
88
const ajv = new Ajv({
99
errorDataPath: "configuration",
1010
allErrors: true,
11-
verbose: true
11+
verbose: true,
12+
extendRefs: true
1213
});
1314
require("ajv-keywords")(ajv, ["instanceof"]);
1415
require("../schemas/ajv.absolutePath")(ajv);

test/Compiler-caching.test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("Compiler (caching)", function() {
1414
new WebpackOptionsDefaulter().process(options);
1515
options.entry = entry;
1616
options.context = path.join(__dirname, "fixtures");
17-
options.output.path = "";
17+
options.output.path = "/";
1818
options.output.filename = "bundle.js";
1919
options.output.pathinfo = true;
2020
const logs = {
@@ -188,12 +188,11 @@ describe("Compiler (caching)", function() {
188188
stats.assets[0].emitted.should.be.exactly(true);
189189

190190
helper.runAgain((stats, files, iteration) => {
191-
192191
// Cached the second run
193192
stats.assets[0].name.should.be.exactly("bundle.js");
194193
stats.assets[0].emitted.should.be.exactly(false);
195194

196-
files["bundle.js"].should.containEql("This is a");
195+
files["/bundle.js"].should.containEql("This is a");
197196

198197
const aContent = fs.readFileSync(tempFixture.aFilepath).toString().replace("This is a", "This is a MODIFIED");
199198

@@ -205,7 +204,7 @@ describe("Compiler (caching)", function() {
205204
stats.assets[0].name.should.be.exactly("bundle.js");
206205
stats.assets[0].emitted.should.be.exactly(true);
207206

208-
files["bundle.js"].should.containEql("This is a MODIFIED");
207+
files["/bundle.js"].should.containEql("This is a MODIFIED");
209208

210209
done();
211210
});

test/Compiler.test.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe("Compiler", function() {
1212
new WebpackOptionsDefaulter().process(options);
1313
options.entry = entry;
1414
options.context = path.join(__dirname, "fixtures");
15-
if(noOutputPath) options.output.path = "";
15+
if(noOutputPath) options.output.path = "/";
1616
options.output.pathinfo = true;
1717
var logs = {
1818
mkdirp: [],
@@ -60,22 +60,23 @@ describe("Compiler", function() {
6060

6161
compile("./c", {
6262
output: {
63-
path: 'what',
63+
path: '/what',
6464
filename: 'the' + sep + 'hell.js',
6565
}
6666
}, function(stats, files) {
6767
stats.logs.mkdirp.should.eql([
68-
'what',
69-
'what' + sep + 'the',
68+
'/what',
69+
'/what' + sep + 'the',
7070
]);
7171
done();
7272
});
7373
});
74+
7475
it("should compile a single file", function(done) {
7576
compile("./c", {}, function(stats, files) {
76-
files.should.have.property("main.js").have.type("string");
77-
Object.keys(files).should.be.eql(["main.js"]);
78-
var bundle = files["main.js"];
77+
files.should.have.property("/main.js").have.type("string");
78+
Object.keys(files).should.be.eql(["/main.js"]);
79+
var bundle = files["/main.js"];
7980
bundle.should.containEql("function __webpack_require__(");
8081
bundle.should.containEql("__webpack_require__(/*! ./a */ 0);");
8182
bundle.should.containEql("./c.js");
@@ -89,11 +90,12 @@ describe("Compiler", function() {
8990
done();
9091
});
9192
});
93+
9294
it("should compile a complex file", function(done) {
9395
compile("./main1", {}, function(stats, files) {
94-
files.should.have.property("main.js").have.type("string");
95-
Object.keys(files).should.be.eql(["main.js"]);
96-
var bundle = files["main.js"];
96+
files.should.have.property("/main.js").have.type("string");
97+
Object.keys(files).should.be.eql(["/main.js"]);
98+
var bundle = files["/main.js"];
9799
bundle.should.containEql("function __webpack_require__(");
98100
bundle.should.containEql("__webpack_require__(/*! ./a */");
99101
bundle.should.containEql("./main1.js");
@@ -110,11 +112,12 @@ describe("Compiler", function() {
110112
done();
111113
});
112114
});
115+
113116
it("should compile a file with transitive dependencies", function(done) {
114117
compile("./abc", {}, function(stats, files) {
115-
files.should.have.property("main.js").have.type("string");
116-
Object.keys(files).should.be.eql(["main.js"]);
117-
var bundle = files["main.js"];
118+
files.should.have.property("/main.js").have.type("string");
119+
Object.keys(files).should.be.eql(["/main.js"]);
120+
var bundle = files["/main.js"];
118121
bundle.should.containEql("function __webpack_require__(");
119122
bundle.should.containEql("__webpack_require__(/*! ./a */");
120123
bundle.should.containEql("__webpack_require__(/*! ./b */");
@@ -133,14 +136,15 @@ describe("Compiler", function() {
133136
done();
134137
});
135138
});
139+
136140
it("should compile a file with multiple chunks", function(done) {
137141
compile("./chunks", {}, function(stats, files) {
138142
stats.chunks.length.should.be.eql(2);
139-
files.should.have.property("main.js").have.type("string");
140-
files.should.have.property("0.js").have.type("string");
141-
Object.keys(files).should.be.eql(["0.js", "main.js"]);
142-
var bundle = files["main.js"];
143-
var chunk = files["0.js"];
143+
files.should.have.property("/main.js").have.type("string");
144+
files.should.have.property("/0.js").have.type("string");
145+
Object.keys(files).should.be.eql(["/0.js", "/main.js"]);
146+
var bundle = files["/main.js"];
147+
var chunk = files["/0.js"];
144148
bundle.should.containEql("function __webpack_require__(");
145149
bundle.should.containEql("__webpack_require__(/*! ./b */");
146150
chunk.should.not.containEql("__webpack_require__(/* ./b */");

test/Validation.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe("Validation", function() {
124124
module: {
125125
rules: [{
126126
oneOf: [{
127-
test: "a",
127+
test: "/a",
128128
paser: {
129129
amd: false
130130
}

0 commit comments

Comments
 (0)