karma-iframes
Advanced tools
Comparing version
@@ -26,5 +26,5 @@ let fs = require('fs'); | ||
%SCRIPTS% | ||
<script type="text/javascript" src="${STATIC_PREFIX}${transformedFilePath}"></script> | ||
<script type="text/javascript" src="${STATIC_PREFIX}${encodeURI(transformedFilePath)}"></script> | ||
`); | ||
// Save the file contents to the temp dir for serving it later | ||
@@ -31,0 +31,0 @@ fs.writeFile(`${TMP_STATIC_FILES_DIR}/${transformedFilePath}`, content, (err) => { |
@@ -5,2 +5,3 @@ let path = require('path'); | ||
let minimatch = require('minimatch'); | ||
const KARMA_MAJOR_VERSION = parseInt(require('karma/lib/constants').VERSION, 10) || -1; | ||
@@ -14,11 +15,23 @@ let {includeScriptsIntoContext, includeErrorIntoContext, filePathToUrlPath} = require('./includer.js'); | ||
// from here where the filesPromise lives. | ||
function createFilesPromise(fileList, emitter, basePath) { | ||
var filesPromise = new common.PromiseContainer(); | ||
function createFilesPromise(fileList, emitter) { | ||
// Set an empty list of files to avoid race issues with | ||
// file_list_modified not having been emitted yet | ||
filesPromise.set(Promise.resolve(fileList.files)); | ||
emitter.on('file_list_modified', function (files) { | ||
filesPromise.set(Promise.resolve(files)) | ||
}); | ||
return filesPromise; | ||
if (KARMA_MAJOR_VERSION < 5) { | ||
var filesPromise = new common.PromiseContainer() | ||
filesPromise.set(Promise.resolve(fileList.files)); | ||
emitter.on('file_list_modified', function (files) { | ||
filesPromise.set(Promise.resolve(files)) | ||
}); | ||
return filesPromise; | ||
} else { | ||
let files = fileList.files | ||
emitter.on('file_list_modified', (filesParam) => { files = filesParam }) | ||
return { | ||
then(...args) { | ||
return Promise.resolve(files).then(...args) | ||
} | ||
} | ||
} | ||
} | ||
@@ -25,0 +38,0 @@ |
@@ -17,5 +17,5 @@ let fs = require('fs'); | ||
} | ||
let file = `${TMP_STATIC_FILES_DIR}/${req._parsedUrl.pathname.substr(STATIC_PREFIX.length)}`; | ||
let file = `${TMP_STATIC_FILES_DIR}/${decodeURI(req._parsedUrl.pathname.substr(STATIC_PREFIX.length))}`; | ||
log.debug(`Searching for file to ${req.url} in ${file}`); | ||
@@ -22,0 +22,0 @@ |
{ | ||
"name": "karma-iframes", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Lets you run each test in a separate context, loaded as an iframe.", | ||
@@ -13,4 +13,5 @@ "main": "index.js", | ||
"test": "RUN_IN_PARENT=true npm run test-try-twice && RUN_IN_PARENT=false npm run test-try-twice", | ||
"test-try-twice": "npm run test-run || npm run test-run", | ||
"test-run": "karma start --single-run" | ||
"test-try-twice": "npm run test-run:gha || npm run test-run:gha", | ||
"test-run": "karma start --single-run", | ||
"test-run:gha": "karma start karma.conf.gha.js --single-run --browsers GhaHeadlessChrome" | ||
}, | ||
@@ -28,14 +29,14 @@ "keywords": [ | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"karma": "^3.1.1", | ||
"chai": "^4.3.4", | ||
"karma": "^6.2.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-firefox-launcher": "^2.1.0", | ||
"karma-mocha": "^2.0.1", | ||
"karma-safari-launcher": "^1.0.0", | ||
"mocha": "^4.0.1" | ||
"mocha": "^8.3.2" | ||
}, | ||
"dependencies": { | ||
"minimatch": "^3.0.4", | ||
"tmp": "0.0.33" | ||
"tmp": "0.2.1" | ||
}, | ||
@@ -42,0 +43,0 @@ "directories": { |
@@ -1,2 +0,2 @@ | ||
# What is `karma-iframes`? [](https://travis-ci.org/sabberworm/karma-iframes) | ||
# What is `karma-iframes`? [](https://github.com/sabberworm/karma-iframes/actions) | ||
@@ -3,0 +3,0 @@ It’s a Karma plugin that lets you run each test in a separate context, loaded as an iframe. |
66906
0.68%683
1.64%+ Added
+ Added
- Removed
- Removed
- Removed
Updated