File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/npm-packages/ruby-wasm-wasi/test-e2e/examples Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { test , expect , Page } from '@playwright/test' ;
2
2
import path from "path"
3
3
import { waitForRubyVM , setupDebugLog , setupProxy } from "../support"
4
+ import { readFileSync } from 'fs' ;
5
+ import http from 'http' ;
6
+ import https from 'https' ;
4
7
5
8
test . beforeEach ( async ( { context } ) => {
6
9
setupDebugLog ( context ) ;
7
10
if ( process . env . RUBY_NPM_PACKAGE_ROOT ) {
8
11
setupProxy ( context ) ;
9
12
} else {
10
- console . info ( "Testing against CDN deployed files" )
13
+ console . info ( "Testing against CDN deployed files" ) ;
14
+ const packagePath = path . join ( __dirname , ".." , ".." , "package.json" )
15
+ const packageInfo = JSON . parse ( readFileSync ( packagePath , "utf-8" ) )
16
+ const version = packageInfo . version
17
+ const url = `https://registry.npmjs.org/ruby-head-wasm-wasi/${ version } `
18
+ const response = await new Promise < http . IncomingMessage > ( ( resolve , reject ) => {
19
+ https . get ( url , resolve ) . on ( "error" , reject )
20
+ } )
21
+ if ( response . statusCode == 404 ) {
22
+ console . log ( `ruby-head-wasm-wasi@${ version } is not published yet, so skipping CDN tests` ) ;
23
+ test . skip ( ) ;
24
+ }
11
25
}
12
26
} )
13
27
You can’t perform that action at this time.
0 commit comments