MCPcopy Index your code
hub / github.com/angular/angular / setup

Method setup

packages/compiler-cli/test/ngtsc/env.ts:80–122  ·  view source on GitHub ↗

* Set up a new testing environment.

(files: Folder = {}, workingDir?: AbsoluteFsPath)

Source from the content-addressed store, hash-verified

78 * Set up a new testing environment.
79 */
80 static setup(files: Folder = {}, workingDir?: AbsoluteFsPath): NgtscTestEnvironment {
81 const fs = getFileSystem();
82 if (fs instanceof MockFileSystem) {
83 fs.init(files);
84 }
85
86 const host = new AugmentedCompilerHost(fs);
87 setWrapHostForTest(makeWrapHost(host));
88
89 workingDir = workingDir ?? absoluteFrom('/');
90 const env = new NgtscTestEnvironment(fs, fs.resolve('/built'), workingDir);
91 fs.chdir(workingDir);
92
93 env.write(
94 absoluteFrom('/tsconfig-base.json'),
95 `{
96 "compilerOptions": {
97 "emitDecoratorMetadata": false,
98 "strictPropertyInitialization": false,
99 "experimentalDecorators": true,
100 "skipLibCheck": true,
101 "noImplicitAny": true,
102 "noEmitOnError": true,
103 "strictNullChecks": true,
104 "outDir": "built",
105 "rootDir": ".",
106 "allowJs": true,
107 "declaration": true,
108 "target": "es2015",
109 "newLine": "lf",
110 "module": "es2015",
111 "moduleResolution": "bundler",
112 "lib": ["es2015", "dom"],
113 "typeRoots": ["node_modules/@types"]
114 },
115 "exclude": [
116 "built"
117 ]
118 }`,
119 );
120
121 return env;
122 }
123
124 assertExists(fileName: string) {
125 if (!this.fs.exists(this.fs.resolve(this.outDir, fileName))) {

Callers 15

imports_spec.tsFile · 0.45
monorepo_spec.tsFile · 0.45
defer_spec.tsFile · 0.45
xi18n_spec.tsFile · 0.45
ngtsc_spec.tsFile · 0.45
scope_spec.tsFile · 0.45
hmr_spec.tsFile · 0.45

Calls 8

writeMethod · 0.95
getFileSystemFunction · 0.90
setWrapHostForTestFunction · 0.90
absoluteFromFunction · 0.90
makeWrapHostFunction · 0.85
initMethod · 0.65
resolveMethod · 0.65
chdirMethod · 0.65

Tested by

no test coverage detected