Skip to content

TypeError: Cannot read property 'now' of undefined #300

@seyaobey

Description

@seyaobey

I am trying to introduce react-testing-library in an existent project which has used jasmine/enzyme until now. I am getting a runtime error when I run my tests. It looks like react-testing-library is clashing with other libraries in my project (maybe the existing enzyme). Here are the specs:

  • react-testing-library version: 5.8.0
  • react version: 16.4.1
  • node version: 10.13.0
  • npm (or yarn) version: npm = 6.4.1, yarn = 1.6.0

Relevant code or config:

I cannot reproduce the full code here. Here is the relevant part.

import * as React from 'react';
import { Hierarchy } from './Hierarchy';
import { cleanup, render } from 'react-testing-library';

afterEach(cleanup);

const data = {...}

describe('Hierarchy', () => {
  it('should initially render root nodes', () => {
    const { getAllByTestId } = render(
      <Hierarchy data={data} />
    );
    expect(getAllByTestId('hierarchy-node').length).toBe(1);
  });
});

What happened:

I am getting a runtime error when I run tests ( npm run test )

screenshot_1

Reproduction:

It is not possible to create a minimum repository to reproduce this issue

This is the first time I am using this library. I might have missed some point.

Thanks for your support

Metadata

Metadata

Assignees

No one assigned

    Labels

    jsdomIssue with JSDOM environment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions