karma-electron
Advanced tools
Comparing version 3.0.5 to 3.1.0
# karma-electron changelog | ||
3.1.0 - Added support for source maps via @otbe in #4 | ||
3.0.5 - Upgraded to Electron@0.37.4 in development via @ppitonak in #1 | ||
@@ -3,0 +5,0 @@ |
@@ -6,2 +6,3 @@ // Load our dependencies | ||
var jsStringEscape = require('js-string-escape'); | ||
var convertSourceMap = require('convert-source-map'); | ||
@@ -22,5 +23,6 @@ // Load our template | ||
function electronPreprocessor(content, file, done) { | ||
// Render and callback with our content | ||
// Render our content without a source map | ||
var sourceMap = convertSourceMap.fromSource(content); | ||
var output = template({ | ||
content: content, | ||
content: convertSourceMap.removeComments(content), | ||
dirname: jsStringEscape(path.dirname(file.originalPath)), | ||
@@ -31,2 +33,9 @@ filename: jsStringEscape(file.originalPath), | ||
}); | ||
// If there was a source map, add it back | ||
if (sourceMap) { | ||
output += '\n' + sourceMap.toComment(); | ||
} | ||
// Callback with our content | ||
done(null, output); | ||
@@ -33,0 +42,0 @@ } |
{ | ||
"name": "karma-electron", | ||
"description": "Karma launcher and preprocessor for Electron", | ||
"version": "3.0.5", | ||
"version": "3.1.0", | ||
"homepage": "https://github.com/twolfson/karma-electron", | ||
@@ -27,3 +27,3 @@ "author": { | ||
"test": "npm run test-karma-all && npm run lint", | ||
"test-karma-all": "npm run test-karma-single-run && npm run test-karma-failure && npm run test-karma-uncaught-exception && npm run test-karma-karma && npm run test-karma-phantomjs", | ||
"test-karma-all": "npm run test-karma-single-run && npm run test-karma-failure && npm run test-karma-uncaught-exception && npm run test-karma-karma && npm run test-karma-phantomjs && npm run test-karma-source-map", | ||
"test-karma-continuous": "karma start test/integration-test/karma.conf.js --no-single-run", | ||
@@ -35,2 +35,3 @@ "test-karma-karma-comment": "# DEV: We run `test-karma-karma` twice to verify no user-data-dir is leaking", | ||
"test-karma-single-run": "karma start test/integration-test/karma.conf.js --single-run", | ||
"test-karma-source-map": "cross-env TEST_TYPE=SOURCE_MAP karma start test/integration-test/karma.conf.js --single-run", | ||
"test-karma-uncaught-exception": "node bin/verify-failure.js TEST_TYPE=UNCAUGHT_EXCEPTION karma start test/integration-test/karma.conf.js --single-run", | ||
@@ -41,2 +42,3 @@ "test-windows": "npm run test-karma-all" | ||
"commander": "~2.9.0", | ||
"convert-source-map": "~1.2.0", | ||
"js-string-escape": "~1.0.0", | ||
@@ -47,2 +49,3 @@ "minstache": "~1.2.0", | ||
"devDependencies": { | ||
"collections": "~3.0.0", | ||
"cross-env": "~1.0.7", | ||
@@ -60,2 +63,3 @@ "electron-prebuilt": "~0.37.4", | ||
"phantomjs-prebuilt": "~2.1.5", | ||
"request": "~2.72.0", | ||
"twolfson-style": "~1.6.0" | ||
@@ -62,0 +66,0 @@ }, |
// Karma configuration | ||
// Generated on Thu Mar 03 2016 19:57:50 GMT-0600 (CST) | ||
var Set = require('collections/set'); | ||
module.exports = function (config) { | ||
@@ -9,5 +10,6 @@ // Set up default files to test against | ||
var failureTest = 'failure-test.js'; | ||
var sourceMapTest = 'source-map-test.js'; | ||
var uncaughtExceptionTest = 'uncaught-exception-test.js'; | ||
var testFiles = ['*-test.js']; | ||
var excludeFiles = [failureTest, karmaTest, phantomJsTest, uncaughtExceptionTest]; | ||
var excludeFiles = new Set([failureTest, karmaTest, phantomJsTest, sourceMapTest, uncaughtExceptionTest]); | ||
@@ -17,12 +19,15 @@ // If we are testing uncaught exceptions, then update our tests | ||
testFiles = [uncaughtExceptionTest]; | ||
excludeFiles = [failureTest, karmaTest, phantomJsTest]; | ||
excludeFiles.delete(uncaughtExceptionTest); | ||
} else if (process.env.TEST_TYPE === 'FAILURE') { | ||
testFiles = [failureTest]; | ||
excludeFiles = [karmaTest, phantomJsTest, uncaughtExceptionTest]; | ||
excludeFiles.delete(failureTest); | ||
} else if (process.env.TEST_TYPE === 'KARMA') { | ||
testFiles = [karmaTest, phantomJsTest]; | ||
excludeFiles = [failureTest, phantomJsTest, uncaughtExceptionTest]; | ||
testFiles = [karmaTest]; | ||
excludeFiles.delete(karmaTest); | ||
} else if (process.env.TEST_TYPE === 'PHANTOMJS') { | ||
testFiles = [successTest, phantomJsTest]; | ||
excludeFiles = []; | ||
excludeFiles = new Set(); | ||
} else if (process.env.TEST_TYPE === 'SOURCE_MAP') { | ||
testFiles = [sourceMapTest]; | ||
excludeFiles.delete(sourceMapTest); | ||
} else if (process.env.TEST_TYPE) { | ||
@@ -45,3 +50,3 @@ throw new Error('Unrecognized test type "' + process.env.TEST_TYPE + '"'); | ||
// list of files to exclude | ||
exclude: excludeFiles, | ||
exclude: excludeFiles.toArray(), | ||
@@ -48,0 +53,0 @@ // preprocess matching files before serving them to the browser |
Sorry, the diff of this file is not supported yet
32272
24
488
5
15
9
+ Addedconvert-source-map@~1.2.0
+ Addedconvert-source-map@1.2.0(transitive)