Skip to content

Commit 355d1de

Browse files
authored
fix: accept custom logger object (#472)
1 parent 65ab0cc commit 355d1de

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/ForkTsCheckerWebpackPluginOptions.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,18 @@
9494
"enum": ["console", "webpack-infrastructure", "silent"]
9595
},
9696
"Logger": {
97-
"instanceof": "Function"
97+
"type": "object",
98+
"properties": {
99+
"error": {
100+
"instanceof": "Function"
101+
},
102+
"info": {
103+
"instanceof": "Function"
104+
},
105+
"log": {
106+
"instanceof": "Function"
107+
}
108+
}
98109
},
99110
"TypeScriptReporterOptions": {
100111
"oneOf": [

test/unit/ForkTsCheckerWebpackPlugin.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@ describe('ForkTsCheckerWebpackPlugin', () => {
1616
it("doesn't throw an error for empty options", () => {
1717
expect(() => new ForkTsCheckerWebpackPlugin()).not.toThrowError();
1818
});
19+
20+
it('accepts a custom logger', () => {
21+
const logger = {
22+
error: (message) => console.log(message),
23+
info: (message) => console.log(message),
24+
log: (message) => console.log(message),
25+
};
26+
27+
expect(() => new ForkTsCheckerWebpackPlugin({ logger: { issues: logger } })).not.toThrowError();
28+
});
1929
});

0 commit comments

Comments
 (0)