Skip to content

Commit 65d64a6

Browse files
authored
ref(eslint): Set jest/expect-expect from warn to error (#924)
1 parent 1a67fab commit 65d64a6

File tree

6 files changed

+49
-19
lines changed

6 files changed

+49
-19
lines changed

.eslintrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ module.exports = {
4343
env: {
4444
'jest/globals': true,
4545
},
46+
rules: {
47+
'jest/expect-expect': [
48+
'error',
49+
{
50+
assertFunctionNames: [
51+
'expect',
52+
'checkPackageJson',
53+
'checkFileContents',
54+
'checkSentryProperties',
55+
'checkIfFlutterBuilds',
56+
'checkEnvBuildPlugin',
57+
'checkFileExists',
58+
'checkIfRunsOnDevMode',
59+
'checkIfRunsOnProdMode',
60+
'checkIfBuilds',
61+
],
62+
additionalTestBlockFunctions: [],
63+
},
64+
],
65+
},
4666
},
4767
],
4868
settings: {

e2e-tests/tests/flutter.test.ts

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from 'node:fs';
22
import * as path from 'node:path';
3-
/* eslint-disable jest/expect-expect */
43
import { Integration } from '../../lib/Constants';
54
import {
65
KEYS,
@@ -32,7 +31,8 @@ describe('Flutter', () => {
3231
'to track the performance of your application?',
3332
);
3433

35-
const profilingOptionPrompted = tracingOptionPrompted &&
34+
const profilingOptionPrompted =
35+
tracingOptionPrompted &&
3636
(await wizardInstance.sendStdinAndWaitForOutput(
3737
[KEYS.ENTER],
3838
// "Do you want to enable Profiling", sometimes doesn't work as `Profiling` can be printed in bold.
@@ -68,13 +68,25 @@ describe('Flutter', () => {
6868
});
6969

7070
test('lib/main.dart calls sentry init', () => {
71-
checkFileContents(`${projectDir}/lib/main.dart`, `import 'package:sentry_flutter/sentry_flutter.dart';`);
72-
checkFileContents(`${projectDir}/lib/main.dart`, `await SentryFlutter.init(`);
71+
checkFileContents(
72+
`${projectDir}/lib/main.dart`,
73+
`import 'package:sentry_flutter/sentry_flutter.dart';`,
74+
);
75+
checkFileContents(
76+
`${projectDir}/lib/main.dart`,
77+
`await SentryFlutter.init(`,
78+
);
7379
});
7480

7581
test('lib/main.dart enables tracing and profiling', () => {
76-
checkFileContents(`${projectDir}/lib/main.dart`, `options.tracesSampleRate = 1.0;`);
77-
checkFileContents(`${projectDir}/lib/main.dart`, `options.profilesSampleRate = 1.0;`);
82+
checkFileContents(
83+
`${projectDir}/lib/main.dart`,
84+
`options.tracesSampleRate = 1.0;`,
85+
);
86+
checkFileContents(
87+
`${projectDir}/lib/main.dart`,
88+
`options.profilesSampleRate = 1.0;`,
89+
);
7890
});
7991

8092
test('builds correctly', async () => {
@@ -84,7 +96,6 @@ describe('Flutter', () => {
8496

8597
describe('without apple platforms', () => {
8698
beforeAll(async () => {
87-
8899
const wizardInstance = startWizardInstance(integration, projectDir);
89100

90101
if (fs.existsSync(`${projectDir}/ios`)) {
@@ -94,15 +105,15 @@ describe('Flutter', () => {
94105
fs.renameSync(`${projectDir}/macos`, `${projectDir}/_macos`);
95106
}
96107

97-
const continueOnUncommitedFilesPromted = await wizardInstance.waitForOutput(
98-
'Do you want to continue anyway?'
99-
)
108+
const continueOnUncommitedFilesPromted =
109+
await wizardInstance.waitForOutput('Do you want to continue anyway?');
100110

101-
const tracingOptionPrompted = continueOnUncommitedFilesPromted &&
111+
const tracingOptionPrompted =
112+
continueOnUncommitedFilesPromted &&
102113
(await wizardInstance.sendStdinAndWaitForOutput(
103-
[KEYS.ENTER],
104-
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
105-
'to track the performance of your application?',
114+
[KEYS.ENTER],
115+
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
116+
'to track the performance of your application?',
106117
));
107118

108119
tracingOptionPrompted &&
@@ -120,7 +131,10 @@ describe('Flutter', () => {
120131
});
121132

122133
test('lib/main.dart does not add profiling with missing ios and macos folder', () => {
123-
const fileContent = fs.readFileSync(`${projectDir}/lib/main.dart`, 'utf-8');
134+
const fileContent = fs.readFileSync(
135+
`${projectDir}/lib/main.dart`,
136+
'utf-8',
137+
);
124138
expect(fileContent).not.toContain(`options.profilesSampleRate = 1.0;`);
125139
});
126140
});

e2e-tests/tests/nextjs-14.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jest/expect-expect */
21
import * as path from 'node:path';
32
import { Integration } from '../../lib/Constants';
43
import {

e2e-tests/tests/nextjs-15.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jest/expect-expect */
21
import * as path from 'node:path';
32
import { Integration } from '../../lib/Constants';
43
import {

e2e-tests/tests/remix.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jest/expect-expect */
21
import * as path from 'node:path';
32
import { Integration } from '../../lib/Constants';
43
import {

e2e-tests/tests/sveltekit.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable jest/expect-expect */
21
import * as path from 'node:path';
32
import { Integration } from '../../lib/Constants';
43
import {

0 commit comments

Comments
 (0)