mirror of
https://github.com/firecrawl/firecrawl.git
synced 2026-11-30 10:57:45 +08:00
* ci(api): run the core unit tests on every pull request Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ci(api): build the native lib without running dependency install scripts Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(api): bring stale unit tests in line with the code they cover These tests ran in no workflow, so they drifted from the code: - generateURLPermutations returns unique URLs, so a root URL has 12 permutations, not 16. - The section-link check moved into the native link filter; the test now reaches it through filterURL. - Google Docs and Slides URLs are rewritten to the HTML export, not PDF. - getEngineForUrl returns undefined before initialization; it never threw. One engine forcing case is skipped: a wildcard pattern also matches the base domain, which ENGINE_FORCING.md says it must not. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(api): ignore empty image sources when extracting images An empty src, data-src, poster, content or href resolved against the page URL, so the page itself was listed as an image. Lazy-loading placeholders commonly use an empty src. The extractImages unit test already expects them to be ignored. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ci(api): drop the named step for tests the core job runs src/lib/error-serde.test.ts and src/controllers/v2/__tests__/crawl-errors.test.ts are part of the core unit test suite, so the Server Test Suite no longer needs a step that names them. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ci(api): key the native and Go library caches on every build input The native key now includes Cargo.lock, build.rs and .cargo/config.toml, and the Go key includes go.mod, so a change to any of them rebuilds the library instead of restoring an older one. Both workflows use the same keys and keep sharing the caches. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(api): open no Redis connection when the core suite imports a module Several modules create a Redis client on import. In the core suite those clients now connect on first use, so the suite attempts no connection unless a test issues a command. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
16 lines
577 B
TypeScript
16 lines
577 B
TypeScript
import { vi } from "vitest";
|
|
|
|
// The core suite runs without Redis, but many modules create a Redis client
|
|
// when they are imported. Make every client connect on first use, so importing
|
|
// a module opens no connection.
|
|
vi.mock("ioredis", async importOriginal => {
|
|
const ioredis = await importOriginal<typeof import("ioredis")>();
|
|
|
|
const LazyRedis = new Proxy(ioredis.Redis, {
|
|
construct: (target, args, newTarget) =>
|
|
Reflect.construct(target, [...args, { lazyConnect: true }], newTarget),
|
|
});
|
|
|
|
return { ...ioredis, default: LazyRedis, Redis: LazyRedis };
|
|
});
|