karma-commonjs-alias
Advanced tools
Comparing version 0.1.3 to 0.1.5
@@ -5,12 +5,6 @@ // Copyright (c) 2013 Titanium I.T. LLC. Licensed under the MIT license. | ||
// Copyright (c) 2013 Titanium I.T. LLC. Licensed under the MIT license. | ||
(function() { | ||
(function() { | ||
"use strict"; | ||
var cachedModules = {}; | ||
var handlbarsExt = { | ||
hbs: true, | ||
handlebars: true, | ||
handlebar: true | ||
}; | ||
@@ -79,4 +73,6 @@ // load all modules | ||
var normalizedPath = baseComponents.join("/"); | ||
if (!~normalizedPath.indexOf('.')) { | ||
var normalizedPath = baseComponents.join("/"), | ||
ext = normalizedPath.split('.').pop(); | ||
if (!window.__cjs_ext__ || !window.__cjs_ext__[ext]) { | ||
normalizedPath += ".js"; | ||
@@ -83,0 +79,0 @@ } |
@@ -76,3 +76,4 @@ var path = require('path'); | ||
var transform = config.transform && config.transform[file.originalPath.split('.').pop()]; | ||
var extension = file.originalPath.split('.').pop(), | ||
transform = config.transform && config.transform[extension]; | ||
if(transform) { | ||
@@ -84,2 +85,5 @@ content = require(transform)(content); | ||
if(transform) { | ||
output += getWrappedTransform(extension) | ||
} | ||
@@ -90,2 +94,7 @@ done(output); | ||
function getWrappedTransform(extension) { | ||
return 'window.__cjs_ext__ = window.__cjs_ext__ || {};' + | ||
'window.__cjs_ext__["' + extension + '"] = true;'; | ||
} | ||
function getWrappedContent(content, path, fullPath) { | ||
@@ -92,0 +101,0 @@ var start = 'window.__cjs_module__ = window.__cjs_module__ || {};' + |
{ | ||
"name": "karma-commonjs-alias", | ||
"version": "0.1.3", | ||
"version": "0.1.5", | ||
"description": "A Karma plugin. Test CommonJS modules with added alias support", | ||
@@ -5,0 +5,0 @@ "main": "lib/plugin.js", |
9072
165