---
source: crates/oxc_linter/src/tester.rs
expression: valid_expect
---
  ⚠ eslint-plugin-jest(valid-expect): "Expect takes at most 1 argument "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect().toBe(2);
   · ────────
   ╰────
  help: "Remove the extra arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect takes at most 1 argument "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect().toBe(true);
   · ────────
   ╰────
  help: "Remove the extra arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect takes at most 1 argument "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect().toEqual('something');
   · ────────
   ╰────
  help: "Remove the extra arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect requires at least 1 argument "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect('something', 'else').toEqual('something');
   · ───────────────────────────
   ╰────
  help: "Add the missing arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect requires at least 2 arguments "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect('something', 'else', 'entirely').toEqual('something');
   · ───────────────────────────────────────
   ╰────
  help: "Add the missing arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect requires at least 2 arguments "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect('something', 'else', 'entirely').toEqual('something');
   · ───────────────────────────────────────
   ╰────
  help: "Add the missing arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect requires at least 2 arguments "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect('something', 'else', 'entirely').toEqual('something');
   · ───────────────────────────────────────
   ╰────
  help: "Add the missing arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect takes at most 2 arguments "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect('something').toEqual('something');
   · ───────────────────
   ╰────
  help: "Remove the extra arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect takes at most 3 arguments "
   ╭─[valid_expect.tsx:1:1]
 1 │ expect('something', 'else').toEqual('something');
   · ───────────────────────────
   ╰────
  help: "Remove the extra arguments."

  ⚠ eslint-plugin-jest(valid-expect): "Expect must have a corresponding matcher call."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect('something');
   · ───────────────────
   ╰────
  help: "Did you forget add a matcher(e.g. `toBe`, `toBeDefined`)"

  ⚠ eslint-plugin-jest(valid-expect): "Expect must have a corresponding matcher call."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect();
   · ────────
   ╰────
  help: "Did you forget add a matcher(e.g. `toBe`, `toBeDefined`)"

  ⚠ eslint-plugin-jest(valid-expect): "Matchers must be called to assert."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).toBeDefined;
   · ────────────────────────
   ╰────
  help: "You need call your matcher, e.g. `expect(true).toBe(true)`."

  ⚠ eslint-plugin-jest(valid-expect): "Matchers must be called to assert."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).not.toBeDefined;
   · ────────────────────────────
   ╰────
  help: "You need call your matcher, e.g. `expect(true).toBe(true)`."

  ⚠ eslint-plugin-jest(valid-expect): "Matchers must be called to assert."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).nope.toBeDefined;
   · ─────────────────────────────
   ╰────
  help: "You need call your matcher, e.g. `expect(true).toBe(true)`."

  ⚠ eslint-plugin-jest(valid-expect): "Expect has an unknown modifier."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).nope.toBeDefined();
   · ───────────────────────────────
   ╰────
  help: "Is it a spelling mistake?"

  ⚠ eslint-plugin-jest(valid-expect): "Expect has an unknown modifier."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).not.resolves.toBeDefined();
   · ───────────────────────────────────────
   ╰────
  help: "Is it a spelling mistake?"

  ⚠ eslint-plugin-jest(valid-expect): "Expect has an unknown modifier."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).not.not.toBeDefined();
   · ──────────────────────────────────
   ╰────
  help: "Is it a spelling mistake?"

  ⚠ eslint-plugin-jest(valid-expect): "Expect has an unknown modifier."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).resolves.not.exactly.toBeDefined();
   · ───────────────────────────────────────────────
   ╰────
  help: "Is it a spelling mistake?"

  ⚠ eslint-plugin-jest(valid-expect): "Matchers must be called to assert."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).resolves;
   · ─────────────────────
   ╰────
  help: "You need call your matcher, e.g. `expect(true).toBe(true)`."

  ⚠ eslint-plugin-jest(valid-expect): "Matchers must be called to assert."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).rejects;
   · ────────────────────
   ╰────
  help: "You need call your matcher, e.g. `expect(true).toBe(true)`."

  ⚠ eslint-plugin-jest(valid-expect): "Matchers must be called to assert."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(true).not;
   · ────────────────
   ╰────
  help: "You need call your matcher, e.g. `expect(true).toBe(true)`."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(Promise.resolve(2)).resolves.toBeDefined();
   · ─────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(Promise.resolve(2)).rejects.toBeDefined();
   · ────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(Promise.resolve(2)).resolves.toBeDefined();
   · ─────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:6:27]
 5 │                         ? expect(obj).toBe(true)
 6 │                         : expect(obj).resolves.not.toThrow();
   ·                           ──────────────────────────────────
 7 │                     }
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:5:27]
 4 │                         this.isNot
 5 │                         ? expect(obj).resolves.not.toThrow()
   ·                           ──────────────────────────────────
 6 │                         : expect(obj).toBe(true);
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:7:27]
 6 │                         : anotherCondition
 7 │                         ? expect(obj).resolves.not.toThrow()
   ·                           ──────────────────────────────────
 8 │                         : expect(obj).toBe(false)
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).resolves.toBeDefined(); });
   ·                              ─────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).toResolve(); });
   ·                              ──────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).toResolve(); });
   ·                              ──────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).toReject(); });
   ·                              ─────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).not.toReject(); });
   ·                              ─────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).resolves.not.toBeDefined(); });
   ·                              ─────────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).rejects.toBeDefined(); });
   ·                              ────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.resolve(2)).rejects.not.toBeDefined(); });
   ·                              ────────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:36]
 1 │ test('valid-expect', async () => { expect(Promise.resolve(2)).resolves.toBeDefined(); });
   ·                                    ─────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:36]
 1 │ test('valid-expect', async () => { expect(Promise.resolve(2)).resolves.not.toBeDefined(); });
   ·                                    ─────────────────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.reject(2)).toRejectWith(2); });
   ·                              ─────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:1:30]
 1 │ test('valid-expect', () => { expect(Promise.reject(2)).rejects.toBe(2); });
   ·                              ─────────────────────────────────────────
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:3:17]
 2 │                 test('valid-expect', async () => {
 3 │                 expect(Promise.resolve(2)).resolves.not.toBeDefined();
   ·                 ─────────────────────────────────────────────────────
 4 │                 expect(Promise.resolve(1)).rejects.toBeDefined();
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:17]
 3 │                 expect(Promise.resolve(2)).resolves.not.toBeDefined();
 4 │                 expect(Promise.resolve(1)).rejects.toBeDefined();
   ·                 ────────────────────────────────────────────────
 5 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:21]
 3 │                     await expect(Promise.resolve(2)).resolves.not.toBeDefined();
 4 │                     expect(Promise.resolve(1)).rejects.toBeDefined();
   ·                     ────────────────────────────────────────────────
 5 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:3:21]
 2 │                 test('valid-expect', async () => {
 3 │                     expect(Promise.resolve(2)).resolves.not.toBeDefined();
   ·                     ─────────────────────────────────────────────────────
 4 │                     return expect(Promise.resolve(1)).rejects.toBeDefined();
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:28]
 3 │                     expect(Promise.resolve(2)).resolves.not.toBeDefined();
 4 │                     return expect(Promise.resolve(1)).rejects.toBeDefined();
   ·                            ────────────────────────────────────────────────
 5 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:3:21]
 2 │                 test('valid-expect', async () => {
 3 │                     expect(Promise.resolve(2)).resolves.not.toBeDefined();
   ·                     ─────────────────────────────────────────────────────
 4 │                     return expect(Promise.resolve(1)).rejects.toBeDefined();
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:28]
 3 │                     await expect(Promise.resolve(2)).resolves.not.toBeDefined();
 4 │                     return expect(Promise.resolve(1)).rejects.toBeDefined();
   ·                            ────────────────────────────────────────────────
 5 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:28]
 3 │                     await expect(Promise.resolve(2)).toResolve();
 4 │                     return expect(Promise.resolve(1)).toReject();
   ·                            ─────────────────────────────────────
 5 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Promises which return async assertions must be awaited."
   ╭─[valid_expect.tsx:3:21]
 2 │                 test('valid-expect', () => {
 3 │                     Promise.resolve(expect(Promise.resolve(2)).resolves.not.toBeDefined());
   ·                     ──────────────────────────────────────────────────────────────────────
 4 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Promises which return async assertions must be awaited."
   ╭─[valid_expect.tsx:3:21]
 2 │                 test('valid-expect', () => {
 3 │                     Promise.reject(expect(Promise.resolve(2)).resolves.not.toBeDefined());
   ·                     ─────────────────────────────────────────────────────────────────────
 4 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Promises which return async assertions must be awaited."
   ╭─[valid_expect.tsx:3:21]
 2 │                 test('valid-expect', () => {
 3 │                     Promise.x(expect(Promise.resolve(2)).resolves.not.toBeDefined());
   ·                     ────────────────────────────────────────────────────────────────
 4 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Promises which return async assertions must be awaited."
   ╭─[valid_expect.tsx:3:21]
 2 │                 test('valid-expect', () => {
 3 │                     Promise.resolve(expect(Promise.resolve(2)).resolves.not.toBeDefined());
   ·                     ──────────────────────────────────────────────────────────────────────
 4 │                 });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Promises which return async assertions must be awaited."
   ╭─[valid_expect.tsx:3:17]
 2 │                     test('valid-expect', () => {
 3 │ ╭─▶                 Promise.all([
 4 │ │                       expect(Promise.resolve(2)).resolves.not.toBeDefined(),
 5 │ │                       expect(Promise.resolve(3)).resolves.not.toBeDefined(),
 6 │ ╰─▶                 ]);
 7 │                     });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Promises which return async assertions must be awaited."
   ╭─[valid_expect.tsx:3:17]
 2 │                     test('valid-expect', () => {
 3 │ ╭─▶                 Promise.x([
 4 │ │                       expect(Promise.resolve(2)).resolves.not.toBeDefined(),
 5 │ │                       expect(Promise.resolve(3)).resolves.not.toBeDefined(),
 6 │ ╰─▶                 ]);
 7 │                     });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:21]
 3 │                 const assertions = [
 4 │                     expect(Promise.resolve(2)).resolves.not.toBeDefined(),
   ·                     ─────────────────────────────────────────────────────
 5 │                     expect(Promise.resolve(3)).resolves.not.toBeDefined(),
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:5:21]
 4 │                     expect(Promise.resolve(2)).resolves.not.toBeDefined(),
 5 │                     expect(Promise.resolve(3)).resolves.not.toBeDefined(),
   ·                     ─────────────────────────────────────────────────────
 6 │                 ]
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:21]
 3 │                 const assertions = [
 4 │                     expect(Promise.resolve(2)).toResolve(),
   ·                     ──────────────────────────────────────
 5 │                     expect(Promise.resolve(3)).toReject(),
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:5:21]
 4 │                     expect(Promise.resolve(2)).toResolve(),
 5 │                     expect(Promise.resolve(3)).toReject(),
   ·                     ─────────────────────────────────────
 6 │                 ]
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:21]
 3 │                 const assertions = [
 4 │                     expect(Promise.resolve(2)).not.toResolve(),
   ·                     ──────────────────────────────────────────
 5 │                     expect(Promise.resolve(3)).resolves.toReject(),
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:5:21]
 4 │                     expect(Promise.resolve(2)).not.toResolve(),
 5 │                     expect(Promise.resolve(3)).resolves.toReject(),
   ·                     ──────────────────────────────────────────────
 6 │                 ]
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Matchers must be called to assert."
   ╭─[valid_expect.tsx:1:1]
 1 │ expect(Promise.resolve(2)).resolves.toBe;
   · ────────────────────────────────────────
   ╰────
  help: "You need call your matcher, e.g. `expect(true).toBe(true)`."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:4:25]
 3 │                     return expect(functionReturningAPromise()).resolves.toEqual(1).then(() => {
 4 │                         expect(Promise.resolve(2)).resolves.toBe(1);
   ·                         ───────────────────────────────────────────
 5 │                     });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Async assertions must be awaited."
   ╭─[valid_expect.tsx:5:25]
 4 │                         await expect(Promise.resolve(2)).resolves.toBe(1);
 5 │                         expect(Promise.resolve(4)).resolves.toBe(4);
   ·                         ───────────────────────────────────────────
 6 │                     });
   ╰────
  help: "Add `await` to your assertion."

  ⚠ eslint-plugin-jest(valid-expect): "Expect must have a corresponding matcher call."
   ╭─[valid_expect.tsx:3:27]
 2 │                 test('valid-expect', async () => {
 3 │                     await expect(Promise.resolve(1));
   ·                           ──────────────────────────
 4 │                 });
   ╰────
  help: "Did you forget add a matcher(e.g. `toBe`, `toBeDefined`)"
