angular-cn/packages/compiler-cli/test/compliance
Pete Bacon Darwin 7186f9c016 refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921)
To improve cross platform support, all file access (and path manipulation)
is now done through a well known interface (`FileSystem`).

For testing a number of `MockFileSystem` implementations are provided.
These provide an in-memory file-system which emulates operating systems
like OS/X, Unix and Windows.

The current file system is always available via the static method,
`FileSystem.getFileSystem()`. This is also used by a number of static
methods on `AbsoluteFsPath` and `PathSegment`, to avoid having to pass
`FileSystem` objects around all the time. The result of this is that one
must be careful to ensure that the file-system has been initialized before
using any of these static methods. To prevent this happening accidentally
the current file system always starts out as an instance of `InvalidFileSystem`,
which will throw an error if any of its methods are called.

You can set the current file-system by calling `FileSystem.setFileSystem()`.
During testing you can call the helper function `initMockFileSystem(os)`
which takes a string name of the OS to emulate, and will also monkey-patch
aspects of the TypeScript library to ensure that TS is also using the
current file-system.

Finally there is the `NgtscCompilerHost` to be used for any TypeScript
compilation, which uses a given file-system.

All tests that interact with the file-system should be tested against each
of the mock file-systems. A series of helpers have been provided to support
such tests:

* `runInEachFileSystem()` - wrap your tests in this helper to run all the
wrapped tests in each of the mock file-systems.
* `addTestFilesToFileSystem()` - use this to add files and their contents
to the mock file system for testing.
* `loadTestFilesFromDisk()` - use this to load a mirror image of files on
disk into the in-memory mock file-system.
* `loadFakeCore()` - use this to load a fake version of `@angular/core`
into the mock file-system.

All ngcc and ngtsc source and tests now use this virtual file-system setup.

PR Close #30921
2019-06-25 16:25:24 -07:00
..
BUILD.bazel refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
README.md build: use bazel version from node modules (#26691) 2018-10-30 16:19:13 -04:00
mock_compile.ts refactor(ivy): implement a virtual file-system layer in ngtsc + ngcc (#30921) 2019-06-25 16:25:24 -07:00
mock_compiler_spec.ts test(compiler-cli): compliance tests not always reporting test failure (#30597) 2019-05-22 16:22:52 -07:00
r3_compiler_compliance_spec.ts refactor(ivy): use FatalDiagnosticError to throw more descriptive errors while extracting queries information (#31123) 2019-06-25 10:23:24 -07:00
r3_view_compiler_binding_spec.ts perf(ivy): chain multiple attribute instructions (#31152) 2019-06-24 12:33:49 -07:00
r3_view_compiler_di_spec.ts refactor(ivy): Move instructions back to ɵɵ (#30546) 2019-05-20 16:37:47 -07:00
r3_view_compiler_directives_spec.ts refactor(ivy): inherently call ɵɵselect(0) (#30830) 2019-06-07 08:48:31 -07:00
r3_view_compiler_i18n_spec.ts perf(ivy): chain multiple `i18nExp` calls (#31258) 2019-06-25 11:26:29 -07:00
r3_view_compiler_input_outputs_spec.ts refactor(ivy): Move instructions back to ɵɵ (#30546) 2019-05-20 16:37:47 -07:00
r3_view_compiler_listener_spec.ts refactor(ivy): inherently call ɵɵselect(0) (#30830) 2019-06-07 08:48:31 -07:00
r3_view_compiler_providers_spec.ts test(compiler-cli): compliance tests not always reporting test failure (#30597) 2019-05-22 16:22:52 -07:00
r3_view_compiler_spec.ts perf(ivy): chain multiple property instructions (#31078) 2019-06-19 15:42:37 -07:00
r3_view_compiler_styling_spec.ts perf(ivy): chain multiple attribute instructions (#31152) 2019-06-24 12:33:49 -07:00
r3_view_compiler_template_spec.ts test(compiler-cli): fix failing ivy template compliance test (#30983) 2019-06-11 15:17:01 -07:00

README.md

Tests in this directory should be run with:

yarn bazel test --define=compile=aot  packages/compiler-cli/test/compliance:compliance