Skip to content

Commit 84d7a68

Browse files
authored
feat: support @jest/globals (#1094)
* test: add initial cases * refactor: simplify `isTestCaseCall` & `isDescribeCall` utilities * feat: check that test functions are probably from jest * feat: apply to `isDescribeCall` too * fix: check import refs before unresolved refs * test: add utils cases * fix: begin to support variable imports * test(expect-expect): more tests * test: set correct `ecmaVersion` * chore: clean * chore: clean up code & tests more * feat: support dynamic import properly * fix: make sure that `scopeHasLocalReferences` works properly * test: add extra case for coverage * feat: switch rules over to using scoped jest function checks * fix: remove unneeded condition (apparently?) * fix: adjust code to cover branches * test: only run dynamic import cases when using eslint 8+ * test: ignore coverage on condition that is only tested on eslint v8 * ci: only collect coverage when using eslint versions that support dynamic import * feat: convert `isHook` to `isHookCall` * chore: remove unneeded exporting of util function * refactor(expect-expect): reuse `scope` * refactor: compare against `null` instead of casting to boolean * chore: mark array param as readonly * test: move utils case from specific rule tests into utils tests * refactor: rename variable * test: add some more cases * chore: remove duplicated test case * test: let original error throw if eslint cannot be found * chore: upgrade `@typescript-eslint/types`
1 parent 48e994f commit 84d7a68

29 files changed

+1146
-238
lines changed

.github/workflows/nodejs.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,12 @@ jobs:
8585
yarn
8686
yarn add --dev eslint@${{ matrix.eslint-version }}
8787
- name: run tests
88-
run: yarn test --coverage
88+
# only collect coverage on eslint versions that support dynamic import
89+
run: yarn test --coverage ${{ matrix.eslint-version >= 8 }}
8990
env:
9091
CI: true
9192
- uses: codecov/codecov-action@v3
92-
if: always()
93+
if: ${{ matrix.eslint-version >= 8 }}
9394
test-os:
9495
name: Test on ${{ matrix.os }} using Node.js LTS
9596
needs: prepare-yarn-cache
@@ -108,11 +109,12 @@ jobs:
108109
- name: install
109110
run: yarn
110111
- name: run tests
111-
run: yarn test --coverage
112+
# only collect coverage on eslint versions that support dynamic import
113+
run: yarn test --coverage ${{ matrix.eslint-version >= 8 }}
112114
env:
113115
CI: true
114116
- uses: codecov/codecov-action@v3
115-
if: always()
117+
if: ${{ matrix.eslint-version >= 8 }}
116118

117119
docs:
118120
if: ${{ github.event_name == 'pull_request' }}

0 commit comments

Comments
 (0)