From eb942e0af21f792a13dffd1d941c7292d61e9f7f Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 6 Feb 2024 14:47:22 -0800 Subject: [PATCH 1/3] test failing test remotely From a64e6b46f371b339e67883f711f61d830417a630 Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 6 Feb 2024 15:37:35 -0800 Subject: [PATCH 2/3] chore: pin ts version and make ts fix --- package.json | 2 +- src/cls/async-hooks.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4abe7be77..03f34240d 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "timekeeper": "^2.0.0", "tmp": "0.2.1", "ts-node": "^10.7.0", - "typescript": "^5.1.6" + "typescript": "5.1.6" }, "dependencies": { "@google-cloud/common": "^5.0.0", diff --git a/src/cls/async-hooks.ts b/src/cls/async-hooks.ts index 369ce917e..60e53cb26 100644 --- a/src/cls/async-hooks.ts +++ b/src/cls/async-hooks.ts @@ -192,7 +192,7 @@ export class AsyncHooksCLS implements CLS { if (ee[method]) { shimmer.wrap(ee, method, oldMethod => { return function (this: {}, event: string, cb: Func) { - return oldMethod.call(this, event, that.bindWithCurrentContext(cb)); + return oldMethod!.call(this, event, that.bindWithCurrentContext(cb)); }; }); } From 4554e536e610568390c59d7ce10aa82c0b90be2b Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Tue, 6 Feb 2024 15:41:00 -0800 Subject: [PATCH 3/3] run lint --- src/cls/async-hooks.ts | 6 +++++- src/index.ts | 6 +++--- test/test-span-data.ts | 9 +++++---- test/utils.ts | 6 +++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/cls/async-hooks.ts b/src/cls/async-hooks.ts index 60e53cb26..696c19e4f 100644 --- a/src/cls/async-hooks.ts +++ b/src/cls/async-hooks.ts @@ -192,7 +192,11 @@ export class AsyncHooksCLS implements CLS { if (ee[method]) { shimmer.wrap(ee, method, oldMethod => { return function (this: {}, event: string, cb: Func) { - return oldMethod!.call(this, event, that.bindWithCurrentContext(cb)); + return oldMethod!.call( + this, + event, + that.bindWithCurrentContext(cb) + ); }; }); } diff --git a/src/index.ts b/src/index.ts index aa417e85c..0db070bf0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,9 +51,9 @@ let traceAgent: StackdriverTracer; function initConfig(userConfig: Forceable): TopLevelConfig { let envSetConfig = {}; if (process.env.GCLOUD_TRACE_CONFIG) { - envSetConfig = require(path.resolve( - process.env.GCLOUD_TRACE_CONFIG! - )) as Config; + envSetConfig = require( + path.resolve(process.env.GCLOUD_TRACE_CONFIG!) + ) as Config; } // Configuration order of precedence: // 1. Environment Variables diff --git a/test/test-span-data.ts b/test/test-span-data.ts index c384f10c4..6bfaa093a 100644 --- a/test/test-span-data.ts +++ b/test/test-span-data.ts @@ -216,10 +216,11 @@ describe('SpanData', () => { for (const sourceMapType of sourceMapTypes) { it(`uses source maps when available in stack traces: ${sourceMapType}`, () => { - const {applyGeneric} = - require(`./fixtures/source-maps-test/${sourceMapType}`) as { - applyGeneric: (fn: () => T) => T; - }; + const {applyGeneric} = require( + `./fixtures/source-maps-test/${sourceMapType}` + ) as { + applyGeneric: (fn: () => T) => T; + }; const spanData = applyGeneric( () => new CommonSpanData(trace, 'name', '0', 0) ); diff --git a/test/utils.ts b/test/utils.ts index 67b5cd400..519e13dcb 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -191,9 +191,9 @@ function getFixturesForModule(moduleName: string): Array> { return moduleNameMatches && versionCompatible; }) .map(key => { - const version = - require(`./plugins/fixtures/${key}/node_modules/${moduleName}/package.json`) - .version as string; + const version = require( + `./plugins/fixtures/${key}/node_modules/${moduleName}/package.json` + ).version as string; const parsedVersion = semver.parse(version)!; const getModule: () => T = () => require(`./plugins/fixtures/${key}`); // Convenience function -- returns if.skip if the selected module's