Commit Graph

4 Commits

Author SHA1 Message Date
JoostK 7dcf2864a3 feat(compiler-cli): expose function to allow short-circuiting of linking (#40137)
The linker is implemented using a Babel transform such that Babel needs
to parse and walk a source file to find the declarations that need to be
compiled. If it can be determined that a source file is known not to
contain any declarations the parsing and walking can be skipped as a
performance improvement. This commit adds an exposed function for tools
that integrate the linker to use to allow short-circuiting of the linker
transform.

PR Close #40137
2020-12-22 14:53:02 -08:00
Pete Bacon Darwin 9066ca9e92 test(compiler-cli): add support for source-map checks in compliance tests (#39939)
This commit allows compliance test-cases to be written that specify
source-map mappings between the source and generated code.

To check a mapping, add a `// SOURCE:` comment to the end of a line:

```
<generated code> // SOURCE: "<source-url>" <source code>
```

The generated code will still be checked, stripped of the `// SOURCE` comment,
as normal by the `expectEmit()` helper.

In addition, the source-map segments are checked to ensure that there is a
mapping from `<generated code>` to `<source code>` found in the file at
`<source-url>`.

Note:

* The source-url should be absolute, with the directory containing the
  TEST_CASES.json file assumed to be `/`.
* Whitespace is important and will be included when comparing the segments.
* There is a single space character between each part of the line.
* Newlines within a mapping must be escaped since the mapping and comment
  must all appear on a single line of this file.

PR Close #39939
2020-12-07 16:21:05 -08:00
Alex Rickabaugh 3613e7c4e5 test(compiler-cli): move testing utils to separate package (#39594)
ngtsc has a robust suite of testing utilities, designed for in-memory
testing of a TypeScript compiler. Previously these utilities lived in the
`test` directory for the compiler-cli package.

This commit moves those utilities to an `ngtsc/testing` package, enabling
them to be depended on separately and opening the door for using them from
the upcoming language server testing infrastructure.

As part of this refactoring, the `fake_core` package (a lightweight API
replacement for @angular/core) is expanded to include functionality needed
for Language Service test use cases.

PR Close #39594
2020-11-17 11:59:56 -08:00
Pete Bacon Darwin e719419d3f test(compiler-cli): create initial "linked compile" compliance tests (#39617)
This commit adds bazel rules to test whether linking the golden partial
files for test cases produces the same output as a full compile of the
test case would.

PR Close #39617
2020-11-13 11:25:57 -08:00