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

Commit a21c83d

Browse files
Update test files to use the .ts extension (#315)
1 parent 232e494 commit a21c83d

33 files changed

+352
-272
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@types/estree": "0.0.35",
2828
"@types/extend": "^2.0.30",
2929
"@types/lodash": "^4.14.66",
30+
"@types/mocha": "^2.2.41",
3031
"@types/node": "^7.0.18",
3132
"@types/semver": "^5.3.31",
3233
"@types/source-map": "^0.5.0",

src/debuggee.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ export class Debuggee {
7979
return new Debuggee(properties);
8080
}
8181

82-
properties = properties || {};
82+
// TODO: Determine if `statusMessage` should be optional or be required
83+
// and be explicitly set to `null`.
84+
properties = properties || { statusMessage: null };
8385

8486
if (!_.isString(properties.project)) {
8587
throw new Error('properties.project must be a string');
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ describe('@google-cloud/debug end-to-end behavior', function () {
8888
};
8989

9090
for (var i = 0; i < CLUSTER_WORKERS; i++) {
91+
// TODO: Determine how to have this not of type `any`.
9192
// Fork child processes that sned messages to this process with IPC.
92-
var child = { transcript: '' };
93+
var child: any = { transcript: '' };
9394
child.process = cp.fork(FILENAME, {
9495
execArgv: [],
9596
env: process.env,

test/debugger.js renamed to test/debugger.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ Debugger.prototype.listBreakpoints = function(debuggeeId, options, callback) {
114114
options = {};
115115
}
116116

117-
var query = {
117+
// TODO: Remove this cast as `any`
118+
var query: any = {
118119
clientVersion: this.clientVersion_,
119120
includeAllUsers: !!options.includeAllUsers,
120121
includeInactive: !!options.includeInactive,

test/misc/bench-code.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*1* KEEP THIS CODE AT THE TOP TO AVOID LINE NUMBER CHANGES */
2+
/*2*/'use strict';
3+
/*3*/function fib(n) {
4+
/*4*/ return n < 2 ? n : fib(n-2) + fib(n-1);
5+
/*5*/}
6+
/*6*/module.exports = fib;
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*1* KEEP THIS CODE AT THE TOP TO AVOID LINE NUMBER CHANGES */
2-
/*2*/'use strict';
3-
/*3*/function fib(n) {
4-
/*4*/ return n < 2 ? n : fib(n-2) + fib(n-1);
5-
/*5*/}
6-
71
/**
82
* Copyright 2015 Google Inc. All Rights Reserved.
93
*
@@ -24,9 +18,10 @@
2418
var v8debugapi = require('../src/v8debugapi.js');
2519
var Logger = require('../src/logger.js');
2620
var config = require('../config.js').default;
27-
var assert = require('assert');
21+
import * as assert from 'assert';
2822
var pretty = require('pretty-hrtime');
2923
//var util = require('util');
24+
var fib = require('./bench-code.js');
3025

3126
var logger = new Logger(config.logLevel);
3227
assert.ok(v8debugapi.init(logger, config));
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var v8debugapi = require('../src/v8debugapi.js');
44
var Logger = require('../src/logger.js');
55
var config = require('../config.js').default;
6-
var assert = require('assert');
6+
import * as assert from 'assert';
77
var util = require('util');
88
var logger = new Logger(config.logLevel);
99

test/nocks.js renamed to test/nocks.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
'use strict';
1716

18-
var nock = require('nock');
17+
var nock = require('nock');
1918

2019
// In the future _=>true.
2120
function accept() {
2221
return true;
2322
}
2423

25-
function nockOAuth2(validator) {
24+
export function oauth2(validator) {
2625
validator = validator || accept;
2726
return nock('https://accounts.google.com')
2827
.post('/o/oauth2/token', validator)
@@ -34,23 +33,17 @@ function nockOAuth2(validator) {
3433
});
3534
}
3635

37-
function nockRegister(validator) {
36+
export function register(validator) {
3837
validator = validator || accept;
3938
return nock('https://clouddebugger.googleapis.com')
4039
.post('/v2/controller/debuggees/register', validator)
4140
.once()
4241
.reply(200);
4342
}
4443

45-
function nockProjectId(reply) {
44+
export function projectId(reply) {
4645
return nock('http://metadata.google.internal')
4746
.get('/computeMetadata/v1/project/project-id')
4847
.once()
4948
.reply(200, reply);
5049
}
51-
52-
module.exports = {
53-
oauth2: nockOAuth2,
54-
projectId: nockProjectId,
55-
register: nockRegister
56-
};

0 commit comments

Comments
 (0)