How to make node.js ignore css files

I can’t run the tests with Mocha in my vanilla javascript project when I have a CSS file import because I can’t get Node to ignore that specific extension.

I get this error:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension “.css”
at new NodeError (node:internal/errors:405:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:79:11)
at defaultGetFormat (node:internal/modules/esm/get_format:124:36)
at defaultLoad (node:internal/modules/esm/load:84:20)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:603:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:64:26)
at #createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
at async ModuleWrap. (node:internal/modules/esm/module_job:79:21)

Here is a sample repository to replicate the issue, hoping it will be helpful:

https://github.com/Marco0491/mocha-issue-simulation

Everything I’ve found so far is outdated and doesn’t work in my case.