Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Allow to set log file name
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Aug 27, 2020
1 parent d7032fc commit 1536e65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ export.config = {
// ...
services: [
['chromedriver', {
logFileName: 'wdio-chromedriver.log', // default
outputDir: 'driver-logs', // overwrites the config.outputDir
args: ['--silent'] //
args: ['--silent']
}]
],
// ...
Expand Down Expand Up @@ -102,7 +103,12 @@ Example: `driver-logs`

Type: `string`

### logFileName
The name of the log file to be written in `outputDir`.

Example: `wdio-chromedriver.log`

Type: `string`

----

Expand Down
9 changes: 5 additions & 4 deletions src/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ChromeDriver from 'chromedriver'

import getFilePath from './utils/getFilePath'

const DEFAULT_LOG_FILENAME = 'chromedriver.log'
const DEFAULT_LOG_FILENAME = 'wdio-chromedriver.log'

const DEFAULT_CONNECTION = {
protocol: 'http',
Expand All @@ -25,6 +25,7 @@ export default class ChromeDriverLauncher {
}

this.outputDir = options.outputDir || config.outputDir
this.logFileName = options.logFileName || DEFAULT_LOG_FILENAME
this.capabilities = capabilities
this.args = options.args || []
}
Expand Down Expand Up @@ -60,7 +61,7 @@ export default class ChromeDriverLauncher {
}

_redirectLogStream() {
const logFile = getFilePath(this.outputDir, DEFAULT_LOG_FILENAME)
const logFile = getFilePath(this.outputDir, this.logFileName)

// ensure file & directory exists
fs.ensureFileSync(logFile)
Expand All @@ -73,8 +74,8 @@ export default class ChromeDriverLauncher {
_mapCapabilities() {
if (isMultiremote(this.capabilities)) {
for (const cap in this.capabilities) {
if (isChrome(this.capabilities[cap])) {
Object.assign(this.capabilities[cap], this.options)
if (isChrome(this.capabilities[cap].capabilities)) {
Object.assign(this.capabilities[cap].capabilities, this.options)
}
}
} else {
Expand Down

0 comments on commit 1536e65

Please sign in to comment.