From e2220c4f1260fddae49b70b2ef477b7b1a261373 Mon Sep 17 00:00:00 2001 From: Bert Date: Wed, 22 Aug 2018 14:12:21 +0200 Subject: [PATCH] fix(schema): allow the `output` filename to be a `{Function}` (#1409) --- lib/optionsSchema.json | 3 +++ test/Validation.test.js | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/optionsSchema.json b/lib/optionsSchema.json index cde973e162..8ee6f0798e 100644 --- a/lib/optionsSchema.json +++ b/lib/optionsSchema.json @@ -36,6 +36,9 @@ }, { "type": "string" + }, + { + "instanceof": "Function" } ] }, diff --git a/test/Validation.test.js b/test/Validation.test.js index 86e7278f5e..943d2bc981 100644 --- a/test/Validation.test.js +++ b/test/Validation.test.js @@ -70,6 +70,18 @@ describe('Validation', () => { }); }); + describe('filename', () => { + it('should allow filename to be a function', () => { + try { + // eslint-disable-next-line no-new + new Server(compiler, { filename: () => {} }); + } catch (e) { + if (!(e instanceof OptionsValidationError)) { throw e; } + throw new Error("Validation failed and it shouldn't"); + } + }); + }); + describe('checkHost', () => { it('should always allow any host if options.disableHostCheck is set', () => { const options = {