MCPcopy Index your code
hub / github.com/angular/angular-cli / copyAssets

Function copyAssets

tests/e2e/utils/assets.ts:22–41  ·  view source on GitHub ↗
(assetName: string, to?: string)

Source from the content-addressed store, hash-verified

20}
21
22export function copyAssets(assetName: string, to?: string) {
23 const seed = +Date.now();
24 const tempRoot = join(getTestAssetsDir(), assetName + '-' + seed);
25 const root = assetDir(assetName);
26
27 return Promise.resolve()
28 .then(() => {
29 const allFiles = glob.sync('**/*', { dot: true, cwd: root });
30
31 return allFiles.reduce((promise, filePath) => {
32 const toPath =
33 to !== undefined ? resolve(getTestProjectDir(), to, filePath) : join(tempRoot, filePath);
34
35 return promise
36 .then(() => copyFile(join(root, filePath), toPath))
37 .then(() => chmod(toPath, 0o777));
38 }, Promise.resolve());
39 })
40 .then(() => tempRoot);
41}
42
43/**
44 * @returns a method that once called will restore the environment

Calls 8

getTestProjectDirFunction · 0.90
copyFileFunction · 0.90
joinFunction · 0.85
getTestAssetsDirFunction · 0.85
assetDirFunction · 0.85
resolveMethod · 0.80
resolveFunction · 0.50
syncMethod · 0.45

Tested by

no test coverage detected