Skip to content

Commit f0d55b5

Browse files
committed
Make floating promises error
This already reveals some errors, lmao.
1 parent 41096b6 commit f0d55b5

File tree

4 files changed

+45
-37
lines changed

4 files changed

+45
-37
lines changed

Diff for: lib/diagnostics/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -381,5 +381,7 @@ export async function execute(options: {
381381
}
382382

383383
if (require.main === module) {
384-
execute({ argv: process.argv, env: process.env, cwd: process.cwd() });
384+
execute({ argv: process.argv, env: process.env, cwd: process.cwd() }).catch(
385+
console.error
386+
);
385387
}

Diff for: lib/preprocessor-configuration.test.ts

+25-35
Original file line numberDiff line numberDiff line change
@@ -52,41 +52,37 @@ function basicBooleanExample(options: {
5252
}) {
5353
const { environmentKey, setValueFn, getValueFn } = options;
5454

55-
it("default", async () => {
55+
it("default", () =>
5656
test({
5757
getValueFn,
5858
environment: {},
5959
configuration: {},
6060
expectedValue: options.default,
61-
});
62-
});
61+
}));
6362

64-
it("override by explicit configuration (boolean)", () => {
63+
it("override by explicit configuration (boolean)", () =>
6564
test({
6665
getValueFn,
6766
environment: {},
6867
configuration: createUserConfiguration({ setValueFn, value: true }),
6968
expectedValue: true,
70-
});
71-
});
69+
}));
7270

73-
it("override by environment (boolean)", () => {
71+
it("override by environment (boolean)", () =>
7472
test({
7573
getValueFn,
7674
environment: { [environmentKey]: true },
7775
configuration: {},
7876
expectedValue: true,
79-
});
80-
});
77+
}));
8178

82-
it("precedence", () => {
79+
it("precedence", () =>
8380
test({
8481
getValueFn,
8582
environment: { [environmentKey]: true },
8683
configuration: createUserConfiguration({ setValueFn, value: false }),
8784
expectedValue: true,
88-
});
89-
});
85+
}));
9086

9187
describe("environment string interpretation", () => {
9288
const matrix = [
@@ -97,7 +93,7 @@ function basicBooleanExample(options: {
9793
];
9894

9995
for (const { environmentValue, expectedValue } of matrix) {
100-
it(JSON.stringify(environmentValue), () => {
96+
it(JSON.stringify(environmentValue), () =>
10197
test({
10298
getValueFn,
10399
environment: { [environmentKey]: environmentValue },
@@ -106,12 +102,12 @@ function basicBooleanExample(options: {
106102
value: !expectedValue,
107103
}),
108104
expectedValue: expectedValue,
109-
});
110-
});
105+
})
106+
);
111107
}
112108

113109
// defers to next value
114-
it('"" and explicit value', () => {
110+
it('"" and explicit value', () =>
115111
test({
116112
getValueFn,
117113
environment: { [environmentKey]: "" },
@@ -120,17 +116,15 @@ function basicBooleanExample(options: {
120116
value: true,
121117
}),
122118
expectedValue: true,
123-
});
124-
});
119+
}));
125120

126-
it('"" and no explicit values', () => {
121+
it('"" and no explicit values', () =>
127122
test({
128123
getValueFn,
129124
environment: { [environmentKey]: "" },
130125
configuration: {},
131126
expectedValue: false,
132-
});
133-
});
127+
}));
134128
});
135129
}
136130

@@ -142,41 +136,37 @@ function basicStringExample(options: {
142136
}) {
143137
const { environmentKey, setValueFn, getValueFn } = options;
144138

145-
it("default", async () => {
139+
it("default", () =>
146140
test({
147141
getValueFn,
148142
environment: {},
149143
configuration: {},
150144
expectedValue: options.default,
151-
});
152-
});
145+
}));
153146

154-
it("override by explicit configuration", () => {
147+
it("override by explicit configuration", () =>
155148
test({
156149
getValueFn,
157150
environment: {},
158151
configuration: createUserConfiguration({ setValueFn, value: "foo" }),
159152
expectedValue: "foo",
160-
});
161-
});
153+
}));
162154

163-
it("override by environment", () => {
155+
it("override by environment", () =>
164156
test({
165157
getValueFn,
166158
environment: { [environmentKey]: "foo" },
167159
configuration: {},
168160
expectedValue: "foo",
169-
});
170-
});
161+
}));
171162

172-
it("precedence", () => {
163+
it("precedence", () =>
173164
test({
174165
getValueFn,
175166
environment: { [environmentKey]: "bar" },
176167
configuration: createUserConfiguration({ setValueFn, value: "foo" }),
177168
expectedValue: "bar",
178-
});
179-
});
169+
}));
180170
}
181171

182172
describe("resolve()", () => {
@@ -350,10 +340,10 @@ describe("resolve()", () => {
350340

351341
describe("output", () => {
352342
const getValueFn = (configuration: IPreprocessorConfiguration): string =>
353-
configuration.json.output;
343+
configuration.html.output;
354344

355345
const setValueFn = (configuration: IUserConfiguration, value: string) =>
356-
(configuration.json = { enabled: true, output: value });
346+
(configuration.html = { enabled: true, output: value });
357347

358348
basicStringExample({
359349
default: "cucumber-report.html",

Diff for: package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,15 @@
128128
"caughtErrorsIgnorePattern": "^_"
129129
}
130130
],
131-
"@typescript-eslint/no-explicit-any": 0
131+
"@typescript-eslint/no-explicit-any": 0,
132+
"@typescript-eslint/no-floating-promises": "error"
132133
},
133134
"parser": "@typescript-eslint/parser",
135+
"parserOptions": {
136+
"project": [
137+
"tsconfig.eslint.json"
138+
]
139+
},
134140
"plugins": [
135141
"@typescript-eslint"
136142
],

Diff for: tsconfig.eslint.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": [
4+
"features/**/*.ts",
5+
"lib/**/*.ts",
6+
"test/**/*.ts",
7+
"test-d/**/*.ts",
8+
],
9+
"exclude": []
10+
}

0 commit comments

Comments
 (0)