MCPcopy Create free account
hub / github.com/angular/angular / setup

Method setup

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

* Set up a new testing environment.

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

Source from the content-addressed store, hash-verified

89 * Set up a new testing environment.
90 */
91 static setup(files: Folder = {}, workingDir?: AbsoluteFsPath): NgtscTestEnvironment {
92 activeNgpSession?.dispose();
93 activeNgpSession = null;
94
95 const fs = getFileSystem();
96 if (fs instanceof MockFileSystem) {
97 fs.init(files);
98 }
99
100 const host = new AugmentedCompilerHost(fs);
101 setWrapHostForTest(makeWrapHost(host));
102
103 workingDir = workingDir ?? absoluteFrom('/');
104 const env = new NgtscTestEnvironment(fs, fs.resolve('/built'), workingDir);
105 fs.chdir(workingDir);
106
107 env.write(
108 absoluteFrom('/tsconfig-base.json'),
109 `{
110 "compilerOptions": {
111 "emitDecoratorMetadata": false,
112 "strictPropertyInitialization": false,
113 "experimentalDecorators": true,
114 "skipLibCheck": true,
115 "noImplicitAny": true,
116 "noEmitOnError": true,
117 "outDir": "built",
118 "rootDir": ".",
119 "allowJs": true,
120 "declaration": true,
121 "target": "es2015",
122 "newLine": "lf",
123 "module": "es2015",
124 "moduleResolution": "bundler",
125 "lib": ["es2015", "dom"],
126 "typeRoots": ["node_modules/@types"]
127 },
128 "exclude": [
129 "built"
130 ]
131 }`,
132 );
133
134 return env;
135 }
136
137 assertExists(fileName: string) {
138 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 9

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

Tested by

no test coverage detected