aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/fetch.js
blob: cc83b5af433d83633bdf034bc4a5e8b0251ea47a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import fs from "fs";

const response = await fetch("http://example.com/");
const text = await response.text();

if (
  fs.readFileSync(
    import.meta.path.substring(0, import.meta.path.lastIndexOf("/")) +
      "/fetch.js.txt",
    "utf8"
  ) !== text
) {
  throw new Error("Expected fetch.js.txt to match snapshot");
}