MCPcopy
hub / github.com/webpack/webpack / createTestCaseWithoutError

Function createTestCaseWithoutError

test/Validation.test.js:53–80  ·  view source on GitHub ↗
(
		/** @type {string} */ name,
		/** @type {EXPECTED_ANY} */ config
	)

Source from the content-addressed store, hash-verified

51 };
52
53 const createTestCaseWithoutError = (
54 /** @type {string} */ name,
55 /** @type {EXPECTED_ANY} */ config
56 ) => {
57 it(`should success validation for ${name}`, () => {
58 let errored;
59
60 try {
61 const webpack = require("..");
62
63 webpack(config);
64 } catch (err) {
65 if (/** @type {EXPECTED_ANY} */ (err).name === "ValidationError") {
66 throw new Error("Validation didn't success", {
67 cause: /** @type {Error} */ (err)
68 });
69 }
70
71 errored = err;
72
73 return;
74 }
75
76 if (errored) {
77 throw new Error("Validation didn't success");
78 }
79 });
80 };
81
82 createTestCase("undefined configuration", undefined, (msg) =>
83 expect(msg).toMatchInlineSnapshot(`

Callers 1

Validation.test.jsFile · 0.85

Calls 3

requireFunction · 0.70
itFunction · 0.50
webpackFunction · 0.50

Tested by

no test coverage detected