Getting test project to import source using output path

45 views Asked by At

Typescript best practices are changing fast in 1.x and I'm no longer sure what is a good way to achieve what I want:

  • My sources are located at src/ and use outDir to output to built/.
  • My tests are located at test/ and I'm thinking of outputting those to either built/ or built/tests/.

My test looks at test/**/*.ts, src/**/*.ts, typings/**/*.d.ts. To get it to import my soruces properly, I would have to do:

import { SomeClass } from "../src/sourcefile";

Of course, running the output file in nodejs would now fail, since in the output, sourcefile.js is located in the same (or parent) directory as my test.

Is there a good way to get separate TypeScript folders to think they're in the same directory as one another? Should I be using a --declaration as an intermediate step? And if so, where to put it.

0

There are 0 answers