MCPcopy
hub / github.com/angular/angular / TestBedImpl

Class TestBedImpl

packages/core/testing/src/test_bed.ts:213–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211 * TestBed is the primary api for writing unit tests for Angular applications and libraries.
212 */
213export class TestBedImpl implements TestBed {
214 private static _INSTANCE: TestBedImpl | null = null;
215
216 static get INSTANCE(): TestBedImpl {
217 return (TestBedImpl._INSTANCE = TestBedImpl._INSTANCE || new TestBedImpl());
218 }
219
220 /**
221 * Teardown options that have been configured at the environment level.
222 * Used as a fallback if no instance-level options have been provided.
223 */
224 private static _environmentTeardownOptions: ModuleTeardownOptions | undefined;
225
226 /**
227 * "Error on unknown elements" option that has been configured at the environment level.
228 * Used as a fallback if no instance-level option has been provided.
229 */
230 private static _environmentErrorOnUnknownElementsOption: boolean | undefined;
231
232 /**
233 * "Error on unknown properties" option that has been configured at the environment level.
234 * Used as a fallback if no instance-level option has been provided.
235 */
236 private static _environmentErrorOnUnknownPropertiesOption: boolean | undefined;
237
238 /**
239 * Teardown options that have been configured at the `TestBed` instance level.
240 * These options take precedence over the environment-level ones.
241 */
242 private _instanceTeardownOptions: ModuleTeardownOptions | undefined;
243
244 /**
245 * Defer block behavior option that specifies whether defer blocks will be triggered manually
246 * or set to play through.
247 */
248 private _instanceDeferBlockBehavior = DEFER_BLOCK_DEFAULT_BEHAVIOR;
249
250 /**
251 * Animations behavior option that specifies whether animations are enabled or disabled.
252 */
253 private _instanceAnimationsEnabled = ANIMATIONS_ENABLED_DEFAULT;
254
255 /**
256 * "Error on unknown elements" option that has been configured at the `TestBed` instance level.
257 * This option takes precedence over the environment-level one.
258 */
259 private _instanceErrorOnUnknownElementsOption: boolean | undefined;
260
261 /**
262 * "Error on unknown properties" option that has been configured at the `TestBed` instance level.
263 * This option takes precedence over the environment-level one.
264 */
265 private _instanceErrorOnUnknownPropertiesOption: boolean | undefined;
266
267 /**
268 * Stores the previous "Error on unknown elements" option value,
269 * allowing to restore it in the reset testing module logic.
270 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…