karma-chrome-launcher
Advanced tools
Comparing version 0.1.5 to 0.1.6
41
index.js
@@ -11,2 +11,6 @@ var fs = require('fs'); | ||
// http://peter.sh/experiments/chromium-command-line-switches/ | ||
flags.forEach(function(flag, i) { | ||
if(isJSFlags(flag)) flags[i] = sanitizeJSFlags(flag); | ||
}); | ||
return [ | ||
@@ -23,2 +27,15 @@ '--user-data-dir=' + this._tempDir, | ||
function isJSFlags (flag) { | ||
return flag.indexOf('--js-flags=') === 0; | ||
} | ||
function sanitizeJSFlags (flag) { | ||
var test = /--js-flags=(['"])/.exec(flag); | ||
if (!test) return flag; | ||
var escapeChar = test[1]; | ||
var endExp = new RegExp(escapeChar + '$'); | ||
var startExp = new RegExp('--js-flags=' + escapeChar); | ||
return flag.replace(startExp, '--js-flags=').replace(endExp, ''); | ||
} | ||
// Return location of chrome.exe file for a given Chrome directory (available: "Chrome", "Chrome SxS"). | ||
@@ -63,7 +80,21 @@ function getChromeExe(chromeDirName) { | ||
this._getOptions = function(url) { | ||
// disable crankshaft optimizations, as it causes lot of memory leaks (as of Chrome 23.0) | ||
return parentOptions.call(this, url).concat(['--js-flags="--nocrankshaft --noopt"']); | ||
return canaryGetOptions.call(this, url, args, parentOptions); | ||
}; | ||
}; | ||
function canaryGetOptions (url, args, parent) { | ||
// disable crankshaft optimizations, as it causes lot of memory leaks (as of Chrome 23.0) | ||
var flags = args.flags || []; | ||
var augmentedFlags; | ||
var customFlags = '--nocrankshaft --noopt'; | ||
flags.forEach(function(flag, i) { | ||
if (isJSFlags(flag)) { | ||
augmentedFlags = sanitizeJSFlags(flag) + ' ' + customFlags; | ||
} | ||
}); | ||
return parent.call(this, url).concat([augmentedFlags || '--js-flags=' + customFlags]); | ||
} | ||
ChromeCanaryBrowser.prototype = { | ||
@@ -109,1 +140,7 @@ name: 'ChromeCanary', | ||
}; | ||
module.exports.test = { | ||
isJSFlags: isJSFlags, | ||
sanitizeJSFlags: sanitizeJSFlags, | ||
canaryGetOptions: canaryGetOptions | ||
} |
{ | ||
"name": "karma-chrome-launcher", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A Karma plugin. Launcher for Chrome and Chrome Canary.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "./node_modules/.bin/jasmine-node test" | ||
}, | ||
@@ -28,3 +28,4 @@ "repository": { | ||
"grunt-bump": "~0.0.6", | ||
"grunt-auto-release": "~0.0.2" | ||
"grunt-auto-release": "~0.0.2", | ||
"jasmine-node": "~1.14.5" | ||
}, | ||
@@ -38,4 +39,5 @@ "contributors": [ | ||
"Michał Gołębiowski <m.goleb@gmail.com>", | ||
"Parashuram N <code@r.nparashuram.com>" | ||
"Parashuram N <code@r.nparashuram.com>", | ||
"Jeff Cross <middlefloor@gmail.com>" | ||
] | ||
} |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
7983
4
154
2
0
51
5