Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit 66a39fa

Browse files
authored
fix: assert oldMethod existence, and pin typescript version (#1549)
* fix: assert oldMethod existence, and pin typescript version
1 parent 1b42f5a commit 66a39fa

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"timekeeper": "^2.0.0",
8888
"tmp": "0.2.1",
8989
"ts-node": "^10.7.0",
90-
"typescript": "^5.1.6"
90+
"typescript": "5.1.6"
9191
},
9292
"dependencies": {
9393
"@google-cloud/common": "^5.0.0",

src/cls/async-hooks.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ export class AsyncHooksCLS<Context extends {}> implements CLS<Context> {
192192
if (ee[method]) {
193193
shimmer.wrap(ee, method, oldMethod => {
194194
return function (this: {}, event: string, cb: Func<void>) {
195-
return oldMethod.call(this, event, that.bindWithCurrentContext(cb));
195+
return oldMethod!.call(
196+
this,
197+
event,
198+
that.bindWithCurrentContext(cb)
199+
);
196200
};
197201
});
198202
}

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ let traceAgent: StackdriverTracer;
5151
function initConfig(userConfig: Forceable<Config>): TopLevelConfig {
5252
let envSetConfig = {};
5353
if (process.env.GCLOUD_TRACE_CONFIG) {
54-
envSetConfig = require(path.resolve(
55-
process.env.GCLOUD_TRACE_CONFIG!
56-
)) as Config;
54+
envSetConfig = require(
55+
path.resolve(process.env.GCLOUD_TRACE_CONFIG!)
56+
) as Config;
5757
}
5858
// Configuration order of precedence:
5959
// 1. Environment Variables

test/test-span-data.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ describe('SpanData', () => {
216216

217217
for (const sourceMapType of sourceMapTypes) {
218218
it(`uses source maps when available in stack traces: ${sourceMapType}`, () => {
219-
const {applyGeneric} =
220-
require(`./fixtures/source-maps-test/${sourceMapType}`) as {
221-
applyGeneric: <T>(fn: () => T) => T;
222-
};
219+
const {applyGeneric} = require(
220+
`./fixtures/source-maps-test/${sourceMapType}`
221+
) as {
222+
applyGeneric: <T>(fn: () => T) => T;
223+
};
223224
const spanData = applyGeneric(
224225
() => new CommonSpanData(trace, 'name', '0', 0)
225226
);

test/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ function getFixturesForModule<T>(moduleName: string): Array<FixtureHelper<T>> {
191191
return moduleNameMatches && versionCompatible;
192192
})
193193
.map(key => {
194-
const version =
195-
require(`./plugins/fixtures/${key}/node_modules/${moduleName}/package.json`)
196-
.version as string;
194+
const version = require(
195+
`./plugins/fixtures/${key}/node_modules/${moduleName}/package.json`
196+
).version as string;
197197
const parsedVersion = semver.parse(version)!;
198198
const getModule: () => T = () => require(`./plugins/fixtures/${key}`);
199199
// Convenience function -- returns if.skip if the selected module's

0 commit comments

Comments
 (0)