Skip to content

Commit 4d28cce

Browse files
committed
fix: adapt diagnostics to v17 after rebase
- Fix .js → .ts import extensions across all diagnostics files - Migrate test files from mocha to node:test - Remove redundant executeRootSelectionSet tracing from mapSourceToResponseEvent (already traced inside Executor) - Add test for custom per-event executor tracing
1 parent 674b94d commit 4d28cce

18 files changed

Lines changed: 199 additions & 142 deletions

src/__testUtils__/__tests__/expectEvents-test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { describe, it } from 'node:test';
2+
13
import { expect } from 'chai';
2-
import { describe, it } from 'mocha';
34

4-
import { expectEvents } from '../expectEvents.js';
5-
import { expectPromise } from '../expectPromise.js';
5+
import { expectEvents } from '../expectEvents.ts';
6+
import { expectPromise } from '../expectPromise.ts';
67

78
type TestTracingChannel = Parameters<typeof expectEvents>[0];
89

src/__testUtils__/__tests__/expectNoTracingActivity-test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { describe, it } from 'node:test';
2+
13
import { expect } from 'chai';
2-
import { describe, it } from 'mocha';
34

4-
import { expectNoTracingActivity } from '../expectNoTracingActivity.js';
5-
import { expectPromise } from '../expectPromise.js';
5+
import { expectNoTracingActivity } from '../expectNoTracingActivity.ts';
6+
import { expectPromise } from '../expectPromise.ts';
67

78
type TestTracingChannel = Parameters<typeof expectNoTracingActivity>[0];
89

src/__testUtils__/diagnosticsTracing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { MinimalChannel, MinimalTracingChannel } from '../diagnostics.js';
1+
import type { MinimalChannel, MinimalTracingChannel } from '../diagnostics.ts';
22

33
export type TracingSubChannel = {
44
[Key in keyof MinimalTracingChannel]: MinimalTracingChannel[Key] extends MinimalChannel

src/__testUtils__/expectEvents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { expect } from 'chai';
22

3-
import type { MinimalTracingChannel } from '../diagnostics.js';
3+
import type { MinimalTracingChannel } from '../diagnostics.ts';
44

55
import type {
66
TestTracingChannel,
77
TracingSubChannel,
88
TracingSubChannelRecord,
9-
} from './diagnosticsTracing.js';
10-
import { tracingSubChannels } from './diagnosticsTracing.js';
9+
} from './diagnosticsTracing.ts';
10+
import { tracingSubChannels } from './diagnosticsTracing.ts';
1111

1212
export type CollectedEvent = {
1313
[Channel in TracingSubChannel]: {

src/__testUtils__/expectNoTracingActivity.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { expect } from 'chai';
22

3-
import type { MinimalTracingChannel } from '../diagnostics.js';
3+
import type { MinimalTracingChannel } from '../diagnostics.ts';
44

5-
import { tracingSubChannels } from './diagnosticsTracing.js';
6-
import type { MethodSpy } from './spyOn.js';
7-
import { spyOnMethod } from './spyOn.js';
5+
import { tracingSubChannels } from './diagnosticsTracing.ts';
6+
import type { MethodSpy } from './spyOn.ts';
7+
import { spyOnMethod } from './spyOn.ts';
88

99
/**
1010
* Assert that a graphql tracing channel stays on its zero-subscriber fast path.

src/__testUtils__/getTracingChannel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* eslint-disable n/no-unsupported-features/node-builtins, import/no-nodejs-modules */
1+
/* eslint-disable n/no-unsupported-features/node-builtins */
22
import dc from 'node:diagnostics_channel';
33

4-
import type { GraphQLChannelContextByName } from '../diagnostics.js';
4+
import type { GraphQLChannelContextByName } from '../diagnostics.ts';
55

6-
import type { TestTracingChannel } from './diagnosticsTracing.js';
6+
import type { TestTracingChannel } from './diagnosticsTracing.ts';
77

88
/**
99
* Resolve a graphql tracing channel by name on the real

src/__tests__/diagnostics-test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/* eslint-disable import/no-nodejs-modules, n/no-unsupported-features/node-builtins */
1+
/* eslint-disable n/no-unsupported-features/node-builtins */
22
import dc from 'node:diagnostics_channel';
3+
import { describe, it } from 'node:test';
34

45
import { expect } from 'chai';
5-
import { describe, it } from 'mocha';
66

7-
import { invariant } from '../jsutils/invariant.js';
7+
import { invariant } from '../jsutils/invariant.ts';
88

9-
import type { MinimalTracingChannel } from '../diagnostics.js';
9+
import type { MinimalTracingChannel } from '../diagnostics.ts';
1010
import {
1111
executeChannel,
1212
executeRootSelectionSetChannel,
@@ -15,7 +15,7 @@ import {
1515
shouldTrace,
1616
subscribeChannel,
1717
validateChannel,
18-
} from '../diagnostics.js';
18+
} from '../diagnostics.ts';
1919

2020
describe('diagnostics', () => {
2121
it('auto-registers the graphql tracing channels', () => {

src/diagnostics.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
* load silently no-ops and emission sites short-circuit.
1212
*/
1313

14-
import { isPromise } from './jsutils/isPromise.js';
15-
import type { Maybe } from './jsutils/Maybe.js';
16-
import type { ObjMap } from './jsutils/ObjMap.js';
14+
import { isPromise } from './jsutils/isPromise.ts';
15+
import type { Maybe } from './jsutils/Maybe.ts';
16+
import type { ObjMap } from './jsutils/ObjMap.ts';
1717

18-
import type { GraphQLError } from './error/GraphQLError.js';
18+
import type { GraphQLError } from './error/GraphQLError.ts';
1919

2020
import type {
2121
DocumentNode,
2222
OperationDefinitionNode,
2323
OperationTypeNode,
24-
} from './language/ast.js';
25-
import type { Source } from './language/source.js';
24+
} from './language/ast.ts';
25+
import type { Source } from './language/source.ts';
2626

27-
import type { GraphQLSchema } from './type/schema.js';
27+
import type { GraphQLSchema } from './type/schema.ts';
2828

29-
import type { ExecutionResult } from './execution/Executor.js';
30-
import type { ExperimentalIncrementalExecutionResults } from './execution/incremental/IncrementalExecutor.js';
29+
import type { ExecutionResult } from './execution/Executor.ts';
30+
import type { ExperimentalIncrementalExecutionResults } from './execution/incremental/IncrementalExecutor.ts';
3131

3232
/**
3333
* Structural subset of `DiagnosticsChannel` sufficient for publishing and

src/execution/Executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import type { GraphQLSchema } from '../type/schema.ts';
4949
import type {
5050
GraphQLExecuteRootSelectionSetContext,
5151
GraphQLResolveContext,
52-
} from '../diagnostics.js';
52+
} from '../diagnostics.ts';
5353
import {
5454
executeRootSelectionSetChannel,
5555
resolveChannel,

src/execution/__tests__/diagnostics-execute-test.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1+
import { describe, it } from 'node:test';
2+
13
import { expect } from 'chai';
2-
import { describe, it } from 'mocha';
34

4-
import { expectEvents } from '../../__testUtils__/expectEvents.js';
5-
import { expectNoTracingActivity } from '../../__testUtils__/expectNoTracingActivity.js';
6-
import { expectPromise } from '../../__testUtils__/expectPromise.js';
7-
import { expectToThrow } from '../../__testUtils__/expectToThrow.js';
8-
import { getTracingChannel } from '../../__testUtils__/getTracingChannel.js';
9-
import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick.js';
5+
import { expectEvents } from '../../__testUtils__/expectEvents.ts';
6+
import { expectNoTracingActivity } from '../../__testUtils__/expectNoTracingActivity.ts';
7+
import { expectPromise } from '../../__testUtils__/expectPromise.ts';
8+
import { expectToThrow } from '../../__testUtils__/expectToThrow.ts';
9+
import { getTracingChannel } from '../../__testUtils__/getTracingChannel.ts';
10+
import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick.ts';
1011

11-
import type { OperationDefinitionNode } from '../../language/ast.js';
12-
import { OperationTypeNode } from '../../language/ast.js';
13-
import { parse } from '../../language/parser.js';
12+
import type { OperationDefinitionNode } from '../../language/ast.ts';
13+
import { OperationTypeNode } from '../../language/ast.ts';
14+
import { parse } from '../../language/parser.ts';
1415

15-
import { GraphQLObjectType } from '../../type/definition.js';
16-
import { GraphQLString } from '../../type/scalars.js';
17-
import { GraphQLSchema } from '../../type/schema.js';
16+
import { GraphQLObjectType } from '../../type/definition.ts';
17+
import { GraphQLString } from '../../type/scalars.ts';
18+
import { GraphQLSchema } from '../../type/schema.ts';
1819

19-
import { buildSchema } from '../../utilities/buildASTSchema.js';
20+
import { buildSchema } from '../../utilities/buildASTSchema.ts';
2021

2122
import {
2223
execute,
2324
executeIgnoringIncremental,
2425
executeSync,
25-
} from '../execute.js';
26+
} from '../execute.ts';
2627

2728
const schema = buildSchema(`
2829
type Query {

0 commit comments

Comments
 (0)