JSPM

  • Created
  • Published
  • Downloads 98239
  • Score
    100M100P100Q159304F
  • License MIT

Preprocessor for transpiling Typescript files on the fly with sourcemaps for debugging.

Package Exports

  • karma-typescript

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (karma-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

karma-typescript

Transpile Typescript on the fly for unit testing with Karma.

Sourcemaps can optionally be created for debugging in a web browser when running tests in a web browser.

Npm installation:

npm install karma-typescript --save-dev

Example using jasmine and karma-commonjs + sourcemaps:

npm install jasmine-core karma karma-chrome-launcher karma-cli karma-commonjs karma-jasmine karma-typescript --save-dev

In this example, the .ts files are transpiled to es5 format with sourcemaps, and then run through the commonjs preprocessor for module loading.

Essentials parts of karma.conf.js:

frameworks: ['jasmine', 'commonjs'],

files: [
    { pattern: 'src/**/*.ts' }
],

preprocessors: {
    '**/*.ts': ['karma-typescript', 'commonjs']
},

karmaTypescript: {
    /*
    These are options for the Typescript compiler.
    For more options, please see https://www.typescriptlang.org/docs/handbook/compiler-options.html
    */
    options: {
        sourceMap: true,
        target: 'es5',
        module: 'commonjs'
    }
}

Licensing

This software is licensed with the MIT license.

© 2016 Monounity