Skip to content

Commit 2a31991

Browse files
committed
Files the body returned by the proxy server
1 parent 94f0409 commit 2a31991

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
raise "load twice" if defined?(ALREADY_LOADED)
2+
3+
ALREADY_LOADED = true

packages/npm-packages/ruby-wasm-wasi/test-e2e/integrations/js-require-remote.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from "fs";
2+
import path from "path";
23
import { test, expect } from "@playwright/test";
34
import { setupDebugLog, setupProxy, resolveBinding } from "../support";
45

@@ -8,11 +9,9 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
89
test.beforeEach(async ({ context }) => {
910
setupDebugLog(context);
1011
setupProxy(context, (route, relativePath, mockedPath) => {
11-
if (relativePath.match("error_on_load_twice.rb")) {
12+
if (relativePath.match("fixtures")) {
1213
route.fulfill({
13-
body: `raise 'load twice' if defined? ALREADY_LOADED
14-
ALREADY_LOADED = true`,
15-
contentType: "text/ruby",
14+
path: path.join("./test-e2e/integrations", relativePath),
1615
});
1716
} else if (relativePath.match("redirect_to_error_on_load_twice.rb")) {
1817
route.fulfill({
@@ -43,7 +42,7 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
4342
<script src="browser.script.iife.js"></script>
4443
<script type="text/ruby" data-eval="async">
4544
require 'js/require_remote'
46-
JS.global.checkResolved JS::RequireRemote.instance.load 'error_on_load_twice'
45+
JS.global.checkResolved JS::RequireRemote.instance.load 'fixtures/error_on_load_twice'
4746
</script>
4847
`);
4948

@@ -61,8 +60,8 @@ if (!process.env.RUBY_NPM_PACKAGE_ROOT) {
6160
<script src="browser.script.iife.js"></script>
6261
<script type="text/ruby" data-eval="async">
6362
require 'js/require_remote'
64-
JS::RequireRemote.instance.load 'error_on_load_twice'
65-
JS.global.checkResolved JS::RequireRemote.instance.load 'error_on_load_twice'
63+
JS::RequireRemote.instance.load 'fixtures/error_on_load_twice'
64+
JS.global.checkResolved JS::RequireRemote.instance.load 'fixtures/error_on_load_twice'
6665
</script>
6766
`);
6867

0 commit comments

Comments
 (0)