rogeliog / jest-runner-mocha

A Mocha runner for Jest
70 stars 12 forks source link

Allow optional `ts-mocha` #17

Closed nickgartmann closed 6 years ago

nickgartmann commented 6 years ago

By adding ts-mocha as a dependency and adding require('ts-mocha') to the top of runMocha.js it is possible to enable typescript mocha tests with Jest.

However, this solution forces typescript. Hoping you can advise on how to structure a change to add an optional configuration for enabling typescript. The tricky bit is that the require('ts-mocha') must come before the require('mocha').

ljharb commented 6 years ago

I'm fine with changes that make it possible to use typescript, but not with adding any typescript-related thing to deps.

Why is typescript any different than babel, ie, babel-register etc?

nickgartmann commented 6 years ago

This is my bad, I got down a weird rabbit hole and missed the obvious 🙃

Typescript support can be added through the "compiler" config option: "compiler": "node_modules/ts-node/register"