Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
75 lines
1.7 KiB
Plaintext
75 lines
1.7 KiB
Plaintext
/**
|
|
*
|
|
* audit/common
|
|
*
|
|
*/
|
|
/**
|
|
* Audit requirement levels as per [RFC2119](https://www.rfc-editor.org/rfc/rfc2119).
|
|
*
|
|
* @category Audits
|
|
*/
|
|
export type AuditRequirement = 'MUST' | 'SHOULD' | 'MAY';
|
|
/**
|
|
* Audit name starting with the audit requirement level.
|
|
*
|
|
* @category Audits
|
|
*/
|
|
export type AuditName = `${AuditRequirement} ${string}`;
|
|
/**
|
|
* Actual audit test returning an result.
|
|
*
|
|
* The test function will throw only if the error is fatal.
|
|
*
|
|
* @category Audits
|
|
*/
|
|
export interface Audit {
|
|
/**
|
|
* Uniquely represents the audit. Helps with pinning audits
|
|
* without depending on the human readable audit name.
|
|
*/
|
|
id: string;
|
|
name: AuditName;
|
|
fn: () => Promise<AuditResult>;
|
|
}
|
|
/**
|
|
* Indicates that the audit was successful.
|
|
*
|
|
* @category Audits
|
|
*/
|
|
export interface AuditOk {
|
|
/**
|
|
* Uniquely represents the passing audit. Helps with pinning audits
|
|
* without depending on the human readable audit name.
|
|
*/
|
|
id: string;
|
|
name: AuditName;
|
|
status: 'ok';
|
|
}
|
|
/**
|
|
* Indicates that the audit failed.
|
|
*
|
|
* If the status is `warn`, the audit is not a requirement but rather a recommendation.
|
|
*
|
|
* On the other hand, if the status is `error`, the audit is a requirement and the source
|
|
* is therefore not compliant.
|
|
*
|
|
* @category Audits
|
|
*/
|
|
export interface AuditFail {
|
|
/**
|
|
* Uniquely represents the failing audit. Helps with pinning audits
|
|
* without depending on the human readable audit name.
|
|
*/
|
|
id: string;
|
|
name: AuditName;
|
|
status: 'notice' | 'warn' | 'error';
|
|
reason: string;
|
|
response: Response;
|
|
}
|
|
/**
|
|
* Result of the performed audit. See `AuditOk` and `AuditFail` for more information.
|
|
*
|
|
* @category Audits
|
|
*/
|
|
export type AuditResult = AuditOk | AuditFail;
|