diff --git a/lib/middleware/karma.js b/lib/middleware/karma.js
index 588fa609e..ebe492bb5 100644
--- a/lib/middleware/karma.js
+++ b/lib/middleware/karma.js
@@ -162,31 +162,27 @@ function createKarmaMiddleware (
const scriptTags = []
for (const file of files.included) {
- let filePath = file.path
+ const urlPath = file.isUrl
+ ? file.path
+ : requestUrl === '/context.html'
+ ? filePathToUrlPath(file.path, basePath, urlRoot, proxyPath) + '?' + file.sha
+ : filePathToUrlPath(file.path, basePath, urlRoot, proxyPath)
const fileType = helper.getFileType(file)
if (helper.isDefined(fileType) && !FILE_TYPES.includes(fileType)) {
log.warn(`Invalid file type (${fileType}), defaulting to js.`)
}
- if (!file.isUrl) {
- filePath = filePathToUrlPath(filePath, basePath, urlRoot, proxyPath)
-
- if (requestUrl === '/context.html') {
- filePath += '?' + file.sha
- }
- }
-
if (fileType === 'css') {
- scriptTags.push(``)
+ scriptTags.push(``)
} else if (fileType === 'dom') {
scriptTags.push(file.content)
} else if (fileType === 'html') {
- scriptTags.push(``)
+ scriptTags.push(``)
} else {
const scriptType = (SCRIPT_TYPE[fileType] || 'text/javascript')
const crossOriginAttribute = includeCrossOriginAttribute ? 'crossorigin="anonymous"' : ''
- scriptTags.push(``)
+ scriptTags.push(``)
}
}