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

Commit

Permalink
Update dependencies to enable Greenkeeper 馃尨 (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] authored and DominicKramer committed Nov 6, 2017
1 parent cdee56f commit a530d1c
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 88 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Stackdriver Debugger agent for Node.js

[![Greenkeeper badge](https://badges.greenkeeper.io/GoogleCloudPlatform/cloud-debug-nodejs.svg)](https://greenkeeper.io/)

[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"devDependencies": {
"@types/acorn": "^4.0.2",
"@types/async": "^2.0.40",
"@types/estree": "0.0.35",
"@types/extend": "^2.0.30",
"@types/estree": "0.0.38",
"@types/extend": "^3.0.0",
"@types/lodash": "^4.14.69",
"@types/mkdirp": "^0.5.1",
"@types/mocha": "^2.2.41",
Expand All @@ -38,16 +38,16 @@
"@types/source-map": "^0.5.0",
"changelog-maker": "^2.2.2",
"closure-npc": "*",
"coveralls": "^2.11.2",
"coveralls": "^3.0.0",
"gts": "latest",
"istanbul": "^0.4.1",
"mocha": "^3.5.3",
"mkdirp": "^0.5.1",
"mocha": "^4.0.1",
"ncp": "^2.0.0",
"nock": "^9.0.0",
"pify": "^3.0.0",
"request": "^2.81.0",
"source-map-support": "^0.4.15",
"source-map-support": "^0.5.0",
"tslint": "^5.4.3",
"typescript": "~2.6.1"
},
Expand All @@ -61,7 +61,7 @@
"gcp-metadata": "^0.4.0",
"lodash": "^4.12.0",
"semver": "^5.1.0",
"source-map": "^0.5.1",
"source-map": "^0.6.1",
"split": "^1.0.0",
"util.promisify": "^1.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/agent/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as common from '../types/common';

export interface DebugAgentConfig extends common.AuthenticationConfig {
workingDirectory?: string;
workingDirectory: string;

/**
* A user specified way of identifying the service
Expand Down
15 changes: 6 additions & 9 deletions src/agent/debuglet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,20 +423,17 @@ export class Debuglet extends EventEmitter {

static getProjectIdFromMetadata() {
return new Promise<string>((resolve, reject) => {
metadata.project(
'project-id', (err, res, projectId) => {
err ? reject(err) : resolve(projectId);
});
metadata.project('project-id', (err, res, projectId) => {
err ? reject(err) : resolve(projectId);
});
});
}

static getClusterNameFromMetadata() {
return new Promise<string>((resolve, reject) => {
metadata.instance(
'attributes/cluster-name',
(err, res, clusterName) => {
err ? reject(err) : resolve(clusterName);
});
metadata.instance('attributes/cluster-name', (err, res, clusterName) => {
err ? reject(err) : resolve(clusterName);
});
});
}

Expand Down
3 changes: 1 addition & 2 deletions src/agent/io/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ function computeStats(
const statistics: ScanStats = {};
fileList.forEach(function(filename) {
statsForFile(
filename, shouldHash,
function(err: Error|null, fileStats?: FileStats) {
filename, shouldHash, function(err: Error|null, fileStats?: FileStats) {
if (err) {
callback(err);
return;
Expand Down
5 changes: 4 additions & 1 deletion src/agent/io/sourcemapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ function processSourcemap(
// TODO: Determine how to reconsile the type conflict where `consumer`
// is constructed as a SourceMapConsumer but is used as a
// RawSourceMap.
consumer = new sourceMap.SourceMapConsumer(data) as any as
// TODO: Resolve the cast of `data as any` (This is needed because the
// type is expected to be of `RawSourceMap` but the existing
// working code uses a string.)
consumer = new sourceMap.SourceMapConsumer(data as any) as any as
sourceMap.RawSourceMap;
} catch (e) {
return callback(new Error(
Expand Down
41 changes: 21 additions & 20 deletions src/agent/state/legacy-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,26 +397,27 @@ class StateResolver {
scopes = allScopes.slice(0, -2);
}

const fromScopes: stackdriver.Variable[][] = scopes.map(function(scope: v8.ScopeMirror) {
return transform(
// TODO: Update this so that `locals` is not of type `any[]`.
scope.details().object(),
function(locals: stackdriver.Variable[], value, name: string) {
const trg = makeMirror(value);
if (!usedNames[name]) {
// It's a valid variable that belongs in the locals list
// and wasn't discovered at a lower-scope
usedNames[name] = true;
// TODO: Determine how to not have an explicit down cast to
// ValueMirror
locals.push(self.resolveVariable_(
name, trg as v8.ValueMirror, false));
} // otherwise another same-named variable occured at a
// lower scope
return locals;
},
[]);
});
const fromScopes: stackdriver.Variable[][] =
scopes.map(function(scope: v8.ScopeMirror) {
return transform(
// TODO: Update this so that `locals` is not of type `any[]`.
scope.details().object(),
function(locals: stackdriver.Variable[], value, name: string) {
const trg = makeMirror(value);
if (!usedNames[name]) {
// It's a valid variable that belongs in the locals list
// and wasn't discovered at a lower-scope
usedNames[name] = true;
// TODO: Determine how to not have an explicit down cast to
// ValueMirror
locals.push(self.resolveVariable_(
name, trg as v8.ValueMirror, false));
} // otherwise another same-named variable occured at a
// lower scope
return locals;
},
[]);
});

function resolveFromReceiver(): stackdriver.Variable[] {
// The frame receiver is the 'this' context that is present during
Expand Down
9 changes: 8 additions & 1 deletion src/types/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ export interface AuthenticationConfig {
/**
* Instead of a keyFilename, credentials can also be provided inline.
*/
credentials?: {client_email?: string; private_key?: string;};
credentials?: {
client_email?: string;
private_key?: string;
client_id?: string;
client_secret?: string;
refresh_token?: string;
type?: string;
};
}

export interface ServiceConfig {
Expand Down
54 changes: 25 additions & 29 deletions test/test-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ describe('Controller API', function() {
});
const controller = new Controller(fakeDebug);
// TODO: Determine if this type signature is correct.
controller.register(
debuggee, function(err, result) {
assert(!err, 'not expecting an error');
assert.ok(result);
assert.equal(result!.debuggee.id, 'fake-debuggee');
scope.done();
done();
});
controller.register(debuggee, function(err, result) {
assert(!err, 'not expecting an error');
assert.ok(result);
assert.equal(result!.debuggee.id, 'fake-debuggee');
scope.done();
done();
});
});

it('should not return an error when the debuggee isDisabled',
Expand All @@ -79,16 +78,15 @@ describe('Controller API', function() {
agentVersion: agentVersion
});
const controller = new Controller(fakeDebug);
controller.register(
debuggee, function(err, result) {
// TODO: Fix this incorrect method signature.
(assert as any).ifError(err, 'not expecting an error');
assert.ok(result);
assert.equal(result!.debuggee.id, 'fake-debuggee');
assert.ok(result!.debuggee.isDisabled);
scope.done();
done();
});
controller.register(debuggee, function(err, result) {
// TODO: Fix this incorrect method signature.
(assert as any).ifError(err, 'not expecting an error');
assert.ok(result);
assert.equal(result!.debuggee.id, 'fake-debuggee');
assert.ok(result!.debuggee.isDisabled);
scope.done();
done();
});
});

});
Expand Down Expand Up @@ -231,17 +229,15 @@ describe('Controller API', function() {
const debuggee: Debuggee = {id: 'fake-debuggee'} as Debuggee;
const controller = new Controller(fakeDebug);
// TODO: Determine if the response parameter should be used.
controller.listBreakpoints(
debuggee,
function(err, response, result) {
assert(!err, 'not expecting an error');
assert.ok(result);
assert(result!.breakpoints, 'should have a breakpoints property');
const bps = result!.breakpoints;
assert.deepEqual(bps, breakpoints, 'breakpoints mismatch');
scope.done();
done();
});
controller.listBreakpoints(debuggee, function(err, response, result) {
assert(!err, 'not expecting an error');
assert.ok(result);
assert(result!.breakpoints, 'should have a breakpoints property');
const bps = result!.breakpoints;
assert.deepEqual(bps, breakpoints, 'breakpoints mismatch');
scope.done();
done();
});
});
});
});
Expand Down
36 changes: 18 additions & 18 deletions test/test-debuglet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,23 +354,23 @@ describe('Debuglet', function() {
debuggee: {id: DEBUGGEE_ID}
});

debuglet.once('registered', function(id: string) {
assert.equal(id, DEBUGGEE_ID);
// TODO: Handle the case where debuglet.debuggee is undefined
assert.equal((debuglet.debuggee as Debuggee).project, projectId);
const arch = process.arch;
if (semver.satisfies(process.version, '>=8.5.0') &&
semver.satisfies(process.version, '<8.9.0') &&
(arch === 'ia32' || arch === 'x86') &&
process.env.GCLOUD_USE_INSPECTOR) {
assert(logText.includes(utils.messages.ASYNC_TRACES_WARNING));
} else {
assert(!logText.includes(utils.messages.ASYNC_TRACES_WARNING));
}
debuglet.stop();
scope.done();
done();
});
debuglet.once('registered', function(id: string) {
assert.equal(id, DEBUGGEE_ID);
// TODO: Handle the case where debuglet.debuggee is undefined
assert.equal((debuglet.debuggee as Debuggee).project, projectId);
const arch = process.arch;
if (semver.satisfies(process.version, '>=8.5.0') &&
semver.satisfies(process.version, '<8.9.0') &&
(arch === 'ia32' || arch === 'x86') &&
process.env.GCLOUD_USE_INSPECTOR) {
assert(logText.includes(utils.messages.ASYNC_TRACES_WARNING));
} else {
assert(!logText.includes(utils.messages.ASYNC_TRACES_WARNING));
}
debuglet.stop();
scope.done();
done();
});

debuglet.start();
});
Expand Down Expand Up @@ -441,7 +441,7 @@ describe('Debuglet', function() {
});

describe('environment variables', function() {
let env: {[key: string]: string};
let env: NodeJS.ProcessEnv;
beforeEach(function() {
env = extend({}, process.env);
});
Expand Down
2 changes: 1 addition & 1 deletion test/test-options-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('test-options-credentials', function() {

it('should ignore keyFilename if credentials is provided', function(done) {
const fileCredentials = require('./fixtures/gcloud-credentials.json');
const credentials = {
const credentials: {[key: string]: string|undefined} = {
client_id: 'a',
client_secret: 'b',
refresh_token: 'c',
Expand Down

0 comments on commit a530d1c

Please sign in to comment.