Skip to content

Commit

Permalink
Fix undefined global logs. (Closes #124)
Browse files Browse the repository at this point in the history
  • Loading branch information
netzpirat committed Apr 10, 2013
1 parent 1733613 commit 2c03ffc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Master

- [#124](https://github.com/netzpirat/guard-jasmine/pull/124): Fix undefined global logs.

## 1.15.0 - April 8, 2013

- [#123](https://github.com/netzpirat/guard-jasmine/issues/123): Report javascript errors that prevent specs from running. ([@swistak][])
Expand Down
4 changes: 2 additions & 2 deletions lib/guard/jasmine/phantomjs/guard-jasmine.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ page.onConsoleMessage = (msg, line, source) ->

else if /^SPEC_START: (\d+)$/.test(msg)
currentSpecId = Number(RegExp.$1)
logs[currentSpecId] = []

else
logs[currentSpecId] ||= []
logs[currentSpecId].push(msg)

# Initialize the page before the JavaScript is run.
Expand All @@ -68,7 +68,7 @@ page.open options.url, (status) ->
phantom.exit()
else
runnerAvailable = page.evaluate -> window.jasmine

if runnerAvailable
done = -> phantom.exit()
waitFor specsReady, done, options.timeout
Expand Down
5 changes: 2 additions & 3 deletions lib/guard/jasmine/phantomjs/guard-jasmine.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Generated by CoffeeScript 1.3.3
(function() {
var currentSpecId, errors, logs, options, page, specsReady, waitFor;

Expand Down Expand Up @@ -42,9 +41,9 @@
return window.resultReceived = true;
});
} else if (/^SPEC_START: (\d+)$/.test(msg)) {
currentSpecId = Number(RegExp.$1);
return logs[currentSpecId] = [];
return currentSpecId = Number(RegExp.$1);
} else {
logs[currentSpecId] || (logs[currentSpecId] = []);
return logs[currentSpecId].push(msg);
}
};
Expand Down

0 comments on commit 2c03ffc

Please sign in to comment.