[BUG] Cannot find module 'node:path' from 'index.js' #1198
Description
Describe the bug
Test suite failed to run
Cannot find module 'node:path' from 'index.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
at Object.<anonymous> (node_modules/path-scurry/src/index.ts:2:1)
Environment (please complete the following information):
node -v
: v14.21.3npm -v
: 6.14.18- jest version: 23.6.0
- Operating system: MacOS 15.0.1
Prerequisite
- are you able to run jest from the command line? yes
- where do you run jest CLI from? root directory of the project
- how do you run your tests from the command line? "npm run test"
jest.config.js file:
'use strict';
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testEnvironmentOptions: {
nodeVersion: '14.21.3',
},
rootDir: "./",
globals: {
'ts-jest': {
diagnostics: true,
tsConfig: 'tsconfig.json',
},
},
transform: {
'^.+\.ts$': 'ts-jest',
},
moduleFileExtensions: [
'ts',
'js',
'json',
'node',
],
modulePathIgnorePatterns: [
'dist',
],
coverageDirectory: 'coverage',
collectCoverageFrom: [
'!src//.d.ts',
// intentionally excluding -data-importers.ts - no significant logic to test
'!src/lib/data-importer/create-data-importers.ts',
'!src/lib/data-importer/run-data-importers.ts',
'!src/lib/metrics/',
'!src/lib/utils/',
'!src/scripts/*',
'src//*.{ts,js}'
],
testResultsProcessor: 'jest-sonar-reporter',
coverageReporters: [ 'text', 'html', 'lcov' ],
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
],
};
Actual Behaviour
jest "SnowflakeNewTest.spec.ts"
FAIL test/src/lib/snowflake/SnowflakeNewTest.spec.ts
● Test suite failed to run
Cannot find module 'node:path' from 'index.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:221:17)
at Object.<anonymous> (node_modules/path-scurry/src/index.ts:2:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.89s
Ran all test suites matching /SnowflakeNewTest.spec.ts/i.
The fastest (and the most fun) way to resolve the issue is to submit a pull request yourself. If you are interested, please check out the contribution guide, we look forward to seeing your PR...