Skip to content

Commit

Permalink
fix: accept custom logger object (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
tessro committed Jul 7, 2020
1 parent 65ab0cc commit 355d1de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/ForkTsCheckerWebpackPluginOptions.json
Expand Up @@ -94,7 +94,18 @@
"enum": ["console", "webpack-infrastructure", "silent"]
},
"Logger": {
"instanceof": "Function"
"type": "object",
"properties": {
"error": {
"instanceof": "Function"
},
"info": {
"instanceof": "Function"
},
"log": {
"instanceof": "Function"
}
}
},
"TypeScriptReporterOptions": {
"oneOf": [
Expand Down
10 changes: 10 additions & 0 deletions test/unit/ForkTsCheckerWebpackPlugin.spec.ts
Expand Up @@ -16,4 +16,14 @@ describe('ForkTsCheckerWebpackPlugin', () => {
it("doesn't throw an error for empty options", () => {
expect(() => new ForkTsCheckerWebpackPlugin()).not.toThrowError();
});

it('accepts a custom logger', () => {
const logger = {
error: (message) => console.log(message),
info: (message) => console.log(message),
log: (message) => console.log(message),
};

expect(() => new ForkTsCheckerWebpackPlugin({ logger: { issues: logger } })).not.toThrowError();
});
});

0 comments on commit 355d1de

Please sign in to comment.