File tree Expand file tree Collapse file tree
packages/npm-packages/ruby-wasm-wasi/test-e2e Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { BrowserContext , Page , expect } from "@playwright/test" ;
2- import { readFileSync } from "fs" ;
32import path from "path" ;
43
54export const waitForRubyVM = async ( page : Page ) => {
@@ -19,19 +18,14 @@ export const setupDebugLog = (context: BrowserContext) => {
1918} ;
2019
2120export const setupProxy = ( context : BrowserContext ) => {
22- const injectingPkgPath = process . env . RUBY_NPM_PACKAGE_ROOT ;
23- const injectingPkg = JSON . parse (
24- readFileSync ( path . join ( injectingPkgPath , "package.json" ) , "utf-8" ) ,
25- ) ;
26- const cdnPattern = new RegExp (
27- `cdn.jsdelivr.net/npm/${ injectingPkg . name } @.+/dist/(.+)`
28- ) ;
21+ const cdnPattern =
22+ / c d n .j s d e l i v r .n e t \/ n p m \/ @ r u b y \/ .+ - w a s m - w a s i @ .+ \/ d i s t \/ ( .+ ) / ;
2923 context . route ( cdnPattern , ( route ) => {
3024 const request = route . request ( ) ;
3125 console . log ( ">> [MOCK]" , request . method ( ) , request . url ( ) ) ;
3226 const relativePath = request . url ( ) . match ( cdnPattern ) [ 1 ] ;
3327 const mockedPath = path . join (
34- injectingPkgPath ,
28+ process . env . RUBY_NPM_PACKAGE_ROOT ,
3529 "dist" ,
3630 relativePath ,
3731 ) ;
You can’t perform that action at this time.
0 commit comments