MCPcopy
hub / github.com/ampproject/amphtml / runTest

Function runTest

build-system/tasks/server-tests.js:163–180  ·  view source on GitHub ↗

* Runs the test in a single input file * * @param {string} inputFile * @return {Promise }

(inputFile)

Source from the content-addressed store, hash-verified

161 * @return {Promise<void>}
162 */
163async function runTest(inputFile) {
164 const testName = getTestName(inputFile);
165 const [input, expectedOutput, transform] = await Promise.all([
166 getInput(inputFile),
167 getExpectedOutput(inputFile),
168 getTransform(inputFile, loadOptions(inputFile)),
169 ]);
170 const output = await getOutput(transform, input);
171 try {
172 assert.strictEqual(output, expectedOutput);
173 } catch (err) {
174 ++failed;
175 logError(testName, err);
176 return;
177 }
178 ++passed;
179 logWithoutTimestampLocalDev(green('✔'), 'Passed', cyan(testName));
180}
181
182/**
183 * Tests for AMP server custom transforms. Entry point for `amp server-tests`.

Callers 1

serverTestsFunction · 0.70

Calls 10

getTestNameFunction · 0.85
getInputFunction · 0.85
getExpectedOutputFunction · 0.85
getTransformFunction · 0.85
loadOptionsFunction · 0.85
logErrorFunction · 0.85
greenFunction · 0.85
cyanFunction · 0.85
getOutputFunction · 0.70

Tested by

no test coverage detected