mocha-examples icon indicating copy to clipboard operation
mocha-examples copied to clipboard

feat: added TypeScript + ts-node/esm and tsx/esm examples

Open JoshuaKGoldberg opened this issue 2 years ago • 1 comments

I noticed there wasn't yet an example that shows TypeScript transpilation on-the-fly with ESM imports/loaders. https://github.com/mochajs/mocha/issues/5002 is a Mocha issue asking about support.

This adds two examples:

  • --import=tsx/esm: Newer --import flag for Node.js post-v18.19.0/v20.6.0
  • --loader=ts-node/esm: Older --loader flag for Node.js

Fixes #75

JoshuaKGoldberg avatar Jan 21 '24 03:01 JoshuaKGoldberg

tsx uses esbuild which doesn't support decorators. Whenever you have decorators in your code, don't use tsx/esbuild

randre70 avatar Feb 23 '24 11:02 randre70