I have a collection of TypeScript files that I merged into a single file called bundle.js
using browsersify
and tsify
in my gulp
build process.
Now, I have the original .ts
files in the /src
directory and the compiled bundle.js
in the /build
directory.
I want to test this setup using jasmine
and karma
, but I'm facing some challenges. Jasmine seems unable to use the .ts
files or the final build.js
. Additionally, I'm not sure how code coverage would work with this technology stack.
Can anyone provide tips on how to run jasmine tests in this scenario and what the architecture should look like?
Thanks
---- Edit-----
I attempted to include the build.js file in my Karma configuration:
files: [
'build/**/*.js',
'spec/**/*.spec.js'
]
However, I'm unsure how to access objects within it. For example, I have a TypeScript class called "Unit", but Browsersify appears to encapsulate it inside an anonymous function like this:
var Unit = (function () {
function Unit() {
}
return Unit;
}());
Unfortunately, I can't seem to access the "Unit" class from the outside, resulting in an error when trying to instantiate it in Jasmine:
ReferenceError: Can't find variable: Unit