Skip to content

Commit 21abd22

Browse files
committed
Faster
1 parent a2ce2f6 commit 21abd22

File tree

29 files changed

+191
-171
lines changed

29 files changed

+191
-171
lines changed

e2e/grpc-multiple/grpc-multiple.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createTenv, type Serve } from '@e2e/tenv';
22

33
describe('gRPC Multiple', () => {
4-
it('composes', async () => {
4+
it.concurrent('composes', async () => {
55
await using tenv = createTenv(__dirname);
66
await using Pets = await tenv.service('Pets');
77
await using Stores = await tenv.service('Stores');

e2e/hoist-and-prefix-transform/hoist-and-prefix-transform.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
import { createTenv, type Service } from '@e2e/tenv';
22

3-
const { compose, serve, service, fs } = createTenv(__dirname);
3+
const { compose, gateway, service, fs } = createTenv(__dirname);
44

55
let weather: Service;
66

77
beforeAll(async () => {
88
weather = await service('weather');
99
});
1010

11-
it('should compose the appropriate schema', async () => {
12-
const { result } = await compose({
11+
it.concurrent('should compose the appropriate schema', async () => {
12+
const { supergraphSdl: result } = await compose({
1313
services: [weather],
1414
maskServicePorts: true,
1515
});
1616
expect(result).toMatchSnapshot();
1717
});
1818

19-
it('should compose and execute', async () => {
20-
const { output } = await compose({ output: 'graphql', services: [weather] });
19+
it.concurrent('should compose and execute', async () => {
20+
const { supergraphPath } = await compose({ output: 'graphql', services: [weather] });
2121

2222
// hoisted
23-
const supergraph = await fs.read(output);
23+
const supergraph = await fs.read(supergraphPath);
2424
expect(supergraph).toContain('Test_Weather');
2525
expect(supergraph).toContain('chanceOfRain');
2626

27-
const { execute } = await serve({ supergraph: output });
27+
const { execute } = await gateway({ supergraph: supergraphPath });
2828
await expect(
2929
execute({
3030
query: /* GraphQL */ `

e2e/js-config/js-config.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { createTenv } from '@e2e/tenv';
22
import { fetch } from '@whatwg-node/fetch';
33

4-
const { serve, compose, fs } = createTenv(__dirname);
4+
const { gateway, compose, fs } = createTenv(__dirname);
55

6-
it('should compose and serve', async () => {
7-
const { result: composedSchema } = await compose();
6+
it.concurrent('should compose and serve', async () => {
7+
const { supergraphSdl: composedSchema } = await compose();
88
expect(composedSchema).toMatchSnapshot();
99

1010
const supergraphPath = await fs.tempfile('supergraph.graphql');
1111
await fs.write(supergraphPath, composedSchema);
12-
const { hostname, port } = await serve({ supergraph: supergraphPath });
12+
const { hostname, port } = await gateway({ supergraph: supergraphPath });
1313
const res = await fetch(`http://${hostname}:${port}/graphql?query={hello}`);
1414
expect(res.ok).toBeTruthy();
1515
await expect(res.text()).resolves.toMatchInlineSnapshot(`"{"data":{"hello":"world"}}"`);

e2e/json-schema-subscriptions/json-schema-subscriptions.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@ import { createTenv } from '@e2e/tenv';
33
import { fetch } from '@whatwg-node/fetch';
44
import { getAvailablePort } from '../../packages/testing/getAvailablePort';
55

6-
const { compose, serve, service } = createTenv(__dirname);
6+
const { compose, gateway, service } = createTenv(__dirname);
77

8-
it('should compose the appropriate schema', async () => {
8+
it.concurrent('should compose the appropriate schema', async () => {
99
const api = await service('api');
10-
const { result } = await compose({ services: [api], maskServicePorts: true });
10+
const { supergraphSdl: result } = await compose({ services: [api], maskServicePorts: true });
1111
expect(result).toMatchSnapshot();
1212
});
1313

1414
['todoAddedFromSource', 'todoAddedFromExtensions'].forEach(subscriptionField => {
1515
describe(`Listen to ${subscriptionField}`, () => {
16-
it('should query, mutate and subscribe', async () => {
16+
it.concurrent('should query, mutate and subscribe', async () => {
1717
const servePort = await getAvailablePort();
1818
const api = await service('api', { servePort });
19-
const { output } = await compose({ output: 'graphql', services: [api] });
20-
const { hostname, port, execute } = await serve({ supergraph: output, port: servePort });
19+
const { supergraphPath } = await compose({ output: 'graphql', services: [api] });
20+
const { hostname, port, execute } = await gateway({
21+
supergraph: supergraphPath,
22+
port: servePort,
23+
});
2124

2225
await expect(
2326
execute({

e2e/logs-to-stderr-results-to-stdout/logs-to-stderr-results-to-stdout.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createTenv } from '@e2e/tenv';
22

33
const { compose } = createTenv(__dirname);
44

5-
it('should write compose output to stdout and logs to stderr', async () => {
5+
it.concurrent('should write compose output to stdout and logs to stderr', async () => {
66
const { getStd } = await compose();
77
expect(getStd('out')).toContain('type Query @join__type(graph: HELLOWORLD)');
88
expect(getStd('err')).toContain('Done!');

e2e/manual-transport-def/manual-transport-def.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { createTenv } from '@e2e/tenv';
22

3-
const { compose, serve, service } = createTenv(__dirname);
3+
const { compose, gateway, service } = createTenv(__dirname);
44

5-
it('should compose the appropriate schema', async () => {
6-
const { result } = await compose({
5+
it.concurrent('should compose the appropriate schema', async () => {
6+
const { supergraphSdl: result } = await compose({
77
services: [await service('greetings'), await service('helloer')],
88
maskServicePorts: true,
99
});
1010
expect(result).toMatchSnapshot();
1111
});
1212

13-
it('should execute the query', async () => {
14-
const { output } = await compose({
13+
it.concurrent('should execute the query', async () => {
14+
const { supergraphPath } = await compose({
1515
output: 'graphql',
1616
services: [await service('greetings'), await service('helloer')],
1717
});
18-
const { execute } = await serve({ supergraph: output });
18+
const { execute } = await gateway({ supergraph: supergraphPath });
1919
await expect(
2020
execute({
2121
query: /* GraphQL */ `

e2e/mysql-employees/mysql-employees.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createTenv, type Container } from '@e2e/tenv';
22

3-
const { compose, serve, container } = createTenv(__dirname);
3+
const { compose, gateway, container } = createTenv(__dirname);
44

55
let mysql!: Container;
66
beforeAll(async () => {
@@ -20,8 +20,8 @@ beforeAll(async () => {
2020
});
2121
});
2222

23-
it('should compose the appropriate schema', async () => {
24-
const { result } = await compose({
23+
it.concurrent('should compose the appropriate schema', async () => {
24+
const { supergraphSdl: result } = await compose({
2525
services: [mysql],
2626
maskServicePorts: true,
2727
});
@@ -59,7 +59,7 @@ it.concurrent.each([
5959
`,
6060
},
6161
])('should execute $name', async ({ query }) => {
62-
const { output } = await compose({ output: 'graphql', services: [mysql] });
63-
const { execute } = await serve({ supergraph: output });
62+
const { supergraphPath } = await compose({ output: 'graphql', services: [mysql] });
63+
const { execute } = await gateway({ supergraph: supergraphPath });
6464
await expect(execute({ query })).resolves.toMatchSnapshot();
6565
});

e2e/mysql-rfam/mysql-rfam.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { createTenv } from '@e2e/tenv';
22

3-
const { compose, serve } = createTenv(__dirname);
3+
const { compose, gateway } = createTenv(__dirname);
44

5-
it('should compose the appropriate schema', async () => {
6-
const { result } = await compose();
5+
it.concurrent('should compose the appropriate schema', async () => {
6+
const { supergraphSdl: result } = await compose();
77
expect(result).toMatchSnapshot();
88
});
99

@@ -25,7 +25,7 @@ it.concurrent.each([
2525
`,
2626
},
2727
])('should execute $name', async ({ query }) => {
28-
const { output } = await compose({ output: 'graphql' });
29-
const { execute } = await serve({ supergraph: output });
28+
const { supergraphPath } = await compose({ output: 'graphql' });
29+
const { execute } = await gateway({ supergraph: supergraphPath });
3030
await expect(execute({ query })).resolves.toMatchSnapshot();
3131
});

e2e/neo4j-example/neo4j-example.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createTenv, type Container } from '@e2e/tenv';
22

3-
const { compose, container, serve, spawn } = createTenv(__dirname);
3+
const { compose, container, gateway, spawn } = createTenv(__dirname);
44

55
let neo4j: Container;
66
beforeAll(async () => {
@@ -31,8 +31,8 @@ beforeAll(async () => {
3131
await waitForLoad;
3232
});
3333

34-
it('should compose the appropriate schema', async () => {
35-
const { result } = await compose({
34+
it.concurrent('should compose the appropriate schema', async () => {
35+
const { supergraphSdl: result } = await compose({
3636
services: [neo4j],
3737
maskServicePorts: true,
3838
});
@@ -56,10 +56,10 @@ it.concurrent.each([
5656
`,
5757
},
5858
])('should execute $name', async ({ query }) => {
59-
const { output } = await compose({
59+
const { supergraphPath } = await compose({
6060
services: [neo4j],
6161
output: 'graphql',
6262
});
63-
const { execute } = await serve({ supergraph: output });
63+
const { execute } = await gateway({ supergraph: supergraphPath });
6464
await expect(execute({ query })).resolves.toMatchSnapshot();
6565
});

e2e/odata-trippin/odata-trippin.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { createTenv } from '@e2e/tenv';
22

3-
const { compose, serve } = createTenv(__dirname);
3+
const { compose, gateway } = createTenv(__dirname);
44

5-
it('should compose the appropriate schema', async () => {
6-
const { result } = await compose();
5+
it.concurrent('should compose the appropriate schema', async () => {
6+
const { supergraphSdl: result } = await compose();
77
expect(result).toMatchSnapshot();
88
});
99

10-
it('executes a query', async () => {
11-
const { output } = await compose({
10+
it.concurrent('executes a query', async () => {
11+
const { supergraphPath } = await compose({
1212
output: 'graphql',
1313
});
14-
const { execute } = await serve({ supergraph: output });
14+
const { execute } = await gateway({ supergraph: supergraphPath });
1515
const result = await execute({
1616
query: /* GraphQL */ `
1717
query GetMe {

0 commit comments

Comments
 (0)