Skip to content

Issue when using expect.not #5848

@holgergp

Description

@holgergp

I am experiencing a strange behavior using expect.not, which may be a bug.
not seems not to defined on the expect object anymore.

I pasted a simple example from https://facebook.github.io/jest/docs/en/expect.html#expectnotstringcontainingstring
into a repl.it demo: https://repl.it/@holgergp/testing-not

The output of the test:

Jest v22.1.2 node v7.4.0 linux/amd64
   
 FAIL  ./not-test.js
  not.stringContaining
    ✕ matches if the actual string does not contain the expected substring (7ms)

  ● not.stringContaining › matches if the actual string does not contain the expected substring

    TypeError: Cannot read property 'stringContaining' of undefined

      3 | 
      4 |   it('matches if the actual string does not contain the expected substring', () => {
    > 5 |     expect('How are you?').toEqual(expect.not.stringContaining(expected));
      6 |   });
      7 | });
      
      at Object.it (not-test.js:5:46)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        0.913s
Ran all test suites.
exit status 1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions