A Karma preprocessor plugin that transpiles TypeScript files using the gulp-typescript compiler with incremental compilation for fast rebuilds. Version 1.2.1 is the latest stable release. It relies on tsconfig.json for primary configuration, supports custom compiler overrides, sourcemaps via gulp-sourcemaps, and virtual path transformations. Notable features include very fast incremental rebuilds, good error reporting, and the ability to exclude .d.ts files. However, it has several unsupported TypeScript config options (sourceMap, rootDir, watch, project) and may face compatibility issues with newer Karma or TypeScript versions.
npm install karma-typescript-preprocessor2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures Karma to preprocess TypeScript files with this plugin. Includes tsconfig.json reference, sourcemap generation, and path transformation.
Use compilerOptions in typescriptPreprocessor to override, but avoid those keys. Use gulp.src base option instead of rootDir. Set singleRun: false for watch.
Ensure tsconfig.json exists and path is correct relative to Karma basePath.
Always include a transform that changes .ts to .js in your transformPath array.
If you need different TypeScript features, use karma-typescript or karma-webpack instead.
Run `npm install karma-typescript-preprocessor2 --save-dev` and ensure preprocessors config has 'typescript'.
Add `typescriptPreprocessor: { tsconfigPath: './tsconfig.json' }` to config.set().Run `npm install gulp-typescript --save-dev`.
Ensure transformPath is an array of functions, e.g., `transformPath: [function(path) { return path.replace(/\.ts$/, '.js'); }]`.