Skip to content

Commit cfa6709

Browse files
committed
chore: fix tests in CI environment
1 parent 55ea901 commit cfa6709

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ jobs:
4343
- name: Install dependencies
4444
run: npm ci
4545

46+
- name: Install Playwright browsers
47+
# FIXME: Why is this needed? Where does the version conflict come from?
48+
run: ln -s /home/runner/.cache/ms-playwright/chromium-1161 /home/runner/.cache/ms-playwright/chromium-1169
49+
4650
- name: Run tests
47-
env:
48-
PLAYWRIGHT_LAUNCH_ARGS: '--no-sandbox' # Add args needed for CI
49-
run: npm run test
51+
# run: npm run test
52+
run: npx vitest run
5053

5154
build:
5255
name: Build

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"format": "biome format . --write",
3434
"db:generate": "drizzle-kit generate",
3535
"db:push": "drizzle-kit push",
36-
"postinstall": "npx playwright install --with-deps chromium"
36+
"postinstall": "npx playwright install --no-shell --with-deps chromium"
3737
},
3838
"dependencies": {
3939
"@joplin/turndown-plugin-gfm": "^1.0.61",

src/scraper/middleware/ContentProcessorPipeline.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { logger } from "../../utils/logger";
12
import type { ContentProcessingContext, ContentProcessorMiddleware } from "./types";
23

34
/**
@@ -46,7 +47,7 @@ export class ContentProcessingPipeline {
4647
error instanceof Error ? error : new Error(String(error)),
4748
);
4849
// Depending on desired behavior, you might re-throw or just log
49-
console.error("Error in middleware pipeline:", error);
50+
logger.warn(`Error in middleware pipeline: ${error}`);
5051
// Decide if pipeline should stop on error. For now, let's continue.
5152
// If stopping is desired, uncomment the next line:
5253
// throw error;

src/scraper/middleware/components/HtmlPlaywrightMiddleware.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ describe("HtmlPlaywrightMiddleware", () => {
196196
} as MockedObject<Page>;
197197
const browserSpy = {
198198
newPage: vi.fn().mockImplementation(() => {
199-
console.log("Mocked newPage called");
200199
return pageSpy;
201200
}),
202201
// newPage: vi.fn().mockResolvedValue(pageSpy),
@@ -207,7 +206,6 @@ describe("HtmlPlaywrightMiddleware", () => {
207206

208207
// const launchSpy = vi.spyOn(chromium, "launch").mockResolvedValue(browserSpy); // Use unknown cast
209208
const launchSpy = vi.spyOn(chromium, "launch").mockImplementation(() => {
210-
console.log("Mocked launch called");
211209
return Promise.resolve(browserSpy as unknown as Browser);
212210
});
213211

src/scraper/middleware/components/HtmlPlaywrightMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class HtmlPlaywrightMiddleware implements ContentProcessorMiddleware {
2121
logger.debug(
2222
`Launching new Playwright browser instance (Chromium) with args: ${launchArgs.join(" ") || "none"}...`,
2323
);
24-
this.browser = await chromium.launch({ args: launchArgs });
24+
this.browser = await chromium.launch({ channel: "chromium", args: launchArgs });
2525
this.browser.on("disconnected", () => {
2626
logger.debug("Playwright browser instance disconnected.");
2727
this.browser = null;

0 commit comments

Comments
 (0)