You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is how I led to conclusion that above error is related to fetch-mock.
I recently got a new laptop. Default node installed by brew is v18.6.0, compared to previous v17.x on my older system
Upgrading node resulted in some caveats e.g. usage of NODE_OPTIONS=--no-experimental-fetch became necessary for rpm run build in some of our repos.
Coming to tests, we observed below stack trace in some of our repos
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/abhinavsingh/Dev/....redacted..../tests/payments.ts
at new NodeError (node:internal/errors:387:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:80:11)
at defaultGetFormat (node:internal/modules/esm/get_format:122:38)
at defaultLoad (node:internal/modules/esm/load:81:20)
at nextLoad (node:internal/modules/esm/loader:173:28)
at ESMLoader.load (node:internal/modules/esm/loader:616:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:472:22)
at new ModuleJob (node:internal/modules/esm/module_job:63:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:491:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:449:34)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:541:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)
at async formattedImport (/Users/abhinavsingh/Dev/....redacted..../node_modules/mocha/lib/nodejs/esm-utils.js:7:14)
Going into payments.ts, as soon as we comment out const fetchMock = require('fetch-mock');, error goes away. We saw similar behaviour for all our tests using fetch-mock
I went to https://www.npmjs.com/package/fetch-mock in hope of a newer version, but found none.
I tried NODE_OPTIONS=--no-experimental-fetch with npm test, but run into same exception.
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /workspaces/test/a.super.good.test.ts
at new NodeError (node:internal/errors:371:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:87:11)
at defaultGetFormat (node:internal/modules/esm/get_format:102:38)
at defaultLoad (node:internal/modules/esm/load:21:14)
at ESMLoader.load (node:internal/modules/esm/loader:359:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
at new ModuleJob (node:internal/modules/esm/module_job:66:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async formattedImport (/workspaces/node_modules/mocha/lib/nodejs/esm-utils.js:7:14)
at async Object.exports.requireOrImport (/workspaces/node_modules/mocha/lib/nodejs/esm-utils.js:38:28)
at async Object.exports.loadFilesAsync (/workspaces/node_modules/mocha/lib/nodejs/esm-utils.js:91:20)
at async singleRun (/workspaces/node_modules/mocha/lib/cli/run-helpers.js:125:3)
at async Object.exports.handler (/workspaces/node_modules/mocha/lib/cli/run.js:370:5)
This is how I led to conclusion that above error is related to
fetch-mock
.v18.6.0
, compared to previousv17.x
on my older systemNODE_OPTIONS=--no-experimental-fetch
became necessary forrpm run build
in some of our repos.payments.ts
, as soon as we comment outconst fetchMock = require('fetch-mock');
, error goes away. We saw similar behaviour for all our tests usingfetch-mock
https://www.npmjs.com/package/fetch-mock
in hope of a newer version, but found none.NODE_OPTIONS=--no-experimental-fetch
withnpm test
, but run into same exception.Dependency list:
Any help and/or pointers are appreciated. Best
The text was updated successfully, but these errors were encountered: