diff --git a/node-src/lib/getConfiguration.ts b/node-src/lib/getConfiguration.ts index b61b47c7f..28324d3ea 100644 --- a/node-src/lib/getConfiguration.ts +++ b/node-src/lib/getConfiguration.ts @@ -66,7 +66,7 @@ export async function getConfiguration( return { configFile: usedConfigFile, ...configuration }; } catch (err) { // Config file does not exist - if (/ENOENT/.test(err.message)) { + if (errIsNotExists(err)) { // The user passed no configFile option so it's OK for the file not to exist if (!configFile) { return {}; @@ -84,3 +84,10 @@ export async function getConfiguration( throw err; } } + +function errIsNotExists(err: Error) { + // Node includes ENOENT in message + // bun includes it in the name + // toString is the shortest check for both + return err.toString().includes('ENOENT'); +}