karma-simpletsc-preprocessor
v0.1.0
Published
A simple karma-runner plugin to compile typescript files
Downloads
2
Maintainers
Readme
karma-simpletsc-preprocessor
A simple Karma Preprocessor that compiles your TypeScript files without creating output files.
Installation
Add karma-simpletsc-preprocessor
as a devDependency in your package.json
.
{
"devDependencies": {
"karma-simpletsc-preprocessor": "0.0.1"
}
}
Or just issue the following command:
npm install karma-simpletsc-preprocessor --save-dev
Configuration
Below is two examples of how to use the preprocessor
Using a tsconfig.json
file:
module.exports = function(config) {
config.set({
preprocessors: {
'**/*.ts': ['tsc']
},
simpletscPreprocessor: {
tsConfig: 'tsconfig.json' // relative to __dirname path
}
});
};
Using a compilerOptions object:
module.exports = function(config) {
config.set({
preprocessors: {
'**/*.ts': ['tsc']
},
simpletscPreprocessor: {
compilerOptions: {
module: "amd",
target: "ES5",
noImplicitAny: true,
removeComments: true,
inlineSourceMap: true,
preserveConstEnums: true,
sourceRoot: ''
}
}
});
};
Notes:
- If you provide both
tsConfig
andcompilerOptions
thentsConfig
will be chosen. - Setting
sourceMap
to true currently emulates theinlineSourceMap
behaviour.
Warning:
- The TypeScript git repo is a dependency for this preprocessor, this is so the complied TypeScript files can contain the latest features. The only downside to this is that downloading this preprocessor will take a long time because it has to download the whole TypeScript repo as well.
For more information on Karma see the homepage.