Commit graph

88 commits

Author SHA1 Message Date
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
8bf97d1370 build: remove all usages of the interop_deps attr for ts_project and ng_project (#62732)
Remove all of the usages of interop_deps as attributes in the repo

PR Close #62732
2025-07-21 13:03:09 -04:00
Joey Perrott
b84859073b build: migrate to use web test runner rules (#62292)
Migrate karma tests throughout the repo to use the new web test runner based rule instead

PR Close #62292
2025-06-26 17:19:10 +00:00
Mansi Shrivastava
7426dbbd56 refactor(common): allow HttpErrorResponse with successful status codes (#61107)
This adds the ability to mock out errors even when successful status codes are returned.

Fixes #26161

PR Close #61107
2025-06-25 17:01:18 +00:00
Joey Perrott
3a0cfd544d build: migrate to using new jasmine_test (#62086)
Use the new jasmine_test based on rules_js instead of jasmine_node_test from rules_nodejs

PR Close #62086
2025-06-18 08:27:26 +02:00
Joey Perrott
3440338d45 build: migrate common to use rules_js based toolchain (#61433)
Migrate packages/common to use ts_project and ng_project.

PR Close #61433
2025-05-20 15:07:56 +00:00
Paul Gschwendtner
032b802f54 build: remove irrelevant madge circular deps tests (#61156)
We don't need this tooling anymore because we are already validating
that there are no circular dependencies via the `ng-dev` tooling that
checks `.ts` files directly.

Also these tests never actually failed to my knowledge.

PR Close #61156
2025-05-07 11:28:59 -07:00
Andrew Kushnir
3fa7b2b136 refactor(common): convert scripts within packages/common to relative imports (#60623)
This commit updates scripts within `packages/common` to relative imports as a prep work to the upcoming infra updates.

PR Close #60623
2025-04-01 15:58:51 +00:00
Matthieu Riegler
0034ce5583 refactor(http): Don't log fetch warning in tests. (#59049)
Prior to this commit, we were logging the `NOT_USING_FETCH_BACKEND_IN_SSR` error when `provideHttpTestingClient` and `PLATFORM_ID` were provided.

fixes #59028

PR Close #59049
2024-12-05 16:12:55 -08:00
Joey Perrott
9dbe6fc18b refactor: update license text to point to angular.dev (#57901)
Update license text to point to angular.dev instead of angular.io

PR Close #57901
2024-09-24 15:33:00 +02:00
Joey Perrott
3bdead1b2f refactor(docs-infra): migrate api-gen from dev-infra into the repo (#57241)
Move the api-gen pipeline into the shared-docs directory.

PR Close #57241
2024-08-05 17:06:29 +00:00
Matthieu Riegler
f914f6a362 feat(migrations): Migration schematics for HttpClientModule (#54020)
This migration will allow developers to migrate the deprecated `HttpClientModule`, `HttpClientJsonpModule` & `HttpClientXsrfModule` to their respective provider functions.

PR Close #54020
2024-04-23 12:12:31 -07:00
Matthieu Riegler
ef665a40a5 refactor(http): Deprecate HttpClientModule & related modules (#54020)
This commit deprecates the `HttpClientModule` and other related http modules. Those can be replaced by provider function only.

Angular is an opinionated framework, feature guidance will help developer choose the recommended way to enable feature (like Http requests here).

Note: This is not an indication of deprecation for `NgModule`. The deprecated module's only purpose here was to define providers. This can be done directly by the provide function pattern.

DEPRECATED: `HttpClientModule`, `HttpClientXsrfModule` and `HttpClientJsonpModule`

As mentionned, those modules can be replaced by provider function only.

PR Close #54020
2024-04-23 12:12:31 -07:00
Andrew Scott
6993146a25 refactor(http): Do not contribute to stability when using provideHttpClientTesting (#54974)
`HttpClient` uses the `PendingTasks` service to contribute to
application stability. This was added in v16 to support SSR without
relying on an infinite `setTimeout` with ZoneJS like it did pre-v16.
Prior to version 16, this was also only done on the server and did not
affect clients or unit tests (28c68f709c).

Today, `PendingTasks` contribute to `ApplicationRef.isStable` but do not
contribute to the stability of `ComponentFixture`. This divergence in
stability behavior was not intended and we plan to make these two
stability indicators the same again, like they were when it was solely
based on the state of the Zone.

By aligning the two behaviors again, this would include all pending
tasks in the stability of fixtures. After investigation, this seems
likely to be a pretty large breaking change. Tests appear to quite often use
`await fixture.whenStable` when there are unfinished requests that have
not been mocked or flushed.

This change prevents request in `HttpClient` from contributing to
stability through the `PendingTasks` automatically but only when using
`HttpClientTesting`. In this scenario, requests need to be expected and
flushed manually for them to resolve. When the test backend and controllers
aren't used, requests should resolve on their own so `await fixture.whenStable`
shouldn't be particularly affected or problematic.

PR Close #54974
2024-04-10 09:27:40 -07:00
Matthieu Riegler
55fd7b3c85 docs(docs-infra): Add missing api entries (#54517)
This commit adds `common/http/testing` and `platform-browser/animations/async`.

PR Close #54517
2024-02-20 09:50:36 -08:00
Joey Perrott
0460a9dfaf refactor: migrate common to prettier formatting (#54150)
Migrate formatting to prettier for common from clang-format

PR Close #54150
2024-01-30 16:08:07 +00:00
Matthieu Riegler
89ab1c18a1 refactor(common): Use Nullish coalescing assignment when possible. (#53931)
Inspired by #53923, lets simplify code when possible.

PR Close #53931
2024-01-26 16:58:36 +00:00
Matthieu Riegler
08f4c5221a build: add missing entries for the api extraction (#52452)
Were missing :

* `@angular/common/http/testing`
* `@angular/platform-browser/animations/async`

PR Close #52452
2023-10-31 14:53:34 -07:00
alkavats1
66824b7715 refactor: removed the unused declaration in the import statement (#50616)
ngmodule and httpclient modeule is removed from the provider.ts file from the import statement

PR Close #50616
2023-06-22 09:39:58 -07:00
Paul Gschwendtner
424035730a refactor: update packages/common tests to work with ESM pipeline (#48521)
We no longer have generated `.js` files as everything generated
is the ESM `.mjs` output. The tests need to be updated to reflect that.

PR Close #48521
2022-12-19 19:50:42 +00:00
Paul Gschwendtner
c9415e4d75 build: ensure bootstrap transitive runfiles are made available (#48521)
Since we generate a `.mjs` file as entry-point for jasmine tests,
a couple of issues prevented the transitive dependencies from
bootstrap targets to be brought in (causing resolution errors):

1. The `_files` (previously `_esm2015`) targets are no longer needed,
   and they also miss all the information on runfiles.
2. The aspect for computing linker mappings does not respect the
   `bootstrap` attribute from the `spec_entrypoint` so we manually
   add the extract ESM output targets (this rule works with the aspect
   and forwards linker mappings).

PR Close #48521
2022-12-19 19:50:41 +00:00
Paul Gschwendtner
20551503fa build: replace _es2015 shorthand with more flexible _files suffix (#48521)
For every `ts_library` target we expose a shorthand that grants
access to the JS files because `DefaultInfo` of a ts library
only exposes the `.d.ts` files.

We rename this away from `es2015` since in practice it's a much
higher target these days. Additionally we no longer use the devmode
output but rather use the prodmode output which has the explicit
`.mjs` output- compatible with ESM.

PR Close #48521
2022-12-19 19:50:41 +00:00
Joey Perrott
303bb4d27c build: reformat BUILD files (#48181)
Reformat BUILD file usage of globs.

PR Close #48181
2022-11-22 21:22:34 +00:00
Derek Cormier
431c562815 build(bazel): add bazel targets for aio doc generation
This is an incremental step to produce dgeni output with bazel. The
generated outputs are not yet used by other targets.
2022-11-22 13:51:16 -07:00
Alex Rickabaugh
84d0d33c35 feat(http): introduce provideHttpClientTesting provider function (#47502)
This commit introduces the `provideHttpClientTesting()` function as an
alternative to the `HttpClientTestingModule` (in fact, the NgModule is
converted internally to just use the new provider function).

PR Close #47502
2022-10-06 19:02:45 +00:00
Paul Gschwendtner
68597bb0ca feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405)
Speeds up the dev-turnaround by only bundling types when packaging. Currently
bundling occurs for all the `ng_module` targets in devmode.

This has various positive benefits:

* Avoidance of this rather slower operation in development
* Makes APF-built packages also handle types for `ts_library` targets consistently.
* Allows us to ensure APF entry-points have `d.ts` _always_ bundled (working with ESM
module resolution in TypeScript -- currently experimental)
* Allows us to remove the secondary `package.json` files from APF (maybe APF v14? - seems
low-impact). This would clean-up the APF even more and fix resolution issues (like in Vite)

PR Close #45405
2022-04-21 11:09:39 -07:00
Andrew Scott
03ab7053ce build: fix test for useUnknownInCatch (#44935)
CI ran before the change to the tsconfig file

PR Close #44935
2022-02-01 23:40:17 +00:00
JoostK
a2cbffc06f fix(common): include query parameters for open HTTP requests in verify (#44917)
When `HttpTestingController.verify` is used to verify that there are not open,
unexpected requests it would throw an error with the method and URL of all pending
requests, excluding the query parameters. This is confusing, as e.g. `expectOne`
matches a URL including its query parameters and `expectOne` does include the
query parameters when it reports when no request could be matched.

This commit changes the error that is reported by `verify` to include the query
parameters.

Closes #19974

PR Close #44917
2022-02-01 21:41:43 +00:00
Andrew Scott
fdfcef5a0a build: enable useUnknownInCatchVariables (#44679)
This unblocks the internal migration to turn the option on in g3.

PR Close #44679
2022-02-01 18:17:29 +00:00
Paul Gschwendtner
c46d533b22 build: switch devmode output to es2015 (#44505)
To make our test output i.e. devmode output more aligned
with what we produce in the NPM packages, or to be more
aligned with what Angular applications will usually consume,
the devmode output is switched from ES5 to ES2015.

Additionally various tsconfigs (outside of Bazel) have been
updated to match with the other parts of the build. The rules
are:

ES2015 for test configurations, ES2020 for actual code that will
end up being shipped (this includes the IDE-only tsconfigs).

PR Close #44505
2022-01-05 23:20:20 +00:00
Paul Gschwendtner
489cf42cd0 fix(common): incorrect error type for XHR errors in TestRequest (#36082)
Currently the `HttpClient` always wraps errors from XHR requests, but
the underlying errors are always of type `ProgressEvent`, or don't have
a native error if the status code is just indicating failure (e.g. 404).

This behavior does not match in the `TestRequest` class provided by
`@angular/common/http/testing` where errors are considered being
of type `ErrorEvent`. This is incorrect because `ErrorEvent`s provide
information for errors in scripts or files which are evaluated. Since
the `HttpClient` never evaluates scripts/files, and also since XHR requests
clearly are documented to emit `ProgressEvent`'s, we should change the
`TestSupport` to retrieve such `ProgressEvent`'s instead of incompatible
objects of type `ErrorEvent`.

In favor of having a deprecation period, we keep supporting `ErrorEvent`
in the `TestRequest.error` signature. Eventually, we can remove this
signature in the future.

Resources:
  * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/error_event
  * https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent
  * https://xhr.spec.whatwg.org/#event-xhr-errpr

Related to: https://github.com/angular/angular/issues/34748.

DEPRECATED: `TestRequest` from `@angular/common/http/testing` no longer
accepts `ErrorEvent` when simulating XHR errors. Instead instances of
`ProgressEvent` should be passed, matching with the native browser behavior.

PR Close #36082
2021-11-19 21:26:52 +00:00
Quentin Focheux
baadd109aa test(http): use HttpStatusCode enum in tests (#23548)
Now that we have introduced human-readable http status codes,
we can use it in our tests to improve clarity.

PR Close #23548
2021-01-28 09:10:48 -08:00
Ajit Singh
3c474ecf56 fix(common): add boolean to valid json for testing (#37893)
boolean is a valid json but at present we cannot test Http request using boolean added support for boolean requests

Fixes #20690

PR Close #37893
2020-10-05 17:07:41 -07:00
Joey Perrott
d1ea1f4c7f build: update license headers to reference Google LLC (#37205)
Update the license headers throughout the repository to reference Google LLC
rather than Google Inc, for the required license headers.

PR Close #37205
2020-05-26 14:26:58 -04:00
Igor Minar
d578ab8f3c build: simplify package.jsons for all of our packages (#36944)
We can remove all of the entry point resolution configuration from the package.json
in our source code as ng_package rule adds the properties automatically and correctly
configures them.

This change simplifies our code base but doesn't have any impact on the package.json
in the distributed npm_packages.

PR Close #36944
2020-05-06 13:54:26 -07:00
Joey Perrott
698b0288be build: reformat repo to new clang@1.4.0 (#36613)
PR Close #36613
2020-04-14 12:08:36 -07:00
cexbrayat
c77cf717aa test(common): unit test for http/testing expectOne with several requests (#27005)
PR Close #27005
2020-01-31 13:13:38 -08:00
cexbrayat
115b7e42c6 fix(common): http/testing expectOne lists the received requests if no matches (#27005)
Fixes #18013

Previously it was hard to debug an `expectOne` if the request had no match, as the error message was:

    Expected one matching request for criteria "Match URL: /some-url?query=hello", found none.

This commit adds a bit more info to the error, by listing the actual requests received:

    Expected one matching request for criteria "Match URL: /some-url?query=hello", found none. Requests received are: POST /some-url?query=world.

PR Close #27005
2020-01-31 13:13:37 -08:00
cexbrayat
a622a281d3 test(common): unit tests for http/testing expectOne (#27005)
PR Close #27005
2020-01-31 13:13:37 -08:00
Paul Gschwendtner
970b22f98e test: setup circular dependency tests for all entry points (#34774)
Sets up circular dependency tests for all entry-points in the
project (except for the ones part of a deprecated package).

PR Close #34774
2020-01-23 11:36:40 -08:00
Greg Magolan
a28c02bf89 build: derive ts_library dep from jasmine_node_test boostrap label if it ends in _es5 (#34736)
PR Close #34736
2020-01-15 14:58:07 -05:00
Greg Magolan
aee67f08d9 test: handle bootstrap templated_args in jasmine_node_test defaults.bzl (#34736)
PR Close #34736
2020-01-15 14:58:07 -05:00
Greg Magolan
dcff76e8b9 refactor: handle breaking changes in rules_nodejs 1.0.0 (#34736)
The major one that affects the angular repo is the removal of the bootstrap attribute in nodejs_binary, nodejs_test and jasmine_node_test in favor of using templated_args --node_options=--require=/path/to/script. The side-effect of this is that the bootstrap script does not get the require.resolve patches with explicitly loading the targets _loader.js file.

PR Close #34736
2020-01-15 14:58:07 -05:00
atscott
538d0446b5 Revert "refactor: handle breaking changes in rules_nodejs 1.0.0 (#34589)" (#34730)
This reverts commit 9bb349e1c8.

PR Close #34730
2020-01-10 14:12:15 -08:00
atscott
5e60215470 Revert "test: handle bootstrap templated_args in jasmine_node_test defaults.bzl (#34589)" (#34730)
This reverts commit da4782e67f.

PR Close #34730
2020-01-10 14:12:15 -08:00
atscott
24679d8676 Revert "build: derive ts_library dep from jasmine_node_test boostrap label if it ends in _es5 (#34589)" (#34730)
This reverts commit 79a0d007b4.

PR Close #34730
2020-01-10 14:12:14 -08:00
Greg Magolan
79a0d007b4 build: derive ts_library dep from jasmine_node_test boostrap label if it ends in _es5 (#34589)
PR Close #34589
2020-01-10 08:32:00 -08:00
Greg Magolan
da4782e67f test: handle bootstrap templated_args in jasmine_node_test defaults.bzl (#34589)
PR Close #34589
2020-01-10 08:31:59 -08:00
Greg Magolan
9bb349e1c8 refactor: handle breaking changes in rules_nodejs 1.0.0 (#34589)
The major one that affects the angular repo is the removal of the bootstrap attribute in nodejs_binary, nodejs_test and jasmine_node_test in favor of using templated_args --node_options=--require=/path/to/script. The side-effect of this is that the bootstrap script does not get the require.resolve patches with explicitly loading the targets _loader.js file.

PR Close #34589
2020-01-10 08:31:59 -08:00
Paul Gschwendtner
6d3a25d897 ci: run acceptance tests on saucelabs with ivy (#34277)
Currently we only run Saucelabs on PRs using the legacy View Engine
build. Switching that build to Ivy is not trivial and there are various
options:

  1. Updating the R3 switches to use POST_R3 by default. At first glance,
  this doesn't look easy because the current ngtsc switch logic seems to
  be unidirectional (only PRE_R3 to POST_R3).

  2. Updating the legacy setup to run with Ivy. This sounds like the easiest
  solution at first.. but it turns out to be way more complicated. Packages
  would need to be built with ngtsc using legacy tools (i.e. first building
  the compiler-cli; and then building packages) and View Engine only tests
  would need to be determined and filtered out. Basically it will result in
  re-auditing all test targets. This is contradictory to the fact that we have
  this information in Bazel already.

  3. Creating a new job that runs tests on Saucelabs with Bazel. We specify
  fine-grained test targets that should run. This would be a good start
  (e.g. acceptance tests) and also would mean that we do not continue maintaining
  the legacy setup..

This commit implements the third option as it allows us to move forward
with the general Bazel migration. We don't want to spend too much time
on our legacy setup since it will be removed anyway in the future.

PR Close #34277
2019-12-16 07:43:41 -08:00