Skip to content

Commit 863ab13

Browse files
committed
chore(supabase): fix deno test
1 parent 210e8b3 commit 863ab13

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

packages/core/supabase-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"test:coverage": "jest --runInBand --coverage --testPathIgnorePatterns=\"test/integration|test/deno\"",
3838
"test:integration": "jest --runInBand --detectOpenHandles test/integration.test.ts",
3939
"test:integration:browser": "deno test --allow-all test/integration.browser.test.ts",
40-
"test:edge-functions": "deno test --allow-all --no-check --unstable-sloppy-imports --config test/deno/deno.json test/deno/edge-functions-integration.test.ts",
40+
"test:edge-functions": "cd test/deno && npm run test:edge-functions",
4141
"test:watch": "jest --watch --verbose false --silent false",
4242
"test:node:playwright": "cd test/integration/node-browser && npm install && cp ../../../dist/umd/supabase.js . && npm run test",
4343
"test:bun": "cd test/integration/bun && bun install && bun test",

packages/core/supabase-js/test/deno/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "test-deno",
33
"private": true,
44
"scripts": {
5-
"test": "npm run setup-deps && deno test --allow-all --no-check --unstable-sloppy-imports integration.test.ts",
6-
"test:edge-functions": "npm run setup-deps && deno test --allow-all --no-check --unstable-sloppy-imports edge-functions-integration.test.ts",
5+
"test": "npm run setup-deps && node run-deno-test.js integration.test.ts",
6+
"test:edge-functions": "npm run setup-deps && node run-deno-test.js edge-functions-integration.test.ts",
77
"setup-deps": "node setup-deps.js"
88
},
99
"dependencies": {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env node
2+
3+
const { execSync } = require('child_process');
4+
5+
// Get Deno version
6+
let denoVersion = '1.0.0'; // default fallback
7+
try {
8+
const versionOutput = execSync('deno --version', { encoding: 'utf-8' });
9+
const match = versionOutput.match(/deno (\d+)\.(\d+)\.(\d+)/);
10+
if (match) {
11+
denoVersion = `${match[1]}.${match[2]}.${match[3]}`;
12+
}
13+
} catch (error) {
14+
console.warn('Could not determine Deno version, assuming 1.x');
15+
}
16+
17+
const majorVersion = parseInt(denoVersion.split('.')[0]);
18+
19+
// Get test file from arguments
20+
const testFile = process.argv[2] || 'integration.test.ts';
21+
22+
// Base flags that work for both versions
23+
let flags = '--allow-all --no-check --unstable-sloppy-imports';
24+
25+
// Add version-specific flags
26+
if (majorVersion >= 2) {
27+
flags += ' --unstable-detect-cjs';
28+
console.log(`Running with Deno ${denoVersion} (v2+ detected, using --unstable-detect-cjs)`);
29+
} else {
30+
console.log(`Running with Deno ${denoVersion} (v1.x detected, skipping --unstable-detect-cjs)`);
31+
}
32+
33+
// Run the test
34+
const command = `deno test ${flags} ${testFile}`;
35+
console.log(`Executing: ${command}\n`);
36+
37+
try {
38+
execSync(command, { stdio: 'inherit' });
39+
} catch (error) {
40+
process.exit(error.status || 1);
41+
}

0 commit comments

Comments
 (0)