Skip to content

Commit 3e83a6a

Browse files
authored
chore: add lint rule to prevent .only usage (#3085)
1 parent 0caf1c5 commit 3e83a6a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

.eslintrc.json

+15
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@
2323
"es6": true
2424
},
2525
"rules": {
26+
"no-restricted-properties": [
27+
"error",
28+
{
29+
"object": "describe",
30+
"property": "only"
31+
},
32+
{
33+
"object": "it",
34+
"property": "only"
35+
},
36+
{
37+
"object": "context",
38+
"property": "only"
39+
}
40+
],
2641
"prettier/prettier": "error",
2742
"tsdoc/syntax": "warn",
2843
"no-console": "error",

test/functional/change_stream_spec.test.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ describe('Change Stream Spec - v1', function () {
8383

8484
suite.tests.forEach(test => {
8585
const shouldSkip = test.skip || TESTS_TO_SKIP.has(test.description);
86-
const itFn = shouldSkip ? it.skip : test.only ? it.only : it;
86+
// There's no evidence of test.only being defined in the spec files
87+
// But let's avoid removing it now to just be sure we aren't changing anything
88+
// These tests will eventually be replaced by unified format versions.
89+
const itFn = shouldSkip ? it.skip : test.only ? Reflect.get(it, 'only') : it;
8790
const metadata = generateMetadata(test);
8891
const testFn = generateTestFn(test);
8992

0 commit comments

Comments
 (0)