Writing Jasmine unit tests in ES6 and using Chutzpah as test runner Visual Studio 2019

210 Views Asked by At

I am using the Jasmine testing library to write my unit tests. I'd like to use ES6 syntax to write the tests and am also testing files written in ES6.

I want to use Chutzpah as the test runner (I am open to other suggestions). At a basic level, I just want my tests discovered and ran in the Visual Studio Test Explorer menu. I cannot do this with ES6 files as Chutzpah isn't 'discovering' them if there's any ES6 syntax in the Javascript files (no import/export use, just something like plain arrow functions).

Ideally, I do not want to use node, hence the Jasmine library with no dependencies. At the moment I'm able to run my tests using the Chrome browser as a test runner. I'm using the standalone Jasmine library.

I'd like for these tests and the process to be transportable across both ASP.NET Core and ASP.NET projects. Also, it would be a huge plus if I can have this automated into an Azure build process so the JavaScript unit tests run any time I make a code commit, instead of me manually running the tests before I commit.

Is this achievable? Completely new to testing and setting up this kind of process.

I see my only pain point here is that I need to just transpile my ES6 code into ES5 and I can use all the tools I've mentioned (Chutzpah, Jasmine). However, I'm not sure how to do this without adding a node configuration.

If anyone can so much as to just give me an example of a simple transpilation process from ES6 to ES5 (without node), even that would be a huge help.

0

There are 0 best solutions below