From edfc5a9c3b60b93f351102b253524f29c2ba4ff4 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Thu, 28 Mar 2024 10:28:58 -0700 Subject: [PATCH] refactor(core): private export token to disable `fixture.detectChanges` error (#55098) While we do want to discourage `fixture.detectChanges`, it is yet to be determined how this should be accomplished (warning, documentation, etc.). At the moment, not being able to disable the error at all is entirely prohibitive for existing test suites to use zoneless change detection in tests. We would much rather allow existing test suites to disable the error and use the zoneless change detection than prevent them from using it entirely until all the `detectChanges` calls have been fixed. Calling `detectChanges` manually can hide errors related to change detection timing, but it is even worse when the "PseudoApplication" fixture used (since it runs change detection _only_ on the component rather than through `ApplicationRef`). PR Close #55098 --- packages/core/testing/private_export.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 packages/core/testing/private_export.ts diff --git a/packages/core/testing/private_export.ts b/packages/core/testing/private_export.ts new file mode 100644 index 00000000000..eedde47d2fa --- /dev/null +++ b/packages/core/testing/private_export.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +export {AllowDetectChangesAndAcknowledgeItCanHideApplicationBugs as ɵAllowDetectChangesAndAcknowledgeItCanHideApplicationBugs} from './src/test_bed_common';