hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
91 stars 31 forks source link

false positives #203

Open Morriz opened 2 years ago

Morriz commented 2 years ago

Hi, in this extension we get a false error in our test suite (which runs 100% correct with npm test).

We notice in the debug output complaints about ENAMETOOLONG: name too long, open ..., with a long string that includes the bearer token we send along.

Test body:

it('blabla, (done) => {
    request(app)
      .put('/v1/teams/team1')
      .send({
        name: 'team1',
        selfService: {
          Team: [],
          Service: [],
        },
      })
      .set('Accept', 'application/json')
      .set('Authorization', `Bearer ${adminToken}`)
      .expect(200)
      .end(done)
  })

So my question is, is this the right location or is this handled by the native vscode explorer?

hbenl commented 2 years ago

That's strange. Is the project where this happens public or do you have a sample project for me to reproduce? Otherwise perhaps the diagnostic log contains some hints. Right now my only idea how this could happen is that this extension runs mocha differently than npm test does, so check the diagnostic log for the mocha options that are being used and also the version of node and mocha that the extension uses.

Morriz commented 2 years ago

I think the error is very explicit, and we send a very long bearer token. Is there a limit to that? Maybe it can be stretched?

hbenl commented 2 years ago

Neither mocha nor this extension has anything to do with the sending of the bearer token (and if there is a limit to that, it is not defined in mocha or this extension), that's why I find it so strange that the extension gives different results than npm test.

Morriz commented 2 years ago

Aha, but theoretically it might very well be a bug in vscode itself then.

Morriz commented 2 years ago

This error is coming from the debug console when the explorer runs the tests:


Could not read source map for file:///xx/src/api/apps/%7BteamId%7D.ts: ENAMETOOLONG: name too long, open '/xx/api/apps/{tdata:application/json;charset=utf-8;base64,eyJ2...[rest of beare token here]`

I will also search vscode repo for a match.
Morriz commented 2 years ago

As you can see the filename contains brackets: {teamId}.ts. That is probably not handled well.

Morriz commented 2 years ago

I saw only two occurences of ENAMETOOLONG in the vscode repo, but none referring to reading source map files.