Skip to content

Commit

Permalink
chore: add lint rule to prevent .only usage (#3085)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Dec 16, 2021
1 parent 0caf1c5 commit 3e83a6a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
"es6": true
},
"rules": {
"no-restricted-properties": [
"error",
{
"object": "describe",
"property": "only"
},
{
"object": "it",
"property": "only"
},
{
"object": "context",
"property": "only"
}
],
"prettier/prettier": "error",
"tsdoc/syntax": "warn",
"no-console": "error",
Expand Down
5 changes: 4 additions & 1 deletion test/functional/change_stream_spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ describe('Change Stream Spec - v1', function () {

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

Expand Down

0 comments on commit 3e83a6a

Please sign in to comment.