Skip to content

Commit 20980b8

Browse files
committed
added specs to bump coverage
1 parent 64ef317 commit 20980b8

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎test/Stats.test.js‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var webpack = require("../lib/webpack");
77

88
var base = path.join(__dirname, "statsCases");
99
var tests = fs.readdirSync(base);
10+
var Stats = require("../lib/Stats");
1011

1112
describe("Stats", function() {
1213
tests.forEach(function(testName) {
@@ -59,4 +60,43 @@ describe("Stats", function() {
5960
});
6061
});
6162
});
63+
describe("Error Handling", function(){
64+
describe("does have", function(){
65+
it("hasErrors", function() {
66+
mockStats = new Stats({errors:['firstError'],hash:'1234'});
67+
mockStats.hasErrors().should.be.ok;
68+
});
69+
it("hasWarnings", function() {
70+
mockStats = new Stats({warnings:['firstError'],hash:'1234'});
71+
mockStats.hasWarnings().should.be.ok;
72+
});
73+
});
74+
describe("does not have", function(){
75+
it("hasErrors", function() {
76+
mockStats = new Stats({errors:[],hash:'1234'});
77+
mockStats.hasErrors().should.not.be.ok;
78+
});
79+
it("hasWarnings", function() {
80+
mockStats = new Stats({warnings:[],hash:'1234'});
81+
mockStats.hasWarnings().should.not.be.ok;
82+
});
83+
});
84+
it("formatError handles string errors", function(){
85+
mockStats = new Stats({
86+
errors:['firstError'],
87+
warnings:[],
88+
assets:[],
89+
chunks:[],
90+
modules:[],
91+
children:[],
92+
hash:'1234',
93+
mainTemplate:{
94+
getPublicPath:function(){return 'path';}
95+
}
96+
});
97+
obj = mockStats.toJson();
98+
obj.errors[0].should.be.equal('firstError');
99+
});
100+
});
101+
62102
});

0 commit comments

Comments
 (0)