Skip to content

Commit

Permalink
fix: timeout on test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
tomer-friedman committed Feb 22, 2023
1 parent dfe7586 commit 2b3fc15
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions jest-opentelemetry.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
timeout: 2000,
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const COMPARE_TYPE = {
EQUALS: 'equal',
CONTAINS: 'contain',
EQUALS: 'equals',
CONTAINS: 'contains',
REGEX: 'regex',
} as const;

Expand Down
6 changes: 3 additions & 3 deletions packages/expect-opentelemetry/src/trace-loop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ export class TraceLoop {
this._fetchedTrace = true;
}

serviceByName(name: string, options?: CompareOptions) {
public serviceByName(name: string, options?: CompareOptions) {
return new Service(
name,
byServiceName(name, this._traceData, this._traceId, options),
);
}

serviceByK8sPodName(name: string, options?: CompareOptions) {
public serviceByK8sPodName(name: string, options?: CompareOptions) {
return new Service(
name,
byK8sPodName(name, this._traceData, this._traceId, options),
);
}

serviceByCustomAttribute(
public serviceByCustomAttribute(
key: string,
value: string | RegExp,
options?: CompareOptions,
Expand Down
5 changes: 5 additions & 0 deletions packages/jest-environment-otel/src/readConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path';
import { promisify } from 'util';
import cwd from 'cwd';
import merge from 'merge-deep';
import { setTimeout } from 'timers/promises';

const exists = promisify(fs.exists);

Expand Down Expand Up @@ -37,5 +38,9 @@ export async function readConfig() {

const localConfig = await require(absConfigPath);

if (localConfig.timeout) {
await setTimeout(localConfig.timeout);
}

return merge({}, defaultConfig, localConfig);
}

0 comments on commit 2b3fc15

Please sign in to comment.