Skip to content

Commit 0e5b402

Browse files
refactor(): update to the latest version of prettier
1 parent 3dae617 commit 0e5b402

32 files changed

+70
-150
lines changed

.prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"singleQuote": true,
3+
"arrowParens": "avoid",
34
"trailingComma": "all"
45
}

integration/hello-world/e2e/exceptions.spec.ts

+10-16
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,19 @@ describe('Error messages', () => {
1818
});
1919

2020
it(`/GET`, () => {
21-
return request(server)
22-
.get('/sync')
23-
.expect(HttpStatus.BAD_REQUEST)
24-
.expect({
25-
statusCode: 400,
26-
error: 'Bad Request',
27-
message: 'Integration test',
28-
});
21+
return request(server).get('/sync').expect(HttpStatus.BAD_REQUEST).expect({
22+
statusCode: 400,
23+
error: 'Bad Request',
24+
message: 'Integration test',
25+
});
2926
});
3027

3128
it(`/GET (Promise/async)`, () => {
32-
return request(server)
33-
.get('/async')
34-
.expect(HttpStatus.BAD_REQUEST)
35-
.expect({
36-
statusCode: 400,
37-
error: 'Bad Request',
38-
message: 'Integration test',
39-
});
29+
return request(server).get('/async').expect(HttpStatus.BAD_REQUEST).expect({
30+
statusCode: 400,
31+
error: 'Bad Request',
32+
message: 'Integration test',
33+
});
4034
});
4135

4236
afterEach(async () => {

integration/hello-world/e2e/exclude-middleware-fastify.spec.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,11 @@ describe('Exclude middleware (fastify)', () => {
7878
).createNestApplication<NestFastifyApplication>(new FastifyAdapter());
7979

8080
await app.init();
81-
await app
82-
.getHttpAdapter()
83-
.getInstance()
84-
.ready();
81+
await app.getHttpAdapter().getInstance().ready();
8582
});
8683

8784
it(`should exclude "/test" endpoint`, () => {
88-
return request(app.getHttpServer())
89-
.get('/test')
90-
.expect(200, RETURN_VALUE);
85+
return request(app.getHttpServer()).get('/test').expect(200, RETURN_VALUE);
9186
});
9287

9388
it(`should not exclude "/test2" endpoint`, () => {

integration/hello-world/e2e/exclude-middleware.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ describe('Exclude middleware', () => {
7777
});
7878

7979
it(`should exclude "/test" endpoint`, () => {
80-
return request(app.getHttpServer())
81-
.get('/test')
82-
.expect(200, RETURN_VALUE);
80+
return request(app.getHttpServer()).get('/test').expect(200, RETURN_VALUE);
8381
});
8482

8583
it(`should not exclude "/test2" endpoint`, () => {

integration/hello-world/e2e/express-instance.spec.ts

+6-12
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ describe('Hello world (express instance)', () => {
2020
});
2121

2222
it(`/GET`, () => {
23-
return request(server)
24-
.get('/hello')
25-
.expect(200)
26-
.expect('Hello world!');
23+
return request(server).get('/hello').expect(200).expect('Hello world!');
2724
});
2825

2926
it(`/GET (Promise/async)`, () => {
@@ -41,14 +38,11 @@ describe('Hello world (express instance)', () => {
4138
});
4239

4340
it(`/GET { host: ":tenant.example.com" } not matched`, () => {
44-
return request(server)
45-
.get('/host')
46-
.expect(404)
47-
.expect({
48-
statusCode: 404,
49-
error: 'Not Found',
50-
message: 'Cannot GET /host',
51-
});
41+
return request(server).get('/host').expect(404).expect({
42+
statusCode: 404,
43+
error: 'Not Found',
44+
message: 'Cannot GET /host',
45+
});
5246
});
5347

5448
afterEach(async () => {

integration/hello-world/e2e/express-multiple.spec.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ describe('Hello world (express instance with multiple applications)', () => {
2929
});
3030

3131
it(`/GET`, () => {
32-
return request(server)
33-
.get('/hello')
34-
.expect(200)
35-
.expect('Hello world!');
32+
return request(server).get('/hello').expect(200).expect('Hello world!');
3633
});
3734

3835
it(`/GET (app2)`, () => {

integration/hello-world/e2e/guards.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ describe('Guards', () => {
3737
app = (await createTestModule(new AuthGuard())).createNestApplication();
3838

3939
await app.init();
40-
return request(app.getHttpServer())
41-
.get('/hello')
42-
.expect(401);
40+
return request(app.getHttpServer()).get('/hello').expect(401);
4341
});
4442
});

integration/hello-world/e2e/interceptors.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ describe('Interceptors', () => {
7777
).createNestApplication();
7878

7979
await app.init();
80-
return request(app.getHttpServer())
81-
.get('/hello')
82-
.expect(200, RETURN_VALUE);
80+
return request(app.getHttpServer()).get('/hello').expect(200, RETURN_VALUE);
8381
});
8482

8583
it(`should map response`, async () => {

integration/hello-world/e2e/local-pipes.spec.ts

+8-14
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@ describe('Hello world (default adapter)', () => {
1818
});
1919

2020
it(`host=example.com should execute locally injected pipe by HelloController`, () => {
21-
return request(server)
22-
.get('/hello/local-pipe/1')
23-
.expect(200)
24-
.expect({
25-
id: '1',
26-
});
21+
return request(server).get('/hello/local-pipe/1').expect(200).expect({
22+
id: '1',
23+
});
2724
});
2825

2926
it(`host=host.example.com should execute locally injected pipe by HostController`, () => {
@@ -39,14 +36,11 @@ describe('Hello world (default adapter)', () => {
3936
});
4037

4138
it(`should return 404 for mismatched host`, () => {
42-
return request(server)
43-
.get('/host/local-pipe/1')
44-
.expect(404)
45-
.expect({
46-
error: 'Not Found',
47-
message: 'Cannot GET /host/local-pipe/1',
48-
statusCode: 404,
49-
});
39+
return request(server).get('/host/local-pipe/1').expect(404).expect({
40+
error: 'Not Found',
41+
message: 'Cannot GET /host/local-pipe/1',
42+
statusCode: 404,
43+
});
5044
});
5145

5246
afterEach(async () => {

integration/hello-world/e2e/middleware-class.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ describe('Middleware (class)', () => {
5151
});
5252

5353
it(`forRoutes(*)`, () => {
54-
return request(app.getHttpServer())
55-
.get('/hello')
56-
.expect(200, RETURN_VALUE);
54+
return request(app.getHttpServer()).get('/hello').expect(200, RETURN_VALUE);
5755
});
5856

5957
afterEach(async () => {

integration/hello-world/e2e/middleware.spec.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,11 @@ describe('Middleware', () => {
5757
});
5858

5959
it(`forRoutes(*)`, () => {
60-
return request(app.getHttpServer())
61-
.get('/hello')
62-
.expect(200, RETURN_VALUE);
60+
return request(app.getHttpServer()).get('/hello').expect(200, RETURN_VALUE);
6361
});
6462

6563
it(`forRoutes(TestController)`, () => {
66-
return request(app.getHttpServer())
67-
.get('/test')
68-
.expect(200, SCOPED_VALUE);
64+
return request(app.getHttpServer()).get('/test').expect(200, SCOPED_VALUE);
6965
});
7066

7167
it(`forRoutes(tests/*)`, () => {

integration/microservices/e2e/broadcast-mqtt.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ describe('MQTT transport', () => {
3333
});
3434

3535
it(`Broadcast (2 subscribers)`, () => {
36-
return request(server)
37-
.get('/broadcast')
38-
.expect(200, '2');
36+
return request(server).get('/broadcast').expect(200, '2');
3937
});
4038

4139
afterEach(async () => {

integration/microservices/e2e/broadcast-nats.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ describe('NATS transport', () => {
3333
});
3434

3535
it(`Broadcast (2 subscribers)`, () => {
36-
return request(server)
37-
.get('/broadcast')
38-
.expect(200, '2');
36+
return request(server).get('/broadcast').expect(200, '2');
3937
});
4038

4139
afterEach(async () => {

integration/microservices/e2e/broadcast-redis.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ describe('REDIS transport', () => {
3333
});
3434

3535
it(`Broadcast (2 subscribers)`, () => {
36-
return request(server)
37-
.get('/broadcast')
38-
.expect(200, '2');
36+
return request(server).get('/broadcast').expect(200, '2');
3937
});
4038

4139
afterEach(async () => {

integration/microservices/e2e/orders-grpc.spec.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ describe('Advanced GRPC transport', () => {
129129
callHandler.on('error', (err: any) => {
130130
// We want to fail only on real errors while Cancellation error
131131
// is expected
132-
if (
133-
String(err)
134-
.toLowerCase()
135-
.indexOf('cancelled') === -1
136-
) {
132+
if (String(err).toLowerCase().indexOf('cancelled') === -1) {
137133
fail('gRPC Stream error happened, error: ' + err);
138134
}
139135
});
@@ -165,11 +161,7 @@ describe('Advanced GRPC transport', () => {
165161
callHandler.on('error', (err: any) => {
166162
// We want to fail only on real errors while Cancellation error
167163
// is expected
168-
if (
169-
String(err)
170-
.toLowerCase()
171-
.indexOf('cancelled') === -1
172-
) {
164+
if (String(err).toLowerCase().indexOf('cancelled') === -1) {
173165
fail('gRPC Stream error happened, error: ' + err);
174166
}
175167
});

integration/microservices/e2e/sum-grpc.spec.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ describe('GRPC transport', () => {
6363
callHandler.on('error', (err: any) => {
6464
// We want to fail only on real errors while Cancellation error
6565
// is expected
66-
if (
67-
String(err)
68-
.toLowerCase()
69-
.indexOf('cancelled') === -1
70-
) {
66+
if (String(err).toLowerCase().indexOf('cancelled') === -1) {
7167
fail('gRPC Stream error happened, error: ' + err);
7268
}
7369
});
@@ -89,11 +85,7 @@ describe('GRPC transport', () => {
8985
callHandler.on('error', (err: any) => {
9086
// We want to fail only on real errors while Cancellation error
9187
// is expected
92-
if (
93-
String(err)
94-
.toLowerCase()
95-
.indexOf('cancelled') === -1
96-
) {
88+
if (String(err).toLowerCase().indexOf('cancelled') === -1) {
9789
fail('gRPC Stream error happened, error: ' + err);
9890
}
9991
});

integration/microservices/e2e/sum-kafka.spec.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -106,30 +106,19 @@ describe('Kafka transport', () => {
106106
user: newUser,
107107
};
108108
it(`/POST (sync command create user)`, () => {
109-
return request(server)
110-
.post('/user')
111-
.send(userDto)
112-
.expect(200);
109+
return request(server).post('/user').send(userDto).expect(200);
113110
});
114111

115112
it(`/POST (sync command create business`, () => {
116-
return request(server)
117-
.post('/business')
118-
.send(businessDto)
119-
.expect(200);
113+
return request(server).post('/business').send(businessDto).expect(200);
120114
});
121115

122116
it(`/POST (sync command create user) Concurrency Test`, async () => {
123117
const promises = [];
124118
for (let concurrencyKey = 0; concurrencyKey < 100; concurrencyKey++) {
125119
const innerUserDto = JSON.parse(JSON.stringify(userDto));
126120
innerUserDto.name += `+${concurrencyKey}`;
127-
promises.push(
128-
request(server)
129-
.post('/user')
130-
.send(userDto)
131-
.expect(200),
132-
);
121+
promises.push(request(server).post('/user').send(userDto).expect(200));
133122
}
134123
await Promise.all(promises);
135124
});

integration/microservices/e2e/sum-mqtt.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('MQTT transport', () => {
4949
.expect(200, '15');
5050
});
5151

52-
it(`/POST (concurrent)`, function() {
52+
it(`/POST (concurrent)`, function () {
5353
return request(server)
5454
.post('/concurrent')
5555
.send([

integration/microservices/e2e/sum-nats.spec.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,10 @@ describe('NATS transport', () => {
7575
});
7676

7777
it(`/GET (exception)`, () => {
78-
return request(server)
79-
.get('/exception')
80-
.expect(200, {
81-
message: 'test',
82-
status: 'error',
83-
});
78+
return request(server).get('/exception').expect(200, {
79+
message: 'test',
80+
status: 'error',
81+
});
8482
});
8583

8684
it(`/POST (event notification)`, done => {

integration/microservices/e2e/sum-redis.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('REDIS transport', () => {
4949
.expect(200, '15');
5050
});
5151

52-
it(`/POST (concurrent)`, function() {
52+
it(`/POST (concurrent)`, function () {
5353
this.retries(10);
5454

5555
return request(server)

integration/microservices/e2e/sum-rpc.spec.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ describe('RPC transport', () => {
7676
});
7777

7878
it(`/POST (pattern not found)`, () => {
79-
return request(server)
80-
.post('/?command=test')
81-
.expect(500);
79+
return request(server).post('/?command=test').expect(500);
8280
});
8381

8482
it(`/POST (event notification)`, done => {

integration/websockets/e2e/ws-gateway.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('WebSocketGateway (WsAdapter)', () => {
6565
);
6666
});
6767

68-
it(`should support 2 different gateways`, async function() {
68+
it(`should support 2 different gateways`, async function () {
6969
this.retries(10);
7070

7171
app = await createNestApp(ApplicationGateway, CoreGateway);

packages/core/errors/exceptions/unknown-element.exception.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { RuntimeException } from './runtime.exception';
33
export class UnknownElementException extends RuntimeException {
44
constructor(name?: string) {
55
super(
6-
`Nest could not find ${name ||
7-
'given'} element (this provider does not exist in the current context)`,
6+
`Nest could not find ${
7+
name || 'given'
8+
} element (this provider does not exist in the current context)`,
89
);
910
}
1011
}

packages/core/errors/messages.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ export const INVALID_CLASS_SCOPE_MESSAGE = (
109109
text: TemplateStringsArray,
110110
name: string | undefined,
111111
) =>
112-
`${name ||
113-
'This class'} is marked as a scoped provider. Request and transient-scoped providers can't be used in combination with "get()" method. Please, use "resolve()" instead.`;
112+
`${
113+
name || 'This class'
114+
} is marked as a scoped provider. Request and transient-scoped providers can't be used in combination with "get()" method. Please, use "resolve()" instead.`;
114115

115116
export const INVALID_MIDDLEWARE_CONFIGURATION = `An invalid middleware configuration has been passed inside the module 'configure()' method.`;
116117
export const UNKNOWN_REQUEST_MAPPING = `An invalid controller has been detected. Perhaps, one of your controllers is missing @Controller() decorator.`;

0 commit comments

Comments
 (0)