MCPcopy Create free account
hub / github.com/angular/components / runTypeScriptCompatibilityTest

Function runTypeScriptCompatibilityTest

integration/ts-compat/helpers.mjs:16–40  ·  view source on GitHub ↗
(tscBinPath)

Source from the content-addressed store, hash-verified

14 * compiles a test file using the specified tsc binary which imports all entry-points.
15 */
16export async function runTypeScriptCompatibilityTest(tscBinPath) {
17 return new Promise((resolve, reject) => {
18 const tscArgs = [
19 '--strict',
20 // Disables automatic type resolution. In non-sandbox environments, the node modules
21 // are accessible and types could end up as part of the program.
22 '--types',
23 'node',
24 '--lib',
25 'es2015,dom',
26 testFilePath,
27 '--moduleResolution',
28 'bundler',
29 '--module',
30 'es2022',
31 ];
32 // Run `tsc` to compile the project. The stdout/stderr output is inherited, so that
33 // warnings and errors are printed to the console.
34 const tscProcess = fork(tscBinPath, tscArgs, {stdio: 'inherit'});
35
36 tscProcess.on('exit', exitCode => {
37 exitCode === 0 ? resolve() : reject();
38 });
39 });
40}

Callers 1

test.mjsFile · 0.90

Calls 1

onMethod · 0.45

Tested by

no test coverage detected