Open reekoheek opened 3 years ago
would you be able to provide a repro ?
I think the problem when we use typescript decorator.
Run this to reproduce:
git clone git@github.com:material-svelte/vite-web-test-runner-plugin.git
cd vite-web-test-runner-plugin/
curl https://gist.githubusercontent.com/reekoheek/332dce6c76c582da9cadbd22544b5bb5/raw/d2a430761a84ac4111332a7b2d5a167ff518ac14/vite_wtr_repro_patch.diff | git apply --check
cd examples/react/
npm i
npm test
You will see error happened at src/foo.test.ts:21:11
but the actual error happened at src/foo.test.ts:8
❯ npm test
> web-test-runner-example@0.0.0 test
> web-test-runner "src/**/*.test.ts" --coverage
vite v2.4.2 dev server running at:
> Local: http://localhost:3000/
> Network: use `--host` to expose
src/foo.test.ts:
🚧 Browser logs:
foo arg name: Foo
foo [Function: Foo]
❌ foo > ok
Error: something err
at o.<anonymous> (src/foo.test.ts:21:11)
Chrome: |██████████████████████████████| 1/1 test files | 0 passed, 1 failed
Code coverage: 100 %
View full coverage report at coverage/lcov-report/index.html
Finished running tests in 1.5s with 1 failed tests.
5:42:27 PM [vite] page reload coverage/lcov-report/index.html
i wonder if this is a vite-internal problem. i saw multiple issues in the vite ecosystem relating to wrong line-numbers in sourcemaps. this plugin readly doesnt do alot, just proxy all requests to vite.
maybe you could ask around in their discord ?
I'm working with typescript with enable sourcemap in my
tsconfig.json
. When I throw an error from test, it logged different line number from my ts files. But when I use@web/dev-server-esbuild
line numbers are correct.web-test-runner.config.mjs
tsconfig.json
I'm running with