MCPcopy
hub / github.com/webpack/webpack / createTestCaseOnlyValidate

Function createTestCaseOnlyValidate

test/Validation.test.js:30–51  ·  view source on GitHub ↗
(
		/** @type {string} */ name,
		/** @type {EXPECTED_ANY} */ config,
		/** @type {(msg: string) => void} */ fn
	)

Source from the content-addressed store, hash-verified

28 };
29
30 const createTestCaseOnlyValidate = (
31 /** @type {string} */ name,
32 /** @type {EXPECTED_ANY} */ config,
33 /** @type {(msg: string) => void} */ fn
34 ) => {
35 it(`should fail validation for ${name}`, () => {
36 try {
37 const webpack = require("..");
38
39 webpack.validate(config);
40 } catch (err) {
41 if (/** @type {EXPECTED_ANY} */ (err).name !== "ValidationError") {
42 throw err;
43 }
44 fn(/** @type {Error} */ (err).message);
45
46 return;
47 }
48
49 throw new Error("Validation didn't fail");
50 });
51 };
52
53 const createTestCaseWithoutError = (
54 /** @type {string} */ name,

Callers 1

Validation.test.jsFile · 0.85

Calls 4

validateMethod · 0.80
requireFunction · 0.70
itFunction · 0.50
fnFunction · 0.50

Tested by

no test coverage detected