0.1.0 • Published 8 years ago

karma-simpletsc-preprocessor v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

karma-simpletsc-preprocessor

A simple Karma Preprocessor that compiles your TypeScript files without creating output files.

NPM

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 and compilerOptions then tsConfig will be chosen.
  • Setting sourceMap to true currently emulates the inlineSourceMap 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.