mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-28 03:21:40 +01:00
[PM-18599] Forbid unknown property and element in tests (#13556)
Fail tests when relying on unknownProperties or unknownElements. Existing instances are whitelist and have tickets created and assigned to the relevant teams.
This commit is contained in:
parent
e6e6058f9e
commit
cec117459b
@ -1,4 +1,4 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
import { addCustomMatchers } from "@bitwarden/common/spec";
|
||||
|
||||
addCustomMatchers();
|
||||
|
@ -32,6 +32,7 @@
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
"@bitwarden/ui-common": ["../../libs/ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["../../libs/ui/common/src/setup-jest"],
|
||||
"@bitwarden/vault-export-core": [
|
||||
"../../libs/tools/export/vault-export/vault-export-core/src"
|
||||
],
|
||||
|
@ -1,4 +1,4 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -31,6 +31,7 @@
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
"@bitwarden/ui-common": ["../../libs/ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["../../libs/ui/common/src/setup-jest"],
|
||||
"@bitwarden/vault-export-core": [
|
||||
"../../libs/tools/export/vault-export/vault-export-core/src"
|
||||
],
|
||||
|
@ -70,6 +70,8 @@ describe("RecoverTwoFactorComponent", () => {
|
||||
},
|
||||
],
|
||||
imports: [I18nPipe],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownElements: false,
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(RecoverTwoFactorComponent);
|
||||
|
@ -66,6 +66,9 @@ describe("BreachReportComponent", () => {
|
||||
useValue: mock<I18nService>(),
|
||||
},
|
||||
],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownElements: false,
|
||||
errorOnUnknownProperties: false,
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
@ -84,6 +84,9 @@ describe("ExposedPasswordsReportComponent", () => {
|
||||
},
|
||||
],
|
||||
schemas: [],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownElements: false,
|
||||
errorOnUnknownProperties: false,
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
@ -82,6 +82,8 @@ describe("InactiveTwoFactorReportComponent", () => {
|
||||
},
|
||||
],
|
||||
schemas: [],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownElements: false,
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
@ -77,6 +77,8 @@ describe("ReusedPasswordsReportComponent", () => {
|
||||
},
|
||||
],
|
||||
schemas: [],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownElements: false,
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
@ -86,6 +86,8 @@ describe("UnsecuredWebsitesReportComponent", () => {
|
||||
},
|
||||
],
|
||||
schemas: [],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownElements: false,
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
@ -85,6 +85,8 @@ describe("WeakPasswordsReportComponent", () => {
|
||||
},
|
||||
],
|
||||
schemas: [],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownElements: false,
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -26,6 +26,7 @@
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
"@bitwarden/ui-common": ["../../libs/ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["../../libs/ui/common/src/setup-jest"],
|
||||
"@bitwarden/vault-export-core": [
|
||||
"../../libs/tools/export/vault-export/vault-export-core/src"
|
||||
],
|
||||
|
@ -1 +1 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
@ -22,6 +22,7 @@
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
"@bitwarden/ui-common": ["../../libs/ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["../../libs/ui/common/src/setup-jest"],
|
||||
"@bitwarden/vault-export-core": [
|
||||
"../../libs/tools/export/vault-export/vault-export-core/src"
|
||||
],
|
||||
|
@ -27,6 +27,7 @@
|
||||
"@bitwarden/key-management-ui": ["../../libs/key-management-ui/src"],
|
||||
"@bitwarden/platform": ["../../libs/platform/src"],
|
||||
"@bitwarden/ui-common": ["../../libs/ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["../../libs/ui/common/src/setup-jest"],
|
||||
"@bitwarden/send-ui": ["../../libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../../libs/tools/card/src"],
|
||||
"@bitwarden/vault": ["../../libs/vault/src"],
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { webcrypto } from "crypto";
|
||||
|
||||
import { addCustomMatchers } from "@bitwarden/common/spec";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
addCustomMatchers();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -1 +1 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
@ -21,7 +21,8 @@
|
||||
"paths": {
|
||||
"@bitwarden/common/*": ["../common/src/*"],
|
||||
"@bitwarden/platform": ["../platform/src"],
|
||||
"@bitwarden/ui-common": ["../ui/common/src"]
|
||||
"@bitwarden/ui-common": ["../ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["../ui/common/src/setup-jest"]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -24,6 +24,7 @@
|
||||
"@bitwarden/send-ui": ["../tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["../tools/card/src"],
|
||||
"@bitwarden/ui-common": ["../ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["../ui/common/src/setup-jest"],
|
||||
"@bitwarden/vault-export-core": ["../tools/export/vault-export/vault-export-core/src"],
|
||||
"@bitwarden/vault-export-ui": ["../tools/export/vault-export/vault-export-ui/src"],
|
||||
"@bitwarden/vault": ["../vault/src"]
|
||||
|
@ -1 +1 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
@ -51,6 +51,8 @@ describe("SendListFiltersComponent", () => {
|
||||
{ provide: BillingAccountProfileStateService, useValue: billingAccountProfileStateService },
|
||||
{ provide: AccountService, useValue: accountService },
|
||||
],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownProperties: false,
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SendListFiltersComponent);
|
||||
|
@ -1 +1 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
@ -11,5 +11,13 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/bitwarden/clients"
|
||||
},
|
||||
"license": "GPL-3.0"
|
||||
"license": "GPL-3.0",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./src/index.ts"
|
||||
},
|
||||
"./setup-jest": {
|
||||
"import": "./src/setup-jest.ts"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
libs/ui/common/src/setup-jest.ts
Normal file
12
libs/ui/common/src/setup-jest.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import { getTestBed } from "@angular/core/testing";
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting,
|
||||
} from "@angular/platform-browser-dynamic/testing";
|
||||
|
||||
getTestBed().resetTestEnvironment();
|
||||
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
|
||||
errorOnUnknownElements: true,
|
||||
errorOnUnknownProperties: true,
|
||||
});
|
@ -32,6 +32,8 @@ describe("CipherFormGeneratorComponent", () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CipherFormGeneratorComponent],
|
||||
providers: [{ provide: I18nService, useValue: { t: (key: string) => key } }],
|
||||
// FIXME(PM-18598): Replace unknownElements and unknownProperties with actual imports
|
||||
errorOnUnknownProperties: false,
|
||||
})
|
||||
.overrideComponent(CipherFormGeneratorComponent, {
|
||||
remove: { imports: [GeneratorModule] },
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { webcrypto } from "crypto";
|
||||
import "jest-preset-angular/setup-jest";
|
||||
import "@bitwarden/ui-common/setup-jest";
|
||||
|
||||
Object.defineProperty(window, "CSS", { value: null });
|
||||
Object.defineProperty(window, "getComputedStyle", {
|
||||
|
@ -38,6 +38,7 @@
|
||||
"@bitwarden/send-ui": ["./libs/tools/send/send-ui/src"],
|
||||
"@bitwarden/tools-card": ["./libs/tools/card/src"],
|
||||
"@bitwarden/ui-common": ["./libs/ui/common/src"],
|
||||
"@bitwarden/ui-common/setup-jest": ["./libs/ui/common/src/setup-jest"],
|
||||
"@bitwarden/vault-export-core": ["./libs/tools/export/vault-export/vault-export-core/src"],
|
||||
"@bitwarden/vault-export-ui": ["./libs/tools/export/vault-export/vault-export-ui/src"],
|
||||
"@bitwarden/vault": ["./libs/vault/src"],
|
||||
|
Loading…
Reference in New Issue
Block a user