diff --git a/.eslintrc.json b/.eslintrc.json index b67597a..060696d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,6 +14,7 @@ "rules": { "linebreak-style": ["error", "unix"], "quotes": ["error", "double"], - "semi": ["error", "always"] + "semi": ["error", "always"], + "no-empty-pattern": "off" } } diff --git a/src/index.ts b/src/index.ts index 8c9f859..be2a700 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,7 @@ export const test = base.extend<{ const originalRouteFromHAR = page.routeFromHAR.bind(page); const advancedRouteFromHAR: AdvancedRouteFromHAR = async (filename, options) => { if (options?.update) { - const {matcher} = options + const {matcher} = options; if (matcher && "postProcess" in matcher) { await page.route(options.url || /.*/, async (route, request) => { const resp = await route.fetch(); @@ -26,7 +26,7 @@ export const test = base.extend<{ headers: Object.fromEntries(response.headers.map((header) => [header.name, header.value])), body: await parseContent(response.content, path.dirname(filename)), }); - }) + }); } // on update, we want to record the HAR just like the original playwright method return originalRouteFromHAR(filename, { diff --git a/tests/setup.ts b/tests/setup.ts index 5b33aea..ccbd4a9 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -1,4 +1,3 @@ -import { describe } from "node:test"; import { test } from "../lib/index"; test("record", async ({ page, advancedRouteFromHAR }) => { @@ -17,7 +16,7 @@ test("record test with a joke", async ({ page, advancedRouteFromHAR }) => { }); await page.goto("https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit"); await page.close(); -}) +}); test("record test with a joke and postprocess", async ({ page, advancedRouteFromHAR }) => { await advancedRouteFromHAR("tests/har/temp/joke-postprocess.har", { @@ -33,4 +32,4 @@ test("record test with a joke and postprocess", async ({ page, advancedRouteFrom await page.goto("https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit"); await page.waitForSelector("text=This is a joke"); await page.close(); -}) +}); diff --git a/tests/test.spec.ts b/tests/test.spec.ts index 9a0bd88..ad8b0e1 100644 --- a/tests/test.spec.ts +++ b/tests/test.spec.ts @@ -185,7 +185,7 @@ test("test a joke recording with postprocess", async ({ page, advancedRouteFromH await page.goto("https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit"); await page.waitForSelector("text=This is a joke"); await page.close(); -}) +}); test("test a joke recording with different postprocess that was not recorded", async ({ page, advancedRouteFromHAR }) => { await advancedRouteFromHAR("tests/har/temp/joke-postprocess.har", { @@ -201,7 +201,7 @@ test("test a joke recording with different postprocess that was not recorded", a await page.goto("https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit"); await page.waitForSelector("text=This is not a joke"); await page.close(); -}) +}); test("test a postprocess that change only part of the output", async ({ page, advancedRouteFromHAR }) => { await advancedRouteFromHAR("tests/har/temp/joke-postprocess.har", { @@ -225,6 +225,6 @@ test("test a postprocess that change only part of the output", async ({ page, ad expect(flags.custom).toBe(true); expect(flags.nsfw).toBe(false); await page.close(); -}) +});