sCrypt-Inc / scryptlib

Javascript SDK
MIT License
47 stars 28 forks source link

TSConfig Error when using vitest as testing framework #213

Closed trgsv closed 1 year ago

trgsv commented 1 year ago

Compiling doesn't work when using vitest testing framework with this tsconfig: https://github.com/sCrypt-Inc/scryptTS-examples/blob/master/tsconfig.json Node v16.18.1

Error: the ts-scrypt transformer plugin may not be activated for the project, check your tsconfig file!

xhliu commented 1 year ago

Can you please share your code to reproduce this error?

trgsv commented 1 year ago

I created a small demo repo with scrypt-ts + vite + vitest: https://github.com/trgsv/scrypt-vite-vitest

Run tests with npm run test

zhfnjust commented 1 year ago
  1. you should use TS: "typescript": "=4.8.4", not "typescript": "^4.9.3". this is in our docs
  2. noEmit should be set to false. outDir shoud be set too.
  3. "sourceMap": true

but Vite uses esbuild to transpile TypeScript into JavaScript which is about 20~30x faster than vanilla tsc, and HMR updates can reflect in the browser in under 50ms. scryptTS depends on tsc. So we can't support vite now.

trgsv commented 1 year ago

Thanks for you answer. I forgot to set the TS version in this demo repo. So vitest doesn't work because it uses vite (which uses esbuild).