diff --git a/lib/middleware/karma.js b/lib/middleware/karma.js
index c92ae21a1..5f701e7e7 100644
--- a/lib/middleware/karma.js
+++ b/lib/middleware/karma.js
@@ -45,7 +45,7 @@ function getQuery (urlStr) {
function getXUACompatibleMetaElement (url) {
const query = getQuery(url)
if (query['x-ua-compatible']) {
- return `\n`
+ return ``
}
return ''
}
@@ -107,7 +107,7 @@ function createKarmaMiddleware (
} else { // serve client.html
return serveStaticFile('/client.html', requestedRangeHeader, response, (data) =>
data
- .replace('\n%X_UA_COMPATIBLE%', getXUACompatibleMetaElement(request.url))
+ .replace('%X_UA_COMPATIBLE%', getXUACompatibleMetaElement(request.url))
.replace('%X_UA_COMPATIBLE_URL%', getXUACompatibleUrl(request.url)))
}
}
@@ -226,7 +226,7 @@ function createKarmaMiddleware (
.replace('%CLIENT_CONFIG%', 'window.__karma__.config = ' + JSON.stringify(client) + ';\n')
.replace('%SCRIPT_URL_ARRAY%', () => 'window.__karma__.scriptUrls = ' + JSON.stringify(scriptUrls) + ';\n')
.replace('%MAPPINGS%', () => 'window.__karma__.files = {\n' + mappings.join(',\n') + '\n};\n')
- .replace('\n%X_UA_COMPATIBLE%', getXUACompatibleMetaElement(request.url))
+ .replace('%X_UA_COMPATIBLE%', getXUACompatibleMetaElement(request.url))
})
})
} else if (requestUrl === '/context.json') {
diff --git a/static/client.html b/static/client.html
index 4e069e1ef..73fb856a4 100644
--- a/static/client.html
+++ b/static/client.html
@@ -5,7 +5,7 @@
-->
-%X_UA_COMPATIBLE%
+ %X_UA_COMPATIBLE%
Karma
diff --git a/static/debug.html b/static/debug.html
index 3fc6173f2..e8c667674 100644
--- a/static/debug.html
+++ b/static/debug.html
@@ -6,7 +6,7 @@
-->
-%X_UA_COMPATIBLE%
+ %X_UA_COMPATIBLE%
Karma DEBUG RUNNER
diff --git a/test/unit/middleware/karma.spec.js b/test/unit/middleware/karma.spec.js
index b6a0d5d59..4f6b873c2 100644
--- a/test/unit/middleware/karma.spec.js
+++ b/test/unit/middleware/karma.spec.js
@@ -27,10 +27,10 @@ describe('middleware.karma', () => {
const fsMock = mocks.fs.create({
karma: {
static: {
- 'client.html': mocks.fs.file(0, 'CLIENT HTML\n%X_UA_COMPATIBLE%%X_UA_COMPATIBLE_URL%'),
+ 'client.html': mocks.fs.file(0, 'CLIENT HTML%X_UA_COMPATIBLE%%X_UA_COMPATIBLE_URL%'),
'client_with_context.html': mocks.fs.file(0, 'CLIENT_WITH_CONTEXT\n%SCRIPT_URL_ARRAY%'),
'context.html': mocks.fs.file(0, 'CONTEXT\n%SCRIPTS%'),
- 'debug.html': mocks.fs.file(0, 'DEBUG\n%SCRIPTS%\n%X_UA_COMPATIBLE%'),
+ 'debug.html': mocks.fs.file(0, 'DEBUG\n%SCRIPTS%%X_UA_COMPATIBLE%'),
'karma.js': mocks.fs.file(0, 'root: %KARMA_URL_ROOT%, proxy: %KARMA_PROXY_PATH%, v: %KARMA_VERSION%')
}
}
@@ -170,7 +170,7 @@ describe('middleware.karma', () => {
response.once('end', () => {
expect(nextSpy).not.to.have.been.called
- expect(response).to.beServedAs(200, 'CLIENT HTML\n?x-ua-compatible=xxx%3Dyyy')
+ expect(response).to.beServedAs(200, 'CLIENT HTML?x-ua-compatible=xxx%3Dyyy')
done()
})
@@ -182,7 +182,7 @@ describe('middleware.karma', () => {
response.once('end', () => {
expect(nextSpy).not.to.have.been.called
- expect(response).to.beServedAs(200, 'DEBUG\n\n')
+ expect(response).to.beServedAs(200, 'DEBUG\n')
done()
})