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

Commit

Permalink
Make E2E tests ScopeMirror aware (#149)
Browse files Browse the repository at this point in the history
* Update package.json

Add `semver` to dependencies for node version checking.

* Update test.js

Add version check in breakpoint fetch and compare
for determination of local or argument array value
lookups. Update `.find` call to use `.matches` property
shorthand.
  • Loading branch information
cristiancavalli committed Aug 20, 2016
1 parent edcfb04 commit 198fb1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion test/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "Apache-2.0",
"dependencies": {
"lodash": "^3.9.3",
"q": "^1.4.1"
"q": "^1.4.1",
"semver": "^5.3.0"
}
}
10 changes: 7 additions & 3 deletions test/e2e/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var GoogleAuth = require('google-auth-library');
var _ = require('lodash'); // for _.find. Can't use ES6 yet.
var Q = require('q');
var cluster = require('cluster');
var semver = require('semver');

var DEBUG_API = 'https://clouddebugger.googleapis.com/v2/debugger';
var SCOPES = [
Expand Down Expand Up @@ -209,6 +210,7 @@ function runTest() {
return promise;
})
.then(function(body) {
var arg;
console.log('-- results of get breakpoint\n', body);
assert.ok(body.breakpoint, 'should have a breakpoint in the response');
var hit = body.breakpoint;
Expand All @@ -219,9 +221,11 @@ function runTest() {
assert.ok(top.function, 'frame should have a function property');
assert.strictEqual(top.function, 'fib');

var arg = _.find(top.arguments, function(a) {
return a.name === 'n';
});
if (semver.satisfies(process.version, '>=4.0')) {
arg = _.find(top.locals, {name: 'n'});
} else {
arg = _.find(top.arguments, {name: 'n'});
}
assert.ok(arg, 'should find the n argument');
assert.strictEqual(arg.value, '10');
console.log('-- checking log point was hit again');
Expand Down

0 comments on commit 198fb1e

Please sign in to comment.