mirror of
https://github.com/hanzoai/jest.git
synced 2026-09-24 16:59:57 +00:00
chore: fix lint errors
This commit is contained in:
@@ -99,9 +99,9 @@ jest.mocked(obj.method).mockReturnValue(x); // typed cast for already-mocked
|
||||
Never:
|
||||
|
||||
```ts
|
||||
jest.fn().mockReturnValue(x) // widens to UnknownFunction
|
||||
(x as jest.Mock).mockReturnValue(y) // cast soup
|
||||
{foo: jest.fn()} as unknown as Real // construct typed instead
|
||||
jest.fn().mockReturnValue(x); // widens to UnknownFunction
|
||||
(x as jest.Mock).mockReturnValue(y); // cast soup
|
||||
({foo: jest.fn()}) as unknown as Real; // construct typed instead
|
||||
```
|
||||
|
||||
`beforeEach(() => jest.clearAllMocks())` fails `typecheck:tests` (return type widens). Use a block body: `beforeEach(() => { jest.clearAllMocks(); })`.
|
||||
|
||||
+8
-1
@@ -817,7 +817,14 @@ const config = defineConfig(
|
||||
'unicorn/prefer-number-properties': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
// Instruction files for AI agents
|
||||
{
|
||||
files: ['**/CLAUDE.md/**', '.github/copilot-instructions.md/**'],
|
||||
rules: {
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: [
|
||||
'!.*',
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import {runInNewContext} from 'node:vm';
|
||||
import {runInNewContext} from 'vm';
|
||||
import jestExpect from '../';
|
||||
import {
|
||||
any,
|
||||
|
||||
@@ -23,11 +23,13 @@ interface Reporter {
|
||||
## Configuring reporters
|
||||
|
||||
```js
|
||||
reporters: [
|
||||
'default', // DefaultReporter
|
||||
['jest-junit', {outputDirectory: './reports'}],
|
||||
['<rootDir>/my-reporter.js', {}],
|
||||
],
|
||||
module.exports = {
|
||||
reporters: [
|
||||
'default', // DefaultReporter
|
||||
['jest-junit', {outputDirectory: './reports'}],
|
||||
['<rootDir>/my-reporter.js', {}],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
Constructor receives `(globalConfig, reporterOptions, reporterContext)`. `SummaryReporter` is always appended by jest-core. Without `'default'` in the list, `DefaultReporter` is not added.
|
||||
|
||||
Reference in New Issue
Block a user