Fix __dirname for esm / fix e2e tests.

This commit is contained in:
Sander Declerck 2025-11-28 12:57:48 +01:00
parent 8c2e8c9597
commit f1ee6567df
No known key found for this signature in database
5 changed files with 67 additions and 29 deletions

View file

@ -6,6 +6,17 @@ import fs from "fs";
import os from "os";
import path from "path";
import { includePython } from "../config/cliArguments.js";
import { fileURLToPath } from "url";
/** @type {string} */
let dirname;
if (import.meta.url) {
const filename = fileURLToPath(import.meta.url);
dirname = path.dirname(filename);
} else {
dirname = __dirname;
}
/**
* Loops over the detected shells and calls the setup function for each.
@ -103,7 +114,7 @@ function copyStartupFiles() {
// Use absolute path for source
const sourcePath = path.join(
__dirname,
dirname,
includePython() ? "startup-scripts/include-python" : "startup-scripts",
file
);