Skip to content

Commit

Permalink
Fixes always enabled debug log
Browse files Browse the repository at this point in the history
The configurable debug log path merged in #974
introduced a regression that logs are always written.

Write logs only to testem.log when -d is set.
  • Loading branch information
johanneswuerbach committed Sep 10, 2016
1 parent c3c86b9 commit 3d399ea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ function Config(appMode, progOptions, config) {
this.progOptions.parallel = -1;
}

if (this.progOptions.debug === true) {
this.progOptions.debug = 'testem.log';
}

if (appMode === 'ci') {
this.progOptions.disable_watching = true;
this.progOptions.single_run = true;
Expand Down
2 changes: 1 addition & 1 deletion testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ program
.option('--host [hostname]', 'host name - defaults to localhost', String)
.option('-l, --launch [list]', 'list of launchers to launch(comma separated)')
.option('-s, --skip [list]', 'list of launchers to skip(comma separated)')
.option('-d, --debug [file]', 'output debug to debug log - defaults to testem.log', 'testem.log')
.option('-d, --debug [file]', 'output debug to debug log - defaults to testem.log')
.option('-t, --test_page [page]', 'the html page to drive the tests')
.option('-g, --growl', 'turn on growl / native notifications');

Expand Down
27 changes: 27 additions & 0 deletions tests/config_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,33 @@ describe('Config', function() {
expect(config.get('browser_start_timeout')).to.eq(30);
});
});

describe('debug', function() {
describe('when unset', function() {
it('is not defined', function() {
var config = new Config('dev', {});
expect(config.get('debug')).not.to.exist();
});
});

describe('when set', function() {
it('defaults to testem.log', function() {
var config = new Config('dev', {
debug: true
});
expect(config.get('debug')).to.eq('testem.log');
});
});

describe('when set and file name specified', function() {
it('uses the provided file name', function() {
var config = new Config('dev', {
debug: 'debug.log'
});
expect(config.get('debug')).to.eq('debug.log');
});
});
});
});

function mockTopLevelProgOptions() {
Expand Down

0 comments on commit 3d399ea

Please sign in to comment.