// `jsrDepsInNodeModules` is enabled, but there is no `node_modules` directory
// in use (no `nodeModulesDir` setting and no package.json). The rewrite to the
// npm-compat form is coupled to a `node_modules` directory being in use, so it
// is skipped here: the `jsr:` dependency keeps resolving over https from the
// global cache, with no alias symlinks and no `.npmrc` written.
import { add } from "@denotest/add";

console.log("add:", add(1, 2));

// No `node_modules` directory was materialized.
console.log("node_modules exists:", existsSync("node_modules"));

// No `.npmrc` was written into the project directory.
console.log(".npmrc exists:", existsSync(".npmrc"));

function existsSync(path: string): boolean {
  try {
    Deno.statSync(path);
    return true;
  } catch (err) {
    if (err instanceof Deno.errors.NotFound) {
      return false;
    }
    throw err;
  }
}
