0

all my tests are running with mocha.js and I can debug them easily, except for one specific test file that causes the error Could not load source 'some path here/fileNameToTest.js': Source not found. to emerge.

In my launch.json file I have the following block -

      "type": "node",
      "request": "launch",
      "name": "Mocha Tests",
      "runtimeExecutable": "${env:HOME}/.nvm/versions/node/v14.16.0/bin/node",
      "cwd": "${workspaceRoot}",
      "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
      "internalConsoleOptions": "openOnSessionStart",
      "outFiles": [
        "${workspaceFolder}/**/*.js"
      ],
      "sourceMaps": true
    },

I've searched online and even tried chatGPT but I have no idea what could be the problem with it...

I have 2 dependencies in the test file - sinon.js,rewire.js and I am using them in most of the other test files..

Tzachi Elrom
  • 385
  • 1
  • 2
  • 19

1 Answers1

0

the problem was in rewire.js -

it turns out that it should be initialized in the first describe of the of the file, which encloses all the tests

Tzachi Elrom
  • 385
  • 1
  • 2
  • 19