Skip to content

Commit 58863e2

Browse files
committed
Change integration tests to use local package wasm
1 parent 91fcfad commit 58863e2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

fixtures/app/server.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ const path = require("path");
55
const sirv = require("sirv");
66

77
const workerPath = require.resolve("css-to-js-sourcemap-worker");
8+
const wasmPath = path.join(path.dirname(workerPath), "mappings.wasm");
89

910
const assets = sirv(path.join(__dirname, "static"));
1011
const worker = sirv(path.dirname(workerPath));
12+
const wasm = sirv(path.dirname(wasmPath));
1113

1214
const routes = {
1315
"/no-map": "/no-map.js",
@@ -26,6 +28,9 @@ function createServer() {
2628
res.statusCode = 200;
2729
return void res.end(template(script));
2830
}
31+
if (req.url === "/mappings.wasm") {
32+
return wasm(req, res);
33+
}
2934
if (req.url === "/worker.js") {
3035
return worker(req, res);
3136
}

tests/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ test(`single mapped class works on /no-map`, async t => {
5353
page.evaluate(() => {
5454
window.worker.postMessage({
5555
id: "init_wasm",
56-
url: "https://unpkg.com/source-map@0.7.3/lib/mappings.wasm",
56+
url: "/mappings.wasm",
5757
});
5858
window.worker.postMessage({
5959
id: "add_mapped_class",
@@ -97,7 +97,7 @@ test(`replaying requests after invalidation`, async t => {
9797
page.evaluate(() => {
9898
window.worker.postMessage({
9999
id: "init_wasm",
100-
url: "https://unpkg.com/source-map@0.7.3/lib/mappings.wasm",
100+
url: "/mappings.wasm",
101101
});
102102
window.worker.postMessage({
103103
id: "add_mapped_class",
@@ -147,7 +147,7 @@ function testSingleMap(route) {
147147
page.evaluate(() => {
148148
window.worker.postMessage({
149149
id: "init_wasm",
150-
url: "https://unpkg.com/source-map@0.7.3/lib/mappings.wasm",
150+
url: "/mappings.wasm",
151151
});
152152
window.worker.postMessage({
153153
id: "add_mapped_class",

0 commit comments

Comments
 (0)