Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: escape filesystem characters in browser name #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var os = require('os')
var path = require('path')
var fs = require('fs')
var builder = require('xmlbuilder')
var sanitizeFilename = require('sanitize-filename')

var JUnitReporter = function (baseReporterDecorator, config, logger, helper, formatError) {
var log = logger.create('reporter.junit')
Expand Down Expand Up @@ -48,7 +49,7 @@ var JUnitReporter = function (baseReporterDecorator, config, logger, helper, for
}

var writeXmlForBrowser = function (browser) {
var safeBrowserName = browser.name.replace(/ /g, '_')
var safeBrowserName = sanitizeFilename(browser.name, { replacement: '_' }).replace(/ /g, '_')
var newOutputFile
if (outputFile != null) {
var dir = useBrowserName ? path.join(outputDir, safeBrowserName)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
],
"author": "Vojta Jina <vojta.jina@gmail.com>",
"dependencies": {
"sanitize-filename": "1.4.5",
"xmlbuilder": "3.1.0"
},
"peerDependencies": {
Expand Down