borp icon indicating copy to clipboard operation
borp copied to clipboard

ERR_UNKNOWN_FILE_EXTENSION when trying to use borp

Open ThisIsMissEm opened this issue 7 months ago • 1 comments

Hi! I'm trying to replace c8 in Hollo with borp; we were already using node:test and need an --env-file to be passed, but currently I'm struggling to even get borp to run the tests and output coverage.

We're using side-by-side tests, so for example src/oauth.tsx has src/oauth.test.ts.

I have in the package.json:

{
  "check:coverage": "pnpm run migrate:test && borp --coverage --check-coverage --lines 95",
}

And the .borp.yml file is:

files:
  - src/**/*.test.ts

reporters:
  - spec

Upon running pnpm check:coverage none of the tests appear to run, and the following error is repeated output for each *.test.ts file.

Node.js v22.14.0
✖ src/api/v1/apps.test.ts (28.883208ms)
node:internal/modules/esm/get_format:219
  throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath);
        ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/emelia/Development/git/github.com/fedify-dev/hollo/src/api/v1/accounts.test.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:219:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:245:36)
    at defaultLoad (node:internal/modules/esm/load:120:22)
    at async ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:514:32)
    at async ModuleJob._link (node:internal/modules/esm/module_job:115:19) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Our tsconfig.json is:

{
  "compilerOptions": {
    "lib": ["ESNext", "DOM"],
    "target": "ESNext",
    "module": "ESNext",
    "moduleDetection": "force",
    "jsx": "react-jsx",
    "jsxImportSource": "hono/jsx",
    "allowJs": true,
    "esModuleInterop": true,
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "noEmit": true,
    "strict": true,
    "skipLibCheck": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noPropertyAccessFromIndexSignature": true,
    "incremental": true
  },
  "exclude": ["node_modules", "docs"]
}

ThisIsMissEm avatar May 25 '25 15:05 ThisIsMissEm

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

mcollina avatar May 26 '25 13:05 mcollina