The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: few updates to run integration tests on prod
egor-romanov69657f875d3b
diff --git a/tests/.jest/jest-env.js b/tests/.jest/jest-env.jsindex 10a67330d8c..c0dc7603cb5 100644--- a/tests/.jest/jest-env.js+++ b/tests/.jest/jest-env.js@@ -1,9 +1,12 @@-process.env.SUPABASE_DB_HOST = 'localhost'-process.env.SUPABASE_DB_PORT = '5432'-process.env.SUPABASE_DB_PASS = 'your-super-secret-and-long-postgres-password'-process.env.SUPABASE_GOTRUE = 'http://localhost:8000/auth/v1'-process.env.SUPABASE_URL = 'http://localhost:8000'+process.env.SUPABASE_DB_HOST = process.env.SUPABASE_DB_HOST ?? 'localhost'+process.env.SUPABASE_DB_PORT = process.env.SUPABASE_DB_PORT ?? '5432'+process.env.SUPABASE_DB_PASS =+ process.env.SUPABASE_DB_PASS ?? 'your-super-secret-and-long-postgres-password'+process.env.SUPABASE_GOTRUE = process.env.SUPABASE_GOTRUE ?? 'http://localhost:8000/auth/v1'+process.env.SUPABASE_URL = process.env.SUPABASE_URL ?? 'http://localhost:8000'process.env.SUPABASE_KEY_ANON =+ process.env.SUPABASE_KEY_ANON ??'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE'process.env.SUPABASE_KEY_ADMIN =+ process.env.SUPABASE_KEY_ADMIN ??'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q'diff --git a/tests/.jest/teardown.ts b/tests/.jest/teardown.tsnew file mode 100644index 00000000000..6ef6f4bc7c6--- /dev/null+++ b/tests/.jest/teardown.ts@@ -0,0 +1,24 @@+import { ApiError, createClient, User } from '@supabase/supabase-js'++const removeAllUsers = async () => {+ const sb = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_KEY_ADMIN)++ const { data: users } = await sb.auth.api.listUsers()++ const promises: Promise<{+ user: User+ data: User+ error: ApiError+ }>[] = []+ users.map((u) => {+ sb.from('profiles')+ .delete()+ .match({ id: u.id })+ .then(() => promises.push(sb.auth.api.deleteUser(u.id)))+ })+ await Promise.all(promises)+}++export default async () => {+ await removeAllUsers()+}diff --git a/tests/jest.config.ts b/tests/jest.config.tsindex 3117c2e35cd..e072f7fd0df 100644--- a/tests/jest.config.ts+++ b/tests/jest.config.ts@@ -7,14 +7,11 @@ const config: Config.InitialOptions = {},moduleFileExtensions: ['ts', 'js', 'cjs', 'json', 'node'],// globalSetup: './test/hooks.ts',- // globalTeardown: './teardown.js',+ globalTeardown: '<rootDir>/.jest/teardown.ts',setupFiles: ['<rootDir>/.jest/jest-env.js'],setupFilesAfterEnv: ['<rootDir>/.jest/jest-custom-reporter.ts'],testRunner: 'jest-jasmine2',- testTimeout: 5000,- // testEnvironmentOptions: {- // jiraUrl: ""- // },+ testTimeout: 15000,coverageThreshold: {global: {branches: 0,diff --git a/tests/package.json b/tests/package.jsonindex e7f720f0c95..4a62edfbe7c 100644--- a/tests/package.json+++ b/tests/package.json@@ -8,7 +8,8 @@"test": "jest","allure:generate": "rm -rf allure-report && node_modules/allure-commandline/bin/allure generate","allure:serve": "node_modules/allure-commandline/bin/allure serve",- "test:report": "npm run allure:generate && npm run allure:serve"+ "test:report": "npm run allure:generate && npm run allure:serve",+ "format": "prettier --write \"./**/*.{js,jsx,ts,tsx,css,md}\""},"author": "Supabase, Inc.","license": "MIT",