program-examples icon indicating copy to clipboard operation
program-examples copied to clipboard

ts-mocha fails in typescript v5 on native projects

Open heyAyushh opened this issue 1 year ago • 1 comments

 Exception during run: TypeError: Unknown file extension ".ts" for  /solana/program-examples/basics/hello-solana/native/tests/test.ts
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:214:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:240:36)
    at defaultLoad (node:internal/modules/esm/load:123:22)
    at ModuleLoader.load (node:internal/modules/esm/loader:567:7)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:45)
    at ModuleJob._link (node:internal/modules/esm/module_job:106:19) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

To fix this temporarily use these specific versions in node

  "devDependencies": {
    "@types/bn.js": "^5.1.0",
    "@types/chai": "^4.3.1",
    "@types/mocha": "^9.1.1",
    "chai": "^4.3.4",
    "mocha": "^9.0.3",
    "solana-bankrun": "^0.3.0",
    "ts-mocha": "^10.0.0",
    "typescript": "^4.3.5"
  },

heyAyushh avatar Oct 07 '24 12:10 heyAyushh

some say it's probably an issue with mocha. Any updates on this ?

deauthe avatar Oct 18 '24 21:10 deauthe