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

Method setup

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

* Set up a new testing environment.

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

Source from the content-addressed store, hash-verified

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