diff --git a/samples/oauth2-codeVerifier.js b/samples/oauth2-codeVerifier.js index 4ec9208d..d91b7fa1 100644 --- a/samples/oauth2-codeVerifier.js +++ b/samples/oauth2-codeVerifier.js @@ -1,4 +1,4 @@ -// Copyright 2017, Google, Inc. +// Copyright 2017 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -16,7 +16,7 @@ const {OAuth2Client} = require('google-auth-library'); const http = require('http'); const url = require('url'); -const opn = require('opn'); +const open = require('open'); const destroyer = require('server-destroy'); // Download your OAuth2 configuration from the Google Developer Console. @@ -95,7 +95,7 @@ async function getAuthenticatedClient() { }) .listen(3000, () => { // open the browser to the authorize url to start the workflow - opn(authorizeUrl, {wait: false}).then(cp => cp.unref()); + open(authorizeUrl, {wait: false}).then(cp => cp.unref()); }); destroyer(server); }); diff --git a/samples/oauth2.js b/samples/oauth2.js index cfded95a..5d177a5d 100644 --- a/samples/oauth2.js +++ b/samples/oauth2.js @@ -1,4 +1,4 @@ -// Copyright 2017, Google, Inc. +// Copyright 2017 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -16,7 +16,7 @@ const {OAuth2Client} = require('google-auth-library'); const http = require('http'); const url = require('url'); -const opn = require('opn'); +const open = require('open'); const destroyer = require('server-destroy'); // Download your OAuth2 configuration from the Google @@ -88,7 +88,7 @@ function getAuthenticatedClient() { }) .listen(3000, () => { // open the browser to the authorize url to start the workflow - opn(authorizeUrl, {wait: false}).then(cp => cp.unref()); + open(authorizeUrl, {wait: false}).then(cp => cp.unref()); }); destroyer(server); }); diff --git a/samples/package.json b/samples/package.json index cef144b3..7e30dad8 100644 --- a/samples/package.json +++ b/samples/package.json @@ -17,7 +17,7 @@ "@googleapis/iam": "^15.0.0", "google-auth-library": "^9.7.0", "node-fetch": "^2.3.0", - "opn": "^6.0.0", + "open": "^6.0.0", "server-destroy": "^1.0.1" }, "devDependencies": { diff --git a/samples/verifyIdToken.js b/samples/verifyIdToken.js index a722df3b..89269892 100644 --- a/samples/verifyIdToken.js +++ b/samples/verifyIdToken.js @@ -1,4 +1,4 @@ -// Copyright 2017, Google, Inc. +// Copyright 2017 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -16,7 +16,7 @@ const {OAuth2Client} = require('google-auth-library'); const http = require('http'); const url = require('url'); -const opn = require('opn'); +const open = require('open'); const destroyer = require('server-destroy'); // Download your OAuth2 configuration from the Google @@ -87,7 +87,7 @@ function getAuthenticatedClient() { }) .listen(3000, () => { // open the browser to the authorize url to start the workflow - opn(authorizeUrl, {wait: false}).then(cp => cp.unref()); + open(authorizeUrl, {wait: false}).then(cp => cp.unref()); }); destroyer(server); }); diff --git a/src/auth/computeclient.ts b/src/auth/computeclient.ts index 35626b0a..fbcec074 100644 --- a/src/auth/computeclient.ts +++ b/src/auth/computeclient.ts @@ -55,8 +55,8 @@ export class Compute extends OAuth2Client { this.scopes = Array.isArray(options.scopes) ? options.scopes : options.scopes - ? [options.scopes] - : []; + ? [options.scopes] + : []; } /** diff --git a/src/transporters.ts b/src/transporters.ts index d4a298f0..41660308 100644 --- a/src/transporters.ts +++ b/src/transporters.ts @@ -64,9 +64,8 @@ export class DefaultTransporter implements Transporter { if (!uaValue) { opts.headers['User-Agent'] = DefaultTransporter.USER_AGENT; } else if (!uaValue.includes(`${PRODUCT_NAME}/`)) { - opts.headers[ - 'User-Agent' - ] = `${uaValue} ${DefaultTransporter.USER_AGENT}`; + opts.headers['User-Agent'] = + `${uaValue} ${DefaultTransporter.USER_AGENT}`; } // track google-auth-library-nodejs version: if (!opts.headers['x-goog-api-client']) { diff --git a/test/test.downscopedclient.ts b/test/test.downscopedclient.ts index d280a9ee..b808be72 100644 --- a/test/test.downscopedclient.ts +++ b/test/test.downscopedclient.ts @@ -54,11 +54,11 @@ class TestAuthClient extends AuthClient { this.credentials.expiry_date = expirationTime; } - async getRequestHeaders(url?: string): Promise { + async getRequestHeaders(): Promise { throw new Error('Not implemented.'); } - request(opts: GaxiosOptions): GaxiosPromise { + request(): GaxiosPromise { throw new Error('Not implemented.'); } } diff --git a/test/test.jwt.ts b/test/test.jwt.ts index 79eb1605..13b4695e 100644 --- a/test/test.jwt.ts +++ b/test/test.jwt.ts @@ -28,7 +28,6 @@ describe('jwt', () => { const keypair = require('keypair'); const PEM_PATH = './test/fixtures/private.pem'; const PEM_CONTENTS = fs.readFileSync(PEM_PATH, 'utf8'); - const P12_PATH = './test/fixtures/key.p12'; nock.disableNetConnect(); diff --git a/test/test.oauth2common.ts b/test/test.oauth2common.ts index 9b0a485f..2afd159a 100644 --- a/test/test.oauth2common.ts +++ b/test/test.oauth2common.ts @@ -104,9 +104,8 @@ describe('OAuthClientAuthHandler', () => { }; const actualOptions = Object.assign({}, originalOptions); const expectedOptions = Object.assign({}, originalOptions); - ( - expectedOptions.headers as Headers - ).Authorization = `Basic ${expectedBase64EncodedCred}`; + (expectedOptions.headers as Headers).Authorization = + `Basic ${expectedBase64EncodedCred}`; handler.testApplyClientAuthenticationOptions(actualOptions); assert.deepStrictEqual(expectedOptions, actualOptions); @@ -127,9 +126,8 @@ describe('OAuthClientAuthHandler', () => { }; const actualOptions = Object.assign({}, originalOptions); const expectedOptions = Object.assign({}, originalOptions); - ( - expectedOptions.headers as Headers - ).Authorization = `Basic ${expectedBase64EncodedCredNoSecret}`; + (expectedOptions.headers as Headers).Authorization = + `Basic ${expectedBase64EncodedCredNoSecret}`; handler.testApplyClientAuthenticationOptions(actualOptions); assert.deepStrictEqual(expectedOptions, actualOptions); @@ -146,9 +144,8 @@ describe('OAuthClientAuthHandler', () => { }; const actualOptions = Object.assign({}, originalOptions); const expectedOptions = Object.assign({}, originalOptions); - ( - expectedOptions.headers as Headers - ).Authorization = `Basic ${expectedBase64EncodedCred}`; + (expectedOptions.headers as Headers).Authorization = + `Basic ${expectedBase64EncodedCred}`; handler.testApplyClientAuthenticationOptions(actualOptions); assert.deepStrictEqual(expectedOptions, actualOptions); @@ -349,9 +346,8 @@ describe('OAuthClientAuthHandler', () => { }; const actualOptions = Object.assign({}, originalOptions); const expectedOptions = Object.assign({}, originalOptions); - ( - expectedOptions.headers as Headers - ).Authorization = `Bearer ${bearerToken}`; + (expectedOptions.headers as Headers).Authorization = + `Bearer ${bearerToken}`; handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken); assert.deepStrictEqual(expectedOptions, actualOptions); @@ -374,9 +370,8 @@ describe('OAuthClientAuthHandler', () => { const actualOptions = Object.assign({}, originalOptions); // Expected options should have bearer token in header. const expectedOptions = Object.assign({}, originalOptions); - ( - expectedOptions.headers as Headers - ).Authorization = `Bearer ${bearerToken}`; + (expectedOptions.headers as Headers).Authorization = + `Bearer ${bearerToken}`; handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken); assert.deepStrictEqual(expectedOptions, actualOptions); @@ -399,9 +394,8 @@ describe('OAuthClientAuthHandler', () => { const actualOptions = Object.assign({}, originalOptions); // Expected options should have bearer token in header. const expectedOptions = Object.assign({}, originalOptions); - ( - expectedOptions.headers as Headers - ).Authorization = `Bearer ${bearerToken}`; + (expectedOptions.headers as Headers).Authorization = + `Bearer ${bearerToken}`; handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken); assert.deepStrictEqual(expectedOptions, actualOptions); diff --git a/test/test.pluggableauthclient.ts b/test/test.pluggableauthclient.ts index 17ecf351..45cbaf8d 100644 --- a/test/test.pluggableauthclient.ts +++ b/test/test.pluggableauthclient.ts @@ -17,7 +17,7 @@ import { ExecutableError, PluggableAuthClient, } from '../src/auth/pluggable-auth-client'; -import {BaseExternalAccountClient, IdentityPoolClient} from '../src'; +import {BaseExternalAccountClient} from '../src'; import { assertGaxiosResponsePresent, getAudience, diff --git a/test/test.transporters.ts b/test/test.transporters.ts index d7da2196..6c019191 100644 --- a/test/test.transporters.ts +++ b/test/test.transporters.ts @@ -155,9 +155,9 @@ describe('transporters', () => { assert.strictEqual(res!.status, 200); done(); }, - _error => { + error => { scope.done(); - done('Unexpected promise failure'); + done(error); } ); });