{"_id":"@asghonim/playwright-supabase","_rev":"2-ede1ab959331c8b281400c730616ba16","name":"@asghonim/playwright-supabase","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@asghonim/playwright-supabase","version":"0.1.0","keywords":["playwright","supabase","mock","testing","typescript"],"author":"","license":"MIT","_id":"@asghonim/playwright-supabase@0.1.0","maintainers":[{"name":"asghonim","email":"asghonim@live.com"}],"homepage":"https://github.com/asghonim/playwright-supabase#readme","bugs":{"url":"https://github.com/asghonim/playwright-supabase/issues"},"dist":{"shasum":"f983c6e945921c2996755a76fa8c1f5dff79c9d2","tarball":"https://registry.npmjs.org/@asghonim/playwright-supabase/-/playwright-supabase-0.1.0.tgz","fileCount":9,"integrity":"sha512-C/xHhbGBhikkZF03Dfpj3X7lj9a9I2+nqAbFh7LwXdtm+e0Y8yuGRN68j6V5MOpwMEoH82Ej73EOWrsy0pFGHw==","signatures":[{"sig":"MEUCIDZawrd1v2ke/HgMfFF59XrQKcOb5ykwD9A2yNFkvcUKAiEA/sAwlLrJPgNU8SWDfudKOzLxCefcH2d8FtmLPTiXVFA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@asghonim%2fplaywright-supabase@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":61362},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"525ef7b35ba397b2eb2181d6d497a42a28f25a88","scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"asghonim","email":"asghonim@live.com"},"repository":{"url":"git+https://github.com/asghonim/playwright-supabase.git","type":"git"},"_npmVersion":"10.8.2","description":"Setup Supabase mocks in Playwright tests","directories":{},"_nodeVersion":"20.20.2","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","eslint":"^8.57.0","vitest":"^1.6.0","typescript":"^5.4.0","@playwright/test":"^1.44.0","@vitest/coverage-v8":"^1.6.0","@typescript-eslint/parser":"^7.0.0","@typescript-eslint/eslint-plugin":"^7.0.0"},"peerDependencies":{"@playwright/test":">=1.30.0"},"_npmOperationalInternal":{"tmp":"tmp/playwright-supabase_0.1.0_1778857085667_0.10621430112879682","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@asghonim/playwright-supabase","version":"0.2.0","description":"Setup Supabase mocks in Playwright tests","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"repository":{"type":"git","url":"git+https://github.com/asghonim/playwright-supabase.git"},"scripts":{"build":"tsup","dev":"tsup --watch","lint":"eslint src --ext .ts","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"keywords":["playwright","supabase","mock","testing","typescript"],"author":"","license":"MIT","peerDependencies":{"@playwright/test":">=1.30.0"},"devDependencies":{"@playwright/test":"^1.44.0","@typescript-eslint/eslint-plugin":"^7.0.0","@typescript-eslint/parser":"^7.0.0","@vitest/coverage-v8":"^1.6.0","eslint":"^8.57.0","tsup":"^8.0.0","typescript":"^5.4.0","vitest":"^1.6.0"},"_id":"@asghonim/playwright-supabase@0.2.0","gitHead":"aaa0ceff3ce879aec4e2c6ebd90a6596872e1c0d","bugs":{"url":"https://github.com/asghonim/playwright-supabase/issues"},"homepage":"https://github.com/asghonim/playwright-supabase#readme","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-omMBc8TL/dzAQtT8Fvbf0dDmPkF7Mqn02Ju2kiG4KNQlN+UaRLaqD/zYw+lLaJXoNiKl+v4LhmSyGxaJT35v4g==","shasum":"2be58d372bbabc32854ba017e4782149b3fd40dd","tarball":"https://registry.npmjs.org/@asghonim/playwright-supabase/-/playwright-supabase-0.2.0.tgz","fileCount":9,"unpackedSize":100443,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@asghonim%2fplaywright-supabase@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCzXq2ejnjWkjOGuxwGy0GiMqoBeaPZwIPTDqNnN5FXhwIgUTrMqNGgvmskDV3Vaqan2IbcbvwBs5iDZDkieMVhIGQ="}]},"_npmUser":{"name":"asghonim","email":"asghonim@live.com"},"directories":{},"maintainers":[{"name":"asghonim","email":"asghonim@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/playwright-supabase_0.2.0_1778876925286_0.04405130306857519"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-15T14:58:05.561Z","modified":"2026-05-15T20:28:45.807Z","0.1.0":"2026-05-15T14:58:05.838Z","0.2.0":"2026-05-15T20:28:45.493Z"},"bugs":{"url":"https://github.com/asghonim/playwright-supabase/issues"},"license":"MIT","homepage":"https://github.com/asghonim/playwright-supabase#readme","keywords":["playwright","supabase","mock","testing","typescript"],"repository":{"type":"git","url":"git+https://github.com/asghonim/playwright-supabase.git"},"description":"Setup Supabase mocks in Playwright tests","maintainers":[{"name":"asghonim","email":"asghonim@live.com"}],"readme":"# @asghonim/playwright-supabase\n\n> Setup Supabase mocks in Playwright tests\n\nA lightweight TypeScript library that intercepts Supabase API calls (database, auth, storage) inside [Playwright](https://playwright.dev/) tests using Playwright's built-in route interception — no network required.\n\n## Installation\n\n```sh\nnpm install --save-dev @asghonim/playwright-supabase\n# or\nyarn add -D @asghonim/playwright-supabase\n# or\npnpm add -D @asghonim/playwright-supabase\n```\n\n`@playwright/test` must be installed as a peer dependency.\n\n## Quick start\n\n### Using `createSupabaseMock` directly\n\n```ts\nimport { test, expect } from \"@playwright/test\";\nimport { createSupabaseMock } from \"@asghonim/playwright-supabase\";\n\ntest(\"shows a list of todos\", async ({ page }) => {\n  const mock = createSupabaseMock(page, {\n    url: \"https://xyz.supabase.co\",\n  });\n\n  // Mock a SELECT on the \"todos\" table\n  await mock.database(\"todos\").select({\n    body: [\n      { id: 1, title: \"Buy milk\", done: false },\n      { id: 2, title: \"Write tests\", done: true },\n    ],\n  });\n\n  await page.goto(\"/todos\");\n  await expect(page.locator(\"text=Buy milk\")).toBeVisible();\n});\n```\n\n### Using the built-in Playwright fixture\n\n`@asghonim/playwright-supabase` ships a pre-built `test` object with a `supabaseMock` fixture.\n\n```ts\n// tests/todos.spec.ts\nimport { test, expect } from \"@asghonim/playwright-supabase\";\n\n// Set the Supabase URL once for all tests in this file\ntest.use({ supabaseUrl: \"https://xyz.supabase.co\" });\n\ntest(\"shows a list of todos\", async ({ page, supabaseMock }) => {\n  await supabaseMock.database(\"todos\").select({\n    body: [{ id: 1, title: \"Buy milk\" }],\n  });\n\n  await page.goto(\"/todos\");\n  await expect(page.locator(\"text=Buy milk\")).toBeVisible();\n});\n```\n\nYou can also read the URL from an environment variable by setting `SUPABASE_URL` before running Playwright.\n\n### Composing with your own fixtures\n\n```ts\n// tests/fixtures.ts\nimport { test as base, expect } from \"@playwright/test\";\nimport { SupabaseMock } from \"@asghonim/playwright-supabase\";\n\nexport const test = base.extend<{ supabaseMock: SupabaseMock }>({\n  supabaseMock: async ({ page }, use) => {\n    await use(new SupabaseMock(page, { url: process.env.SUPABASE_URL! }));\n  },\n});\n\nexport { expect };\n```\n\n## API\n\n### `createSupabaseMock(page, options)`\n\nCreates a `SupabaseMock` instance.\n\n| Parameter | Type | Description |\n|---|---|---|\n| `page` | `Page` | The Playwright `Page` to attach interceptors to |\n| `options.url` | `string` | Base URL of your Supabase project (trailing slash is trimmed) |\n\n---\n\n### `SupabaseMock`\n\n#### `.database(table)`\n\nReturns a builder for mocking [PostgREST](https://postgrest.org/) endpoints at `/rest/v1/<table>`.\n\n| Method | HTTP verb mocked | Default body |\n|---|---|---|\n| `.select(response?)` | `GET` | `[]` |\n| `.insert(response?)` | `POST` | `{}` |\n| `.update(response?)` | `PATCH` | `{}` |\n| `.delete(response?)` | `DELETE` | `{}` |\n\nAll methods return a `RouteHandle` with a `.dispose()` method to remove the mock.\n\n#### `.auth`\n\nBuilder for mocking Supabase Auth endpoints at `/auth/v1/`.\n\n| Method | Endpoint mocked |\n|---|---|\n| `.signInWithPassword(response?)` | `POST /auth/v1/token?grant_type=password` |\n| `.signUp(response?)` | `POST /auth/v1/signup` |\n| `.signOut(response?)` | `POST /auth/v1/logout` |\n| `.getUser(response?)` | `GET /auth/v1/user` |\n| `.refreshToken(response?)` | `POST /auth/v1/token?grant_type=refresh_token` |\n\n#### `.storage(bucket)`\n\nBuilder for mocking Supabase Storage endpoints at `/storage/v1/`.\n\n| Method | Endpoint mocked |\n|---|---|\n| `.list(response?)` | `POST /storage/v1/object/list/<bucket>` |\n| `.upload(response?)` | `POST /storage/v1/object/<bucket>` |\n| `.download(path, response?)` | `GET /storage/v1/object/<bucket>/<path>` |\n| `.remove(response?)` | `DELETE /storage/v1/object/<bucket>` |\n\n---\n\n### `MockResponseOptions`\n\nAll mock builders accept an optional `MockResponseOptions` object:\n\n```ts\ninterface MockResponseOptions {\n  body?: unknown;                     // JSON-serialisable response body\n  status?: number;                    // HTTP status code (default: 200)\n  headers?: Record<string, string>;   // Extra response headers\n}\n```\n\n---\n\n### `RouteHandle`\n\nEvery mock registration returns a `RouteHandle`:\n\n```ts\ninterface RouteHandle {\n  dispose(): Promise<void>; // Removes the route interceptor\n}\n```\n\n## Development\n\n```sh\nnpm install\nnpm run build      # compile with tsup\nnpm test           # run unit tests with vitest\nnpm run typecheck  # run tsc --noEmit\nnpm run lint       # ESLint\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}