MCPcopy
hub / github.com/webpack/webpack / addDebugInfo

Function addDebugInfo

test/setupTestFramework.js:89–135  ·  view source on GitHub ↗
(it)

Source from the content-addressed store, hash-verified

87// Setup debugging info for tests
88if (process.env.DEBUG_INFO) {
89 const addDebugInfo = (it) => (name, fn, timeout) => {
90 if (fn.length === 0) {
91 it(
92 name,
93 () => {
94 process.stdout.write(`START1 ${name}\n`);
95 try {
96 const promise = fn();
97 if (promise && promise.then) {
98 return promise.then(
99 (r) => {
100 process.stdout.write(`DONE OK ${name}\n`);
101 return r;
102 },
103 (err) => {
104 process.stdout.write(`DONE FAIL ${name}\n`);
105 throw err;
106 }
107 );
108 }
109
110 process.stdout.write(`DONE OK ${name}\n`);
111 } catch (err) {
112 process.stdout.write(`DONE FAIL ${name}\n`);
113 throw err;
114 }
115 },
116 timeout
117 );
118 } else {
119 it(
120 name,
121 (done) => {
122 process.stdout.write(`START2 ${name}\n`);
123 return fn((err) => {
124 if (err) {
125 process.stdout.write(`DONE FAIL ${name}\n`);
126 } else {
127 process.stdout.write(`DONE OK ${name}\n`);
128 }
129 return done(err);
130 });
131 },
132 timeout
133 );
134 }
135 };
136
137 // eslint-disable-next-line no-global-assign
138 it = addDebugInfo(it);

Callers 1

Calls 3

writeMethod · 0.80
itFunction · 0.50
fnFunction · 0.50

Tested by

no test coverage detected