aboutsummaryrefslogtreecommitdiff
path: root/integration/scripts/browser.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-22 01:02:32 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-22 01:02:32 -0700
commita48a02bade5079ab7c5ddd293ba8dc3b2f87ed26 (patch)
tree152843c5cac9910fe8e21610053a1a694325a553 /integration/scripts/browser.js
parent2326a1e1050d19a9b958893f07414f89e42dc82c (diff)
downloadbun-a48a02bade5079ab7c5ddd293ba8dc3b2f87ed26.tar.gz
bun-a48a02bade5079ab7c5ddd293ba8dc3b2f87ed26.tar.zst
bun-a48a02bade5079ab7c5ddd293ba8dc3b2f87ed26.zip
Switch to a single directory for storing snapshots and explicitly note whats a debug snapshot and a non-debug snapshot
Diffstat (limited to 'integration/scripts/browser.js')
-rw-r--r--integration/scripts/browser.js27
1 files changed, 22 insertions, 5 deletions
diff --git a/integration/scripts/browser.js b/integration/scripts/browser.js
index d062f93ca..8eb776c29 100644
--- a/integration/scripts/browser.js
+++ b/integration/scripts/browser.js
@@ -20,6 +20,7 @@ const bunProcess = child_process.spawn(bunExec, bunFlags, {
shell: false,
});
console.log("$", bunExec, bunFlags.join(" "));
+const isDebug = bunExec.endsWith("-debug");
bunProcess.stderr.pipe(process.stderr);
bunProcess.stdout.pipe(process.stdout);
@@ -32,12 +33,27 @@ process.on("beforeExit", () => {
});
function writeSnapshot(name, code) {
- const file = path.join(
- __dirname,
- "../snapshots" + (DISABLE_HMR ? "-no-hmr" : ""),
- name
+ let file = path.join(__dirname, "../snapshots", name);
+
+ if (!DISABLE_HMR) {
+ file =
+ file.substring(0, file.length - path.extname(file).length) +
+ ".hmr" +
+ path.extname(file);
+ }
+
+ if (!fs.existsSync(path.dirname(file))) {
+ fs.mkdirSync(path.dirname(file), { recursive: true });
+ }
+
+ fs.writeFileSync(
+ isDebug
+ ? file.substring(0, file.length - path.extname(file).length) +
+ ".debug" +
+ path.extname(file)
+ : file,
+ code
);
- fs.writeFileSync(file, code);
}
async function main() {
@@ -97,6 +113,7 @@ async function main() {
"/lodash-regexp.js",
"/unicode-identifiers.js",
"/string-escapes.js",
+ "/package-json-exports/index.js",
];
tests.reverse();