MCPcopy Index your code
hub / github.com/nodejs/llhttp / buildMode

Function buildMode

test/md-test.ts:43–81  ·  view source on GitHub ↗
(ty: TestType, meta: Metadata)

Source from the content-addressed store, hash-verified

41//
42
43async function buildMode(ty: TestType, meta: Metadata): Promise<FixtureResult> {
44 const cacheKey = `${ty}:${JSON.stringify(meta || {})}`;
45 let entry = modeCache.get(cacheKey);
46
47 if (entry) {
48 return entry;
49 }
50
51 let node: { llparse: LLParse; entry: Node };
52 let prefix: string;
53 let extra: string[];
54 if (ty === 'url') {
55 node = buildURL();
56 prefix = 'url';
57 extra = [];
58 } else {
59 node = buildNode();
60 prefix = 'http';
61 extra = [
62 '-DLLHTTP__TEST_HTTP',
63 path.join(__dirname, '..', 'src', 'native', 'http.c'),
64 ];
65 }
66
67 if (meta.pause) {
68 extra.push(`-DLLHTTP__TEST_PAUSE_${meta.pause.toUpperCase()}=1`);
69 }
70
71 if (meta.skipBody) {
72 extra.push('-DLLHTTP__TEST_SKIP_BODY=1');
73 }
74
75 entry = await build(node.llparse, node.entry, `${prefix}-${ty}`, {
76 extra,
77 }, ty);
78
79 modeCache.set(cacheKey, entry);
80 return entry;
81}
82
83//
84// Run test suite

Callers 1

runSingleTestFunction · 0.85

Calls 3

buildFunction · 0.90
buildURLFunction · 0.85
buildNodeFunction · 0.85

Tested by

no test coverage detected