Skip to content

toMatchInlineSnapshot fails if prettier's native module deps are mocked through jest.mockย #6702

@tryggvigy

Description

@tryggvigy

๐Ÿ› Bug Report

toMatchInlineSnapshot fails if path module is mocked

jest.mock('path', () => ({}));

test('foo', () => {
  expect({}).toMatchInlineSnapshot();
});

results in

โ— Test suite failed to run

    TypeError: path.resolve is not a function

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS High Sierra 10.13.5
    CPU: x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
  Binaries:
    Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.9.4/bin/npm
  npmPackages:
    jest: ^23.4.0 => 23.4.0

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

      โšก