ava-ts icon indicating copy to clipboard operation
ava-ts copied to clipboard

Should test failure line numbers be accurate?

Open jack-guy opened this issue 7 years ago • 3 comments

Thanks so much for creating ava-ts - it's been really helpful in my projects. I've noticed, however, that wherever ava would normally output line numbers where a test failed, I get completely unrelated code:

  2 tests failed

  rooms.ts › validates room sizes

  /mnt/c/Users/Jack/git/sl-tethers/src/rooms.ts:79

   78:   };
   79:   rules: {         
   80:     rounds: number;

  Rejected promise returned by test. Reason:

  Error (BadRequest) {
    status: 400,
    message: 'You need to pick a room size.',
  }

As you can see from the example, I'm throwing an error within a function, but the highlighted output actually points to a unrelated interface declaration.

Is this a known problem? Do sourcemaps work with ava-ts?

jack-guy avatar Jan 28 '18 03:01 jack-guy

Thanks, @harangue 😊

That seems rather strange. Works on my machineâ„¢ (in multiple projects). Is it in the same project as the nyc coverage issue? Maybe some of that configuration breaks it.

andywer avatar Jan 29 '18 07:01 andywer

Unfortunately it occurs with and without nyc, @andywer. Can I see your tsconfig.json? I also wonder if it could be related to my using Observable-based tests.

jack-guy avatar Jan 29 '18 16:01 jack-guy

Sorry for not answering in time! Just been so busy. Unfortunately I just quickly put something together in /tmp and I don't have it anymore 😕

andywer avatar Mar 02 '18 09:03 andywer