Skip to content

Commit

Permalink
test: enabled ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jan 6, 2025
1 parent b0bda4c commit 842a99e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"prepare": "husky install",
"supabase:generate:local": "supabase gen types typescript --local > src/types/database.ts",
"supabase:generate:remote": "cross-env-shell \"supabase gen types typescript --project-id $SUPABASE_PROJECT_ID --schema public > src/types/database.ts\"",
"test": "jest --setupFiles dotenv/config --coverage"
"test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --setupFiles dotenv/config --coverage"
},
"keywords": [
"typescript",
Expand Down
4 changes: 2 additions & 2 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, jest } from "@jest/globals";
import { drop } from "@mswjs/data";
import { Octokit } from "@octokit/rest";
import { createClient } from "@supabase/supabase-js";
import { Logs } from "@ubiquity-os/ubiquity-os-logger";
import { createAdapters } from "../src/adapters";
import { run } from "../src/run";
Expand All @@ -16,7 +15,7 @@ beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());

jest.mock("@supabase/supabase-js", () => {
jest.unstable_mockModule("@supabase/supabase-js", () => {
return {
createClient: jest.fn(() => {
return {
Expand Down Expand Up @@ -83,6 +82,7 @@ describe("User tests", () => {
},
octokit: new Octokit(),
} as unknown as Context;
const { createClient } = await import("@supabase/supabase-js");
context.adapters = createAdapters(createClient<Database>(context.env.SUPABASE_URL, context.env.SUPABASE_KEY), context);
await expect(run(context)).resolves.not.toThrow();
});
Expand Down

0 comments on commit 842a99e

Please sign in to comment.