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 {

e2e/openapi-additional-resolvers/openapi-additional-resolvers.test.ts

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

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

5-
it('should execute Metrics with banana', async () => {
6-
const { output } = await compose({ output: 'graphql' });
7-
const { execute } = await serve({ supergraph: output });
5+
it.concurrent('should execute Metrics with banana', async () => {
6+
const { supergraphPath } = await compose({ output: 'graphql' });
7+
const { execute } = await gateway({ supergraph: supergraphPath });
88
const result = await execute({
99
query: /* GraphQL */ `
1010
query Metrics {
@@ -36,9 +36,9 @@ it('should execute Metrics with banana', async () => {
3636
).toEqual('🍌');
3737
});
3838

39-
it('should execute Metrics with apple', async () => {
40-
const { output } = await compose({ output: 'graphql' });
41-
const { execute } = await serve({ supergraph: output });
39+
it.concurrent('should execute Metrics with apple', async () => {
40+
const { supergraphPath } = await compose({ output: 'graphql' });
41+
const { execute } = await gateway({ supergraph: supergraphPath });
4242
const result = await execute({
4343
query: /* GraphQL */ `
4444
query Metrics {

e2e/openapi-arg-rename/openapi-arg-rename.test.ts

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

33
describe('OpenAPI Arg Rename', () => {
4-
const { compose, serve, service } = createTenv(__dirname);
5-
it('composes the schema', async () => {
6-
const { result } = await compose({
4+
const { compose, gateway, service } = createTenv(__dirname);
5+
it.concurrent('composes the schema', async () => {
6+
const { supergraphSdl: result } = await compose({
77
output: 'graphql',
88
services: [await service('Wiki')],
99
maskServicePorts: true,
1010
});
1111

1212
expect(result).toMatchSnapshot();
1313
});
14-
it('should work with untouched schema', async () => {
15-
const { output } = await compose({
14+
it.concurrent('should work with untouched schema', async () => {
15+
const { supergraphPath } = await compose({
1616
output: 'graphql',
1717
services: [await service('Wiki')],
1818
});
1919

20-
const { execute } = await serve({ supergraph: output });
20+
const { execute } = await gateway({ supergraph: supergraphPath });
2121
const queryResult = await execute({
2222
query: /* GraphQL */ `
2323
mutation Good {
@@ -37,13 +37,13 @@ describe('OpenAPI Arg Rename', () => {
3737
});
3838
});
3939

40-
it('should work with renamed argument', async () => {
41-
const { output } = await compose({
40+
it.concurrent('should work with renamed argument', async () => {
41+
const { supergraphPath } = await compose({
4242
output: 'graphql',
4343
services: [await service('Wiki')],
4444
});
4545

46-
const { execute } = await serve({ supergraph: output });
46+
const { execute } = await gateway({ supergraph: supergraphPath });
4747
const queryResult = await execute({
4848
query: /* GraphQL */ `
4949
mutation Bad {

e2e/openapi-hateoas/openapi-hateoas.test.ts

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

33
describe('OpenAPI HATEOAS', () => {
4-
const { compose, serve, service } = createTenv(__dirname);
5-
6-
let oasService: Service;
7-
8-
beforeAll(async () => {
9-
oasService = await service('OASService');
10-
});
11-
12-
it('should compose', async () => {
13-
const { result } = await compose({
4+
it.concurrent('should compose', async () => {
5+
await using tenv = createTenv(__dirname);
6+
await using OASService = await tenv.service('OASService');
7+
await using composition = await tenv.compose({
148
output: 'graphql',
15-
services: [oasService],
9+
services: [OASService],
1610
maskServicePorts: true,
1711
});
18-
expect(result).toMatchSnapshot();
12+
expect(composition.supergraphSdl).toMatchSnapshot();
1913
});
2014

21-
it('should execute and follow HATEOAS links', async () => {
22-
const { output } = await compose({
15+
it.concurrent('should execute and follow HATEOAS links', async () => {
16+
await using tenv = createTenv(__dirname);
17+
await using OASService = await tenv.service('OASService');
18+
await using composition = await tenv.compose({
2319
output: 'graphql',
24-
services: [oasService],
20+
services: [OASService],
2521
});
2622

27-
const { execute } = await serve({
28-
supergraph: output,
23+
const gw = await tenv.gateway({
24+
supergraph: composition.supergraphPath,
2925
});
30-
const queryResult = await execute({
26+
const queryResult = await gw.execute({
3127
query: /* GraphQL */ `
3228
query GetProductsById {
3329
getProductById(id: 1) {

e2e/openapi-javascript-wiki/openapi-javascript-wiki.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

@@ -30,7 +30,7 @@ it.concurrent.each([
3030
`,
3131
},
3232
])('should execute $name', async ({ query }) => {
33-
const { output } = await compose({ output: 'graphql' });
34-
const { execute } = await serve({ supergraph: output });
33+
const { supergraphPath } = await compose({ output: 'graphql' });
34+
const { execute } = await gateway({ supergraph: supergraphPath });
3535
await expect(execute({ query })).resolves.toMatchSnapshot();
3636
});

0 commit comments

Comments
 (0)