@@ -68,6 +68,26 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
68
68
expect ( await resolve ( ) ) . toBe ( false ) ;
69
69
} ) ;
70
70
71
+ test ( "JS::RequireRemote#load throws error when gem is not found" , async ( {
72
+ page,
73
+ } ) => {
74
+ // Opens the URL that will be used as the basis for determining the relative URL.
75
+ await page . goto (
76
+ "https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/" ,
77
+ ) ;
78
+ await page . setContent ( `
79
+ <script src="https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/browser.script.iife.js">
80
+ </script>
81
+ <script type="text/ruby" data-eval="async">
82
+ require 'js/require_remote'
83
+ JS::RequireRemote.instance.load 'foo'
84
+ </script>
85
+ ` ) ;
86
+
87
+ const error = await page . waitForEvent ( "pageerror" ) ;
88
+ expect ( error . message ) . toMatch ( / c a n n o t l o a d s u c h u r l - - .+ \/ f o o .r b / ) ;
89
+ } ) ;
90
+
71
91
// TODO: This test fails.
72
92
// In the integration test, response#url returns the URL before the redirect.
73
93
// I do not know the cause. Under investigation.
@@ -94,25 +114,5 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
94
114
95
115
expect ( await resolve ( ) ) . toBe ( false ) ;
96
116
} ) ;
97
-
98
- test ( "JS::RequireRemote#load throws error when gem is not found" , async ( {
99
- page,
100
- } ) => {
101
- // Opens the URL that will be used as the basis for determining the relative URL.
102
- await page . goto (
103
- "https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/" ,
104
- ) ;
105
- await page . setContent ( `
106
- <script src="https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@latest/dist/browser.script.iife.js">
107
- </script>
108
- <script type="text/ruby" data-eval="async">
109
- require 'js/require_remote'
110
- JS::RequireRemote.instance.load 'foo'
111
- </script>
112
- ` ) ;
113
-
114
- const error = await page . waitForEvent ( "pageerror" ) ;
115
- expect ( error . message ) . toMatch ( / c a n n o t l o a d s u c h u r l - - .+ \/ f o o .r b / ) ;
116
- } ) ;
117
117
} ) ;
118
118
}
0 commit comments