Skip to content

Commit 1c21e47

Browse files
cexbrayatdgp1130
authored andcommitted
feat(@schematics/angular): enable error on unknown properties and elements in tests
These new options have been introduced in Angular v14. The commit enables the option in a new project, as we did when we introduced the `destroyAfterOption`, with the same long term goal to have these options enabled by default.
1 parent 074c7cb commit 1c21e47

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

packages/angular_devkit/build_angular/test/hello-world-app/src/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ declare const require: {
2323
};
2424

2525
// First, initialize the Angular testing environment.
26-
getTestBed().initTestEnvironment(
27-
BrowserDynamicTestingModule,
28-
platformBrowserDynamicTesting(),
29-
);
26+
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
27+
errorOnUnknownElements: true,
28+
errorOnUnknownProperties: true
29+
});
3030
// Then we find all the tests.
3131
const context = require.context('./', true, /\.spec\.ts$/);
3232
// And load the modules.

packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/src/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ declare const require: {
2424
};
2525

2626
// First, initialize the Angular testing environment.
27-
getTestBed().initTestEnvironment(
28-
BrowserDynamicTestingModule,
29-
platformBrowserDynamicTesting(),
30-
);
27+
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
28+
errorOnUnknownElements: true,
29+
errorOnUnknownProperties: true
30+
});
3131
// Then we find all the tests.
3232
const context = require.context('./', true, /\.spec\.ts$/);
3333
// And load the modules.

packages/schematics/angular/application/files/src/test.ts.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ declare const require: {
1515
};
1616

1717
// First, initialize the Angular testing environment.
18-
getTestBed().initTestEnvironment(
19-
BrowserDynamicTestingModule,
20-
platformBrowserDynamicTesting(),
21-
);
18+
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
19+
errorOnUnknownElements: true,
20+
errorOnUnknownProperties: true
21+
});
2222

2323
// Then we find all the tests.
2424
const context = require.context('./', true, /\.spec\.ts$/);

packages/schematics/angular/library/files/src/test.ts.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ declare const require: {
1616
};
1717

1818
// First, initialize the Angular testing environment.
19-
getTestBed().initTestEnvironment(
20-
BrowserDynamicTestingModule,
21-
platformBrowserDynamicTesting(),
22-
);
19+
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
20+
errorOnUnknownElements: true,
21+
errorOnUnknownProperties: true
22+
});
2323

2424
// Then we find all the tests.
2525
const context = require.context('./', true, /\.spec\.ts$/);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy