craigburke / karma-gradle

Gradle Plugin for Running tests with Karma
Other
21 stars 11 forks source link

Unable to setup preprocessors #34

Open pablochacin opened 6 years ago

pablochacin commented 6 years ago

I'm trying to use this plugin for testing a typescript project. In doing so, I need to add karma-typescript framework and setup karma to use it for compiling typescript. I'm using this simple file:


module.exports = function (config) {
   config.set({
      basePath : 'src/test/',
      files : [
         {pattern: '**/*.ts'}
      ],
      colors : true,
      frameworks: ['jasmine','karma-typescript'],
      preprocessors : {
            '**/*.ts' : ['karma-typescript']
      },    
      browsers : ['PhantomJS'],    
      reporters : ['progress'],   
   });
}

The problem is that when I try to put this same configuration in gradle in order to use your plugin, like this:

preprocessors = {
    'src/main/**/*.ts' = ['karma-typescripts']
}

Gradle complains about the syntax of the preprocessor directive

[src/main/**/*.ts] is a constant expression, but it should be a variable expression at line: 25 column: 26. File: _BuildScript_ @ line 25, column 26.
           'src/main/**/*.ts' = ['karma-typescripts'] 

I have tried several options, but none works. I would appreciate if you could help me with this issue, either by indicating how correctly setup this in the gradle file, or how to include it from an external karma config file.