jeudi 31 août 2017

Using Mocha with TypeScript paths

I'm having an issue with running mocha when using the paths + baseUrl configuration in TypeScript

My tsconfig.js is set like so:

"baseUrl": "./src/", /* Base directory to resolve non-absolute module names. */
"paths": {
  "interfaces/*": [
    "interfaces/*"
  ],
  "models/*": [
    "models/*"
  ],
  "schemas/*": [
    "schemas/*"
  ],
  "classes/*": [
    "classes/*"
  ],
  "libs/*": [
    "libs/*"
  ],
  "config/*": [
    "config/*"
  ]

and I'm runnings mocha as "mocha build/test"

The compiled TS code fails to find my references since it compiles to

var user_1 = require("interfaces/user");

and if I add "../" beforehand it will compile without problems

Any ideas what I'm doing wrong here?

Aucun commentaire:

Enregistrer un commentaire