Skip to content

Commit

Permalink
refactor(compiler-cli): expose loadTestDirectory() test helper (#36843
Browse files Browse the repository at this point in the history
)

This helper can be useful in other packages to load files from the
real disk into a mock file system.

PR Close #36843
  • Loading branch information
petebacondarwin authored and mhevery committed May 13, 2020
1 parent a8aa2ca commit d113bfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/compiler-cli/test/helpers/BUILD.bazel
Expand Up @@ -8,6 +8,7 @@ ts_library(
srcs = glob([
"**/*.ts",
]),
module_name = "@angular/compiler-cli/test/helpers",
deps = [
"//packages:types",
"//packages/compiler-cli/src/ngtsc/file_system",
Expand Down
3 changes: 2 additions & 1 deletion packages/compiler-cli/test/helpers/src/mock_file_loading.ts
Expand Up @@ -66,7 +66,8 @@ export function loadFakeCore(fs: FileSystem, basePath: string = '/') {
* @param directoryPath the path to the directory we want to load.
* @param mockPath the path within the mock file-system where the directory is to be loaded.
*/
function loadTestDirectory(fs: FileSystem, directoryPath: string, mockPath: AbsoluteFsPath): void {
export function loadTestDirectory(
fs: FileSystem, directoryPath: string, mockPath: AbsoluteFsPath): void {
readdirSync(directoryPath).forEach(item => {
const srcPath = resolve(directoryPath, item);
const targetPath = fs.resolve(mockPath, item);
Expand Down

0 comments on commit d113bfa

Please sign in to comment.