Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot find module 'node:path' from 'index.js' #1198

Open
Tanush-N opened this issue Nov 24, 2024 · 0 comments
Open

[BUG] Cannot find module 'node:path' from 'index.js' #1198

Tanush-N opened this issue Nov 24, 2024 · 0 comments

Comments

@Tanush-N
Copy link

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.3
  • npm -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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant