MCPcopy
hub / github.com/webpack/webpack / expectCompiled

Function expectCompiled

test/compileBooleanMatcher.unittest.js:13–23  ·  view source on GitHub ↗
(name, input, fn)

Source from the content-addressed store, hash-verified

11 * @param {(e: ExceptResult) => void} fn fn to test
12 */
13 const expectCompiled = (name, input, fn) => {
14 it(`should compile ${name}`, () => {
15 const items = typeof input === "string" ? input.split(",") : input;
16 const regexp = itemsToRegexp(items);
17 const r = new RegExp(`^${regexp}$`);
18 for (const item of items) {
19 expect(item).toMatch(r);
20 }
21 fn(expect(regexp));
22 });
23 };
24
25 expect.addSnapshotSerializer({
26 test() {

Calls 4

itemsToRegexpFunction · 0.85
splitMethod · 0.80
itFunction · 0.50
fnFunction · 0.50

Tested by

no test coverage detected