File tree Expand file tree Collapse file tree 2 files changed +43
-2
lines changed
packages/core/supabase-js/test/deno Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 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" : {
Original file line number Diff line number Diff line change 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 ( / d e n o ( \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+ }
You can’t perform that action at this time.
0 commit comments