Commit Graph

7205 Commits

Author SHA1 Message Date
Igor Minar 03d47d5701 feat(core): manually annotate de-sugarred core tree-shakable providers with @pureOrBreakMyCode (#41096)
This is necessary for closure compiler in order to support cross chunk code motion.

I'm intentionally not annotating these call sites with @__PURE__ at the moment because
build-optimizer does it within the Angular CLI build. In the future we might want to consider
having both annotations here in case we change how build-optimizer works.

PR Close #41096
2021-03-08 10:30:08 -08:00
Igor Minar 9c210281d4 feat(compiler): emit @__PURE__ or @pureOrBreakMyCode annotations in the generated code (#41096)
This change marks all relevant define* callsites as pure, causing the compiler to
emmit either @__PURE__ or @pureOrBreakMyCode annotation based on whether we are
compiling code annotated for closure or terser.

This change is needed in g3 where we don't run build optimizer but we
need the code to be annotated for the closure compiler.

Additionally this change allows for simplification of CLI and build optimizer as they
will no longer need to rewrite the generated code (there are still other places where
a build optimizer rewrite will be necessary so we can't remove it, we can only simplify it).

PR Close #41096
2021-03-08 10:30:08 -08:00
Jason Bedard 5c4914deff fix(bazel): fix incorrect rollup plugin method signature (#41101)
Update the resolveBazel method signature to align with the rollup plugin
resolveId API: https://rollupjs.org/guide/en/#resolveid

PR Close #41101
2021-03-08 10:06:46 -08:00
Kristiyan Kostadinov 1735430476 feat(localize): add scripts to migrate away from legacy message IDs (#41026)
Adds a new flag to `localize-extract` called `--migrateMapFile` which will generate a JSON file
that can be used to map legacy message IDs to cannonical ones.

Also includes a new script called `localize-migrate` that can take the mapping file which was
generated by `localize-extract` and migrate all of the IDs in the files that were passed in.

PR Close #41026
2021-03-08 10:05:42 -08:00
abarghoud cf5f86386f docs(core): add usage examples for APP_INITIALIZER token (#41095)
Add multiple usage examples for APP_INITIALIZER using Promise, Observable and multi providers

Closes #40730

PR Close #41095
2021-03-08 09:58:18 -08:00
JoostK fed6a7ce7d perf(compiler-cli): detect semantic changes and their effect on an incremental rebuild (#40947)
In Angular programs, changing a file may require other files to be
emitted as well due to implicit NgModule dependencies. For example, if
the selector of a directive is changed then all components that have
that directive in their compilation scope need to be recompiled, as the
change of selector may affect the directive matching results.

Until now, the compiler solved this problem using a single dependency
graph. The implicit NgModule dependencies were represented in this
graph, such that a changed file would correctly also cause other files
to be re-emitted. This approach is limited in a few ways:

1. The file dependency graph is used to determine whether it is safe to
   reuse the analysis data of an Angular decorated class. This analysis
   data is invariant to unrelated changes to the NgModule scope, but
   because the single dependency graph also tracked the implicit
   NgModule dependencies the compiler had to consider analysis data as
   stale far more often than necessary.
2. It is typical for a change to e.g. a directive to not affect its
   public API—its selector, inputs, outputs, or exportAs clause—in which
   case there is no need to re-emit all declarations in scope, as their
   compilation output wouldn't have changed.

This commit implements a mechanism by which the compiler is able to
determine the impact of a change by comparing it to the prior
compilation. To achieve this, a new graph is maintained that tracks all
public API information of all Angular decorated symbols. During an
incremental compilation this information is compared to the information
that was captured in the most recently succeeded compilation. This
determines the exact impact of the changes to the public API, which
is then used to determine which files need to be re-emitted.

Note that the file dependency graph remains, as it is still used to
track the dependencies of analysis data. This graph does no longer track
the implicit NgModule dependencies, which allows for better reuse of
analysis data.

These changes also fix a bug where template type-checking would fail to
incorporate changes made to a transitive base class of a
directive/component. This used to be a problem because transitive base
classes were not recorded as a transitive dependency in the file
dependency graph, such that prior type-check blocks would erroneously
be reused.

This commit also fixes an incorrectness where a change to a declaration
in NgModule `A` would not cause the declarations in NgModules that
import from NgModule `A` to be re-emitted. This was intentionally
incorrect as otherwise the performance of incremental rebuilds would
have been far worse. This is no longer a concern, as the compiler is now
able to only re-emit when actually necessary.

Fixes #34867
Fixes #40635
Closes #40728

PR Close #40947
2021-03-08 08:41:19 -08:00
Igor Minar 8c062493a0 refactor(core): don't use innerHTML in DOMTestComponentRenderer (#41099)
The use of innerHTML is unnecessary and causes TrustedType violations.

PR Close #41099
2021-03-08 08:39:09 -08:00
Andrew Kushnir 32dd3c5dd1 refactor(core): co-locate read/write patched data functions (#41097)
This commit refactors Ivy runtime code to move `readPatchedData` and `attachPatchedData` functions to a single
location for better maintainability and to make it easier to do further changes if needed.  The `readPatchedLView`
function was also moved to the same location (since it's a layer on top of the `readPatchedData` function).

PR Close #41097
2021-03-08 08:38:00 -08:00
Quentin Monmert c676ec1ce5 docs: fix some typos in angular.io examples (#41093)
This commit updates example code to make the spacing more consistent.

PR Close #41093
2021-03-05 15:08:11 -08:00
Alex Rickabaugh fbc9df181e feat(compiler-cli): support producing Closure-specific PURE annotations (#41021)
For certain generated function calls, the compiler emits a 'PURE' annotation
which informs Terser (the optimizer) about the purity of a specific function
call. This commit expands that system to produce a new Closure-specific
'pureOrBreakMyCode' annotation when targeting the Closure optimizer instead
of Terser.

PR Close #41021
2021-03-04 16:04:38 -08:00
Andrew Scott 45216ccc0d fix(language-service): Only provide dom completions for inline templates (#41078)
We currently provide completions for DOM elements in the schema as well
as attributes when we are in the context of an external template.
However, these completions are already provided by other extensions for
HTML contexts (like Emmet). To avoid duplication of results, this commit
updates the language service to exclude DOM completions for external
templates. They are still provided for inline templates because those
are not handled by the HTML language extensions.

PR Close #41078
2021-03-04 14:51:06 -08:00
arturovt 38524c4d29 fix(common): cleanup location change listeners when the root view is removed (#40867)
In the new behavior Angular cleanups `popstate` and `hashchange` event listeners
when the root view gets destroyed, thus event handlers are not added twice
when the application is bootstrapped again.

BREAKING CHANGE:

Methods of the `PlatformLocation` class, namely `onPopState` and `onHashChange`,
used to return `void`. Now those methods return functions that can be called
to remove event handlers.

PR Close #31546

PR Close #40867
2021-03-04 13:09:04 -08:00
abarghoud ca721c2972 feat(core): more precise type for `APP_INITIALIZER` token (#40986)
This commit updates the type of the `APP_INITIALIZER` injection token to
better document the expected types of values that Angular handles. Only
Promises and Observables are awaited and other types of values are ignored,
so the type of `APP_INITIALIZER` has been updated to
`Promise<unknown> | Observable<unknown> | void` to reflect this behavior.

BREAKING CHANGE:

The type of the `APP_INITIALIZER` token has been changed to more accurately
reflect the types of return values that are handled by Angular. Previously,
each initializer callback was typed to return `any`, this is now
`Promise<unknown> | Observable<unknown> | void`. In the unlikely event that
your application uses the `Injector.get` or `TestBed.inject` API to inject
the `APP_INITIALIZER` token, you may need to update the code to account for
the stricter type.

Additionally, TypeScript may report the TS2742 error if the `APP_INITIALIZER`
token is used in an expression of which its inferred type has to be emitted
into a .d.ts file. To workaround this, an explicit type annotation is needed,
which would typically be `Provider` or `Provider[]`.

Closes #40729

PR Close #40986
2021-03-04 12:01:07 -08:00
cexbrayat bf158e7ff0 fix(core): remove duplicated EMPTY_OBJ constant (#41066)
The codebase currently contains several `EMPTY_OBJ` constants,
and they can end up in the bundle of an application.
A recent commit 6fbe219 tipped us off
as it introduced several `noop` occurrences in the golden symbol files.
After investigating, we decided to remove the duplicated symbols.

This probably shaves only a few bytes,
but this commit removes the duplicated functions,
by always using the one in `core/src/utils/empty`.

PR Close #41066
2021-03-04 11:08:49 -08:00
Pete Bacon Darwin d44c7c209d refactor(compiler): remove unused `__BUILD_OPTIMIZER_*` constants (#41040)
These constants were created in a very early phase of Ivy development.
They have never been used in the framework, no the build-optimizer tool.

PR Close #41040
2021-03-04 11:04:27 -08:00
Pete Bacon Darwin 11e16c7b41 refactor(core): do not publish `ɵɵgetFactoryOf()` (#41040)
Previously, `ɵɵgetFactoryOf()` was "privately" published from
`@angular/core` since in the past it was assumed that this
might be an instruction generated by the compiler.

This is not currently the case, so this commit removes it from
the private exports and renames it to indicate that it is a local
helper function.

PR Close #41040
2021-03-04 11:04:27 -08:00
Pete Bacon Darwin 326f167075 refactor(core): remove `getFactoryOf` from `angularCoreDiEnv` (#41040)
This function is never actually generated directly so it can be removed
from the context passed to the JIT compiler.

PR Close #41040
2021-03-04 11:04:27 -08:00
Pete Bacon Darwin 89563442b8 refactor(compiler): remove unused `emitAllPartialModules()` and associated code (#41040)
This method does not appear to be used in the project.
This commit removes it and code that it exclusively
depended upon, or depended upon it.

PR Close #41040
2021-03-04 11:04:26 -08:00
Pete Bacon Darwin 7f24937f1c refactor(compiler): remove unused function (#41040)
The `accessExportScope()` function is not used anymore.

PR Close #41040
2021-03-04 11:04:26 -08:00
Pete Bacon Darwin 0f818f36d7 refactor(core): use `unknown` rather than `never` for private properties (#41040)
Before `unknown` was available, the `never` type was used to discourage
application developers from using "private" properties. The `unknown` type
is much better suited for this.

PR Close #41040
2021-03-04 11:04:26 -08:00
Chris ad40fcae7a docs: improve documentation on how to pass a stringified parameter list to HttpClient (#41010)
Fixes #40618

PR Close #41010
2021-03-04 11:00:23 -08:00
pavlenko 9ae0faa00a docs(router): fix typo for the equivalent `exactMatchOptions` value (#41075)
When `Router.isActive` is called with `true` the `exactMatchOptions` value is set for this case.

PR Close #41075
2021-03-04 10:58:30 -08:00
Alex Rickabaugh bb6e5e2dd0 fix(language-service): don't show external template diagnostics in ts files (#41070)
The compiler considers template diagnostics to "belong" to the source file
of the component using the template. This means that when diagnostics for
a source file are reported, it returns diagnostics of TS structures in the
actual source file, diagnostics for any inline templates, and diagnostics of
any external templates.

The Language Service uses a different model, and wants to show template
diagnostics in the actual .html file. Thus, it's not necessary (and in fact
incorrect) to include such diagnostics for the actual .ts file as well.
Doing this currently causes a bug where external diagnostics appear in the
TS file with "random" source spans.

This commit changes the Language Service to filter the set of diagnostics
returned by the compiler and only include those diagnostics with spans
actually within the .ts file itself.

Fixes #41032

PR Close #41070
2021-03-03 21:40:50 +00:00
Andrew Scott 0847a0353b fix(language-service): Always attempt HTML AST to template AST conversion for LS (#41068)
The current logic in the compiler is to bail when there are errors when
parsing a template into an HTML AST or when there are errors in the i18n
metadata. As a result, a template with these types of parse errors
_will not have any information for the language service_. This is because we
never attempt to conver the HTML AST to a template AST in these
scenarios, so there are no template AST nodes for the language service
to look at for information. In addition, this also means that the errors
are never displayed in the template to the user because there are no
nodes to map the error to.

This commit adds an option to the template parser to temporarily ignore
the html parse and i18n meta errors and always perform the template AST
conversion. At the end, the i18n and HTML parse errors are appended to
the returned errors list. While this seems risky, it at least provides
us with more information than we had before (which was 0) and it's only
done in the context of the language service, when the compiler is
configured to use poisoned data (HTML parse and i18n meta errors can be
interpreted as a "poisoned" template).

fixes angular/vscode-ng-language-service#1140

PR Close #41068
2021-03-03 21:13:58 +00:00
Andrew Scott 1e3c870ee6 fix(language-service): provide element completions after open tag < (#41068)
An opening tag `<` without any characters after it is interperted as a
text node (just a "less than" character) rather than the start of an
element in the template AST. This commit adjusts the autocomplete engine
to provide element autocompletions when the nearest character to the
left of the cursor is `<`.

Part of the fix for angular/vscode-ng-language-service#1140

PR Close #41068
2021-03-03 21:13:58 +00:00
Kristiyan Kostadinov 97b88f3631 fix(compiler): allow binding to autocomplete property on select and textarea elements (#40928)
Updates the schema to allow binding to the `autocomplete` property of a `textarea` or `select`.

Fixes #39490.

PR Close #40928
2021-03-03 10:00:27 -08:00
Andrew Scott 736b1f9fd4 fix(compiler): recover from an incomplete open tag at the end of a file (#41054)
The compiler's parsing code has logic to recover from incomplete open
tags (i.e. `<div`) but the recovery logic does not handle when the
incomplete tag is terminated by an EOF. This commit updates the logic to
allow for the EOF character to be interpreted as the end of the tag open
so that the parser can continue processing. It will then fail to find
the end tag and recover by marking the open tag as incomplete.

Part of https://github.com/angular/vscode-ng-language-service/issues/1140

PR Close #41054
2021-03-03 09:58:56 -08:00
Keen Yee Liau e9e7c33f3c fix(language-service): Add plugin option to force strictTemplates (#41062)
This commit adds a new configuration option, `forceStrictTemplates` to the
language service plugin to allow users to force enable `strictTemplates`.

This is needed so that the Angular extension can be used inside Google without
changing the underlying compiler options in the `ng_module` build rule.

PR Close #41062
2021-03-03 09:48:06 -08:00
Andrew Scott 10aa5641dd fix(language-service): only provide template results on reference requests (#41041)
VSCode only de-duplicates references results for "go to references" requests
but does not de-duplicate them for "find all references" requests. The
result is that users see duplicate references for results in TypeScript
files - one from the built-in TS extension and one from us.
While this is an issue in VSCode (see https://github.com/microsoft/vscode/issues/117095)
this commit provides a quick workaround on our end until it can be addressed there.

This commit should be reverted when microsoft/vscode/issues/117095 is resolved.

fixes https://github.com/angular/vscode-ng-language-service/issues/1124

PR Close #41041
2021-03-03 09:39:11 -08:00
Zach Arend 96f15f0de9 Revert "fix(animations): cleanup DOM elements when the root view is removed (#41001)" (#41056)
This reverts commit a31da48507.

PR Close #41056
2021-03-02 13:31:25 -08:00
Zach Arend 3370ade9a4 refactor(platform-browser): cast response of JSON.parse (#41020)
Casts the response of JSON.parse to `{}`, so that is not an `any` type.
This is because google3 does not allow the use of `any` type.

PR Close #41020
2021-03-01 15:48:24 -08:00
Kapunahele Wong 6c783c7fcb docs: rewrite structural-directives.md (#40015)
PR Close #40015
2021-03-01 15:32:26 -08:00
Andrew Scott 54b088967a refactor(compiler): remove unreachable code (#40984)
1. The error function throws, so no code after it is reachable.
2. Some switch statements are exhaustive, so no code after them are reachable.

PR Close #40984
2021-03-01 15:29:20 -08:00
arturovt a31da48507 fix(animations): cleanup DOM elements when the root view is removed (#41001)
Currently, when importing `BrowserAnimationsModule`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

BREAKING CHANGE:
DOM elements are now correctly removed when the root view is removed. It
is possible that tests could be accidentally relying on the old behavior by
trying to find an element that was not removed in a previous test. If
this is the case, the failing tests should be updated to ensure they
have proper setup code which initializes elements they rely on.

PR Close #41001
2021-03-01 15:28:04 -08:00
ivanwonder 8110cf0ed2 fix(language-service): can't provide the Input and Output custom binding property name (#41005)
Now the language service always uses the name of the JavaScript property on the
component or directive instance for this input or output. This PR will use the right
binding property name.

PR Close #41005
2021-03-01 15:26:42 -08:00
Pete Bacon Darwin 0b69fabcf5 fix(compiler-cli): ensure ngcc can handle wildcard base-paths (#41033)
Ngcc uses the `paths` property to compute the potential base-paths
for packages that are being processed. If the `paths` contain a wildcard
`*` within a path segment, ngcc was not finding the base-path correctly.

Now when a wildcard is found, there is an additional search to look for
paths that might match the wildcard.

Fixes #41014

PR Close #41033
2021-03-01 15:25:44 -08:00
cexbrayat e12d9dec64 fix(core): remove duplicated EMPTY_ARRAY constant (#40991)
The codebase currently contains several `EMPTY_ARRAY` constants,
and they can end up in the bundle of an application.
A recent commit 6fbe219 tipped us off
as it introduced several `noop` occurrences in the golden symbol files.
After investigating with @petebacondarwin,
we decided to remove the duplicated symbols.

This probably shaves only a few bytes,
but this commit removes the duplicated functions,
by always using the one in `core/src/utils/empty`.

PR Close #40991
2021-03-01 09:00:43 -08:00
Chris bebdeba5fd docs: improve description, examples of DecimalPipe's digitsInfo parameter (#40714)
Fixes #40671

PR Close #40714
2021-02-26 15:42:29 -08:00
cexbrayat 91cdc11aa0 fix(common): allow number or boolean as http params (#40663)
This change fixes an incompatibility between the old `@angular/http` package
and its successor (`@angular/common/http`) by re-introducing the types that were supported before.

It now allows to use number and boolean directly as HTTP params, instead of having to convert it to string first.

Before:

    this.http.get('/api/config', { params: { page: `${page}` } });

After:

    this.http.get('/api/config', { params: { page }});

`HttpParams` has also been updated to have most of its methods accept number or boolean values.

Fixes #23856

BREAKING CHANGE:

The methods of the `HttpParams` class now accept `string | number | boolean`
instead of `string` for the value of a parameter.
If you extended this class in your application,
you'll have to update the signatures of your methods to reflect these changes.

PR Close #40663
2021-02-26 12:03:50 -08:00
George Kalpakas 284af7308b fix(ngcc): do not fail hard when a format-path points to a non-existing or empty file (#40985)
Previously, when `ngcc` encountered an entry-point with a format-path
that pointed to a non-existing or empty file it would throw an error and
stop processing the remaining tasks.

In the past, we used to ignore such format-paths and continue processing
the rest of the tasks ([see code][1]). This was changed to a hard
failure in 2954d1b5ca. Looking at the code
history, the reason for changing the behavior was an (incorrect)
assumption that the condition could not fail. This assumption failed to
take into account the case where a 3rd-party library has an invalid
format-path in its `package.json`. This is an issue with the library,
but it should not prevent `ngcc` from processing other
packages/entry-points/formats.

This commit fixes this by reporting the task as failed but not throwing
an error, thus allowing `ngcc` to continue processing other tasks.

[1]: https://github.com/angular/angular/blob/3077c9a1f89c5bd75fb96c16e/packages/compiler-cli/ngcc/src/main.ts#L124

Fixes #40965

PR Close #40985
2021-02-26 08:26:33 -08:00
Benjamin Blackwood 6206d99b86 docs(forms): add array example to get method (#41008)
PR Close #41008
2021-02-26 08:24:22 -08:00
Andrew Scott 6c05c80f19 feat(router): Add more find-tuned control in `routerLinkActiveOptions` (#40303)
This commit adds more configurability to the `Router#isActive` method
and `RouterLinkActive#routerLinkActiveOptions`.
It allows tuning individual match options for query params and the url
tree, which were either both partial or both exact matches in the past.
Additionally, it also allows matching against the fragment and matrix
parameters.

fixes #13205

BREAKING CHANGE:
The type of the `RouterLinkActive.routerLinkActiveOptions` input was
expanded to allow more fine-tuned control. Code that previously read
this property may need to be updated to account for the new type.

PR Close #40303
2021-02-24 15:32:05 -08:00
Kristiyan Kostadinov 29d8a0ab09 feat(animations): add support for disabling animations through BrowserAnimationsModule.withConfig (#40731)
Currently the only way to disable animations is by providing the `NoopAnimationsModule`
which doesn't allow for it to be disabled based on runtime information. These changes
add support for disabling animations based on runtime information by using
`BrowserAnimationsModule.withConfig({disableAnimations: true})`.

PR Close #40731
2021-02-24 15:08:27 -08:00
Pete Bacon Darwin 3c24136b98 fix(compiler): ensure JIT compilation of ɵɵngDeclarePipe() works (#40929)
Previously the compiler was not evaluating the JIT compilation
of `ɵɵngDeclarePipe()` but there was no test to check it.

PR Close #40929
2021-02-24 15:07:08 -08:00
Keen Yee Liau e986a9787b fix(language-service): use single entry point for Ivy and View Engine (#40967)
Currently there are two entry points for the `@angular/language-service`
package:

- `@angular/language-service`
  This default entry point is for View Engine LS. Through the redirection
  of `main` field in `package.json`, it resolves to
  `./bundles/language-service.js`.
- `@angular/language-service/bundles/ivy.js`
  This secondary entry point is for Ivy LS.

TypeScript recently changed the behavior of tsserver to allow only package
names as plugin names [1] for security reasons. This means the secondary
entry point for Ivy LS can no longer be used.
We implemented a quick hack in the module resolver (in the extension repo)
to fix this, but the long term fix should be in `@angular/language-service`.

Here, the `main` field in `package.json` is changed to `index.js`, and in the
index file we conditionally load View Engine or Ivy based on the input config.
This eliminates the need for multiple entry points.

As part of this PR, I also removed all source code for View Engine and Ivy
included in the NPM package. Consumers of this package should run the bundled
output and nothing else. This would help us prevent an accidental import that
results in execution of unbundled code.

[1]: https://github.com/microsoft/TypeScript/pull/42713

PR Close #40967
2021-02-24 15:05:44 -08:00
Pete Bacon Darwin 51a79772b2 test(localize): ensure tests pass on Windows (#40952)
These tests were relying upon unix-like paths, which
caused them to fail on Windows.

Note that the `filegroup` Bazel rule tends not to work well
on Windows, so this has been replaced with `copy_to_bin`
instead.

PR Close #40952
2021-02-24 14:27:07 -08:00
Pete Bacon Darwin 8d13f631d9 refactor(ngcc): support processing only the typings files of packages (#40976)
Some tools (such as Language Server and ng-packagr) only care about
the processed typings generated by ngcc. Forcing these tools to process
the JavaScript files as well has two disadvantages:

First, unnecessary work is being done, which is time consuming.

But more importantly, it is not always possible to know how the final bundling
tools will want the processed JavaScript to be configured. For example,
the CLI would prefer the `--create-ivy-entry-points` option but this would
break non-CLI build tooling.

This commit adds a new option (`--typings-only` on the command line, and
`typingsOnly` via programmatic API) that instructs ngcc to only render changes
to the typings files for the entry-points that it finds, and not to write any
JavaScript files.

In order to process the typings, a JavaScript format will need to be analysed, but
it will not be rendered to disk. When using this option, it is best to offer ngcc a
wide range of possible JavaScript formats to choose from, and it will use the
first format that it finds. Ideally you would configure it to try the `ES2015` FESM
format first, since this will be the most performant.

Fixes #40969

PR Close #40976
2021-02-24 14:23:14 -08:00
Andrew Scott d1535a1a77 test(language-service): remove circular dependency (#40966)
This commit removes the circular dependency from buffer->util->project->buffer.

PR Close #40966
2021-02-24 08:54:35 -08:00
Andrew Scott cf687fe8ab refactor(language-service): Remove old testing helpers (#40966)
All specs have been switched to the new testing package. The old test
helpers are no longer needed.

PR Close #40966
2021-02-24 08:54:35 -08:00
Andrew Scott dcee784b4f refactor(language-service): convert references_spec to new testing package (#40966)
refactor(language-service): convert references_spec to new testing package

PR Close #40966
2021-02-24 08:54:35 -08:00