0

I am following the Redux Tutorial and try to implement it using TypeScript in Visual Studio Code. The tutorial makes use of the Expect library.

My question is: is there any chance I can execute the Expect-Tests (written in a *.ts file) directly from VisualStudio Code, or do I absolutely have to create a HTML page and run it in the browser? The latter seems extremely inconvenient. Please note that in this case, the file to run is a TypeScript file, so this answer unfortunately does not work, because node can't deal with TypeScript files directly.

Community
  • 1
  • 1
Martin Häusler
  • 6,544
  • 8
  • 39
  • 66

1 Answers1

0

It's not necessary to run TypeScript directly in node, you can compile your *.ts files into JavaScript *.js and run them.

You can play with a sample project to get the hang of it.

Basically, these are the steps to run your tests:

  1. Compile your code from TypeScript to JavaScript.
  2. Compile your tests from TypeScript to JavaScript.
  3. Run tests in testing library of your choice (e.g. mocha).
zlumer
  • 6,844
  • 1
  • 25
  • 25