TypeScript preprocessor for karma-runner
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test use @types Dec 23, 2016
.editorconfig use spaces Dec 23, 2016
.gitignore initial revision Nov 15, 2013
.nvmrc bump node version Dec 23, 2016
.travis.yml bump node version Dec 23, 2016
Gruntfile.coffee run real tests Dec 23, 2016
LICENSE Initial commit Nov 15, 2013
README.md build status badge May 7, 2016
index.js transpile is deprecated (fixes issue #62) Sep 25, 2018
package-lock.json update deps Sep 25, 2018
package.json chore: release v0.4.0 Sep 25, 2018



Preprocessor to compile TypeScript on the fly.

Build Status Deps Status devDependency Status npm


npm install karma-typescript-preprocessor --save-dev


The code below shows the sample configuration of the preprocessor.

// karma.conf.js
module.exports = function(config) {
    preprocessors: {
      '**/*.ts': ['typescript']

    typescriptPreprocessor: {
      // options passed to the typescript compiler
      options: {
        sourceMap: false, // (optional) Generates corresponding .map file.
        target: 'ES5', // (optional) Specify ECMAScript target version: 'ES3' (default), or 'ES5'
        module: 'amd', // (optional) Specify module code generation: 'commonjs' or 'amd'
        noImplicitAny: true, // (optional) Warn on expressions and declarations with an implied 'any' type.
        noResolve: true, // (optional) Skip resolution and preprocessing.
        removeComments: true, // (optional) Do not emit comments to output.
        concatenateOutput: false // (optional) Concatenate and emit output to single file. By default true if module option is omited, otherwise false.
      // transforming the filenames
      transformPath: function(path) {
        return path.replace(/\.ts$/, '.js');

If you set the sourceMap option to true then the generated source map will be inlined as a data-uri.

All TypeScript compiler options are defined here.

For more information on Karma see the homepage.