Allow failing on undefined element/properties
vhdirk opened this issue · comments
Description
Since angular14, there is support for letting tests fail when encountering unknown components or directives:
angular/angular#36430 (comment)
Proposed solution
It's be great of this could be defined as follows:
const createComponent = createComponentFactory({
component: MyComponent,
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
});
or globally like (in test.ts):
import { defineGlobalsInjections } from '@ngneat/spectator';
defineGlobalsInjections({
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
});
Alternatives considered
The issue comment talks about enabling this globally using
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{
errorOnUnknownElements: true,
errorOnUnknownProperties: true
}
);
but I cannot get that to work, it keeps complaining:
● Test suite failed to run
Cannot set base providers because it has already been called
Do you want to create a pull request?
No