angular-cn/packages/core/schematics/test
Paul Gschwendtner 8d3365e4fc fix(core): static-query usage migration strategy should detect ambiguous query usage (#30215)
Currently we always just set the timing to `false` if we aren't
able to analyze a given call expression or new expression. e.g.

```ts
ngOnInit() {
  thirdPartyCallSync(() => this.query.doSomething())
}
```

In that case the `thirdPartyCallSync` function comes from the `node_modules`
and is only defined through types while there is no code for the
actual function logic that can be analyzed. This makes it impossible
to tell whether the given call expression actually causes the specified
arrow function to be executed synchronously or not. In order to be able
to make this better, we now peek into the passed arrow function and
check for a synchronous query usage. If so, we set the query timing to
static and mark it as ambiguous. This ensures that the usage strategy is
less "magical" and more correct with third-party code.

Additionally since functions like `setTimeout` are not analyzable but known
to be asynchronous, there is a hard-coded list of known functions which
shouldn't be marked as ambiguous.

Resolves FW-1214. As planned within https://hackmd.io/hPiLWpPlQ4uynC1luIBdfQ

PR Close #30215
2019-05-09 14:39:06 -07:00
..
google3 fix(ivy): injectable pipe schematic generating incorrect import statements (#30170) 2019-04-29 09:39:11 -07:00
BUILD.bazel test(core): run schematic tests with public migration collection (#30198) 2019-05-08 09:23:28 -07:00
injectable_pipe_migration_spec.ts test(core): run schematic tests with public migration collection (#30198) 2019-05-08 09:23:28 -07:00
line_mappings_spec.ts feat(core): template-var-assignment update schematic (#29608) 2019-04-02 15:47:32 -07:00
move_document_migration_spec.ts test(core): run schematic tests with public migration collection (#30198) 2019-05-08 09:23:28 -07:00
project_tsconfig_paths_spec.ts refactor(core): static-query migration should not fail for test files (#30034) 2019-04-23 08:32:35 -07:00
static_queries_migration_template_spec.ts fix(core): static-query migration should handle queries on accessors (#30327) 2019-05-09 11:22:37 -07:00
static_queries_migration_usage_spec.ts fix(core): static-query usage migration strategy should detect ambiguous query usage (#30215) 2019-05-09 14:39:06 -07:00
template_var_assignment_migration_spec.ts test(core): run schematic tests with public migration collection (#30198) 2019-05-08 09:23:28 -07:00
test-migrations.json test(core): run schematic tests with public migration collection (#30198) 2019-05-08 09:23:28 -07:00