MCPcopy
hub / github.com/angular/angular / setupBazelTo

Function setupBazelTo

packages/compiler-cli/test/test_support.ts:121–146  ·  view source on GitHub ↗
(tmpDirPath: string)

Source from the content-addressed store, hash-verified

119}
120
121export function setupBazelTo(tmpDirPath: string) {
122 const nodeModulesPath = path.join(tmpDirPath, 'node_modules');
123 const angularDirectory = path.join(nodeModulesPath, '@angular');
124
125 fs.mkdirSync(nodeModulesPath);
126 fs.mkdirSync(angularDirectory);
127
128 getAngularPackagesFromRunfiles().forEach(({pkgPath, name}) => {
129 fs.symlinkSync(pkgPath, path.join(angularDirectory, name), 'junction');
130 });
131
132 // Link typescript
133 const typeScriptSource = resolveFromRunfiles('_main/node_modules/typescript');
134 const typescriptDest = path.join(nodeModulesPath, 'typescript');
135 fs.symlinkSync(typeScriptSource, typescriptDest, 'junction');
136
137 // Link "rxjs" if it has been set up as a runfile. "rxjs" is linked optionally because
138 // not all compiler-cli tests need "rxjs" set up.
139 try {
140 const rxjsSource = resolveFromRunfiles('_main/node_modules/rxjs');
141 const rxjsDest = path.join(nodeModulesPath, 'rxjs');
142 fs.symlinkSync(rxjsSource, rxjsDest, 'junction');
143 } catch (e: any) {
144 if (e.code !== 'MODULE_NOT_FOUND') throw e;
145 }
146}
147
148export function setup(): TestSupport {
149 // // `TestSupport` provides its own file-system abstraction so we just use

Callers 1

setupFunction · 0.85

Calls 4

resolveFromRunfilesFunction · 0.90
joinMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…