Giter Club home page Giter Club logo

stryker-karma-runner's People

Contributors

nicojs avatar philippw avatar simondel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

stryker-karma-runner's Issues

IsolatedTestRunnerAdapter: Can not load "webpack" preprocessor - cannot load webpack options if any plugin was added

Error Can not load "webpack"
arguments[i].apply is not a function
Can't load webpack options from karmaConfig from stryker config.
Error happens only if any plugin is added.

How to reproduce:

git clone https://github.com/unlight/angular-webpack-seed
cd angular-webpack-seed
git checkout bug-1
npm i
npm run stryker -q

Expected behaviour:

No errors

Actual:

[2017-04-20 13:12:34.248] [TRACE] IsolatedTestRunnerAdapter - 20 04 2017 13:12:34.241:
ERROR [preprocess]: Can not load "webpack"!
  TypeError: arguments[i].apply is not a function
    at Compiler.apply (d:\Dev\angular-webpack-seed\node_modules\tapable\lib\Tapable.js:310:16)
    at webpack (d:\Dev\angular-webpack-seed\node_modules\webpack\lib\webpack.js:32:19)
    at new Plugin (d:\Dev\angular-webpack-seed\node_modules\karma-webpack\lib\karma-webpack.js:69:15)
    at invoke (d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:75:15)
    at Array.instantiate (d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:59:20)
    at get (d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:48:43)
    at d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:71:14
    at Array.map (native)
    at Array.invoke (d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:70:31)
    at Injector.get (d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:48:43)
    at instantiatePreprocessor (d:\Dev\angular-webpack-seed\node_modules\karma\lib\preprocessor.js:55:20)
    at Array.forEach (native)
    at createPreprocessor (d:\Dev\angular-webpack-seed\node_modules\karma\lib\preprocessor.js:74:20)
    at Array.invoke (d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:75:15)
    at get (d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:48:43)
    at d:\Dev\angular-webpack-seed\node_modules\di\lib\injector.js:71:14

Env:
windows 10
node v7.9.0
part of stryker config:

        karmaConfig: {
            preprocessors: {
                '**/spec.module.js': ['webpack'],
            },
            browsers: ['Nightmare'],
            webpack: {
                module: {
                    exprContextCritical: false,
                    rules: [
                        {
                            test: /\.component\.html$/,
                            use: [
                                { loader: 'raw-loader' }
                            ]
                        },
                        {
                            test: /\.component\.scss$/,
                            use: [
                                { loader: 'raw-loader' },
                                { loader: 'sass-loader' },
                            ]
                        },
                        {
                            test: /\.component\.[tj]s$/,
                            use: [
                                { loader: 'angular2-template-loader' }
                            ]
                        }
                    ]
                },
                plugins: [
                    new webpack.DefinePlugin({
                        'process.env.NODE_ENV': JSON.stringify('development')
                    }),
                    // new webpack.DllReferencePlugin({
                    //     context: context,
                    //     manifest: require(libs)
                    // })
                ]
            }
        },

Make use of karma.conf file

A lot of users expect karma.conf.js settings to be mirrored in stryker. We should add this feature using the ConfigWriter interface.

We should either completely remove the current karmaConfig overrides method and only except a string, or we should support both a string (location of the karma.conf.js file). @simondel which one would you prefer?

In order for this to work stryker-mutator/stryker-js#148 needs to be fixed as well. Otherwise the current working directory would not be in sync with all preprocessor paths and such.

Can not load webpack. TypeError: arguments[i].apply is not a function.

Hi, I'm trying to use stryker on a project I'm working on, I tried first using it in a simple application that I have to test things like this, and it worked perfectly so I decided to apply it to a bigger project, this bigger project uses Webpack, below I'll paste my three configurations, stryker, karma and webpack and also the error I get.

stryker.conf.js:

module.exports = function(config){
	config.set({
		testRunner: 'karma',
		testFramework: 'jasmine',
		karmaConfigFile: 'karma.conf.js',
		logLevel: 'trace',
		reporter: [
			'progress', 
			'clear-text', 
			'dots', 
			'html', 
			'event-recorder'
		],
		coverageAnalysis: 'perTest',
		plugins: [
			'stryker-jasmine',
			'stryker-karma-runner',
			'stryker-html-reporter'
		]
	});
}

karma.conf.js:

'use strict';

var webpackConfig = require('./webpack/webpack.config.test.js');
require('phantomjs-polyfill');

module.exports = function (config) {
	config.set({
		basePath: '',
		frameworks: ['jasmine'],
		port: 9876,
		colors: true,
		logLevel: config.LOG_INFO,
		autoWatch: false,
		browsers: ['PhantomJS'],
		singleRun: true,
		autoWatchBatchDelay: 300,
		files: [
			'./node_modules/phantomjs-polyfill/bind-polyfill.js',
			'./src/test.index.ts'
		],
		babelPreprocessor: {
			options: {
				presets: ['es2015']
			}
		},
		preprocessors: {
			'src/test.index.ts': ['webpack']
		},
		webpackMiddleware: {
			stats: {
				chunkModules: false,
				colors: true
			}
		},
		webpack: webpackConfig
	});
};

webpack.config.test.js:

var webpack = require('webpack');
var path = require('path');
var loaders = require("./webpack.config.common");
var ExtractTextPlugin = require('extract-text-webpack-plugin');

const ENV = process.env.ENV = process.env.NODE_ENV = 'test';

module.exports = {
	entry: null,
	output: {
		filename: '[name]-[hash].js',
		path: path.resolve(__dirname, '../tmp')
	},
	resolve: {
		modules: [
			path.join(__dirname, "../src"),
			'node_modules'
		],
		extensions: ['.ts', '.js', '.json', '.css', '.scss', '.sass']
	},
	devtool: "source-map-inline",
	plugins: [
		new webpack.ProvidePlugin({
			$: 'jquery',
			jQuery: 'jquery',
			'window.jQuery': 'jquery',
			'window.jquery': 'jquery'
		}),
		new ExtractTextPlugin('[name]-[contenthash].css')
	],
	module: {
		rules: loaders
	}
};

Error Code:

[2017-03-31 11:17:25.727] [TRACE] IsolatedTestRunnerAdapter - 31 03 2017 11:17:25.724:ERROR [preprocess]: Can not load "webpack"!
  TypeError: arguments[i].apply is not a function
  at Compiler.apply (<ProjectPath>/node_modules/tapable/lib/Tapable.js:306:16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.