MCPcopy
hub / github.com/webpack/webpack / createTestCase

Function createTestCase

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

Source from the content-addressed store, hash-verified

4
5describe("Validation", () => {
6 const createTestCase = (
7 /** @type {string} */ name,
8 /** @type {EXPECTED_ANY} */ config,
9 /** @type {(msg: string) => void} */ fn,
10 /** @type {unknown} */ only = undefined
11 ) => {
12 it(`should fail validation for ${name}`, () => {
13 try {
14 const webpack = require("..");
15
16 webpack(config);
17 } catch (err) {
18 if (/** @type {EXPECTED_ANY} */ (err).name !== "ValidationError") {
19 throw err;
20 }
21 fn(/** @type {Error} */ (err).message);
22
23 return;
24 }
25
26 throw new Error("Validation didn't fail");
27 });
28 };
29
30 const createTestCaseOnlyValidate = (
31 /** @type {string} */ name,

Callers 1

Validation.test.jsFile · 0.70

Calls 4

requireFunction · 0.70
itFunction · 0.50
webpackFunction · 0.50
fnFunction · 0.50

Tested by

no test coverage detected