MCPcopy Index your code
hub / github.com/ampproject/amphtml / getTransform

Function getTransform

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

* Extracts the JS transform for a test from its transform file. * @param {string} inputFile * @param {!Object} extraOptions * @return {Promise }

(inputFile, extraOptions)

Source from the content-addressed store, hash-verified

88 * @return {Promise<string>}
89 */
90async function getTransform(inputFile, extraOptions) {
91 const transformDir = getTransformerDir(inputFile);
92 const parsed = path.parse(transformDir);
93 const transformPath = path.join(parsed.dir, 'dist', parsed.base);
94 const transformFile = (
95 await fastGlob(path.resolve(transformPath, '*.js'))
96 )[0];
97 return (await import(transformFile)).default.default(extraOptions);
98}
99
100/**
101 * Computes the output for a test from its transform and input.

Callers 1

runTestFunction · 0.85

Calls 3

getTransformerDirFunction · 0.85
resolveMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected