mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2026-04-17 23:00:17 +00:00
- sets up ts-jest for typescript tests - various type improvements, some shared functions add in utils.ts - fixes sitemap test to not check sitemapDone, as it does not mean all URLs have been queued, uses sitemap path to avoid redirect --------- Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
20 lines
698 B
TypeScript
20 lines
698 B
TypeScript
import type { CrawlerArgs } from "../src/util/argParser";
|
|
import type { PartialDeep } from "type-fest";
|
|
import type { BlockRuleDecl } from "../src/util/blockrules";
|
|
|
|
export type TestConfig = Omit<PartialDeep<CrawlerArgs>, "blockRules"> & {
|
|
blockRules: BlockRuleDecl[];
|
|
};
|
|
|
|
export const isCI = !!process.env.CI;
|
|
export const testIf = (condition: unknown, ...args: Parameters<typeof test>) =>
|
|
condition ? test(...args) : test.skip(...args);
|
|
export const doValidate = process.argv.filter((x) =>
|
|
x.startsWith("-validate"),
|
|
)[0];
|
|
|
|
export async function sleep(time: number) {
|
|
await new Promise((resolve) => setTimeout(resolve, time));
|
|
}
|
|
|
|
export type ErrorWithStatus = Error & { status: number };
|