Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consecutive test cases fails with Error: Not supported #910

Closed
Tokimon opened this issue Jun 3, 2020 · 3 comments
Closed

Consecutive test cases fails with Error: Not supported #910

Tokimon opened this issue Jun 3, 2020 · 3 comments

Comments

@Tokimon
Copy link

Tokimon commented Jun 3, 2020

Current Behavior

When executing several tests in the same file each consecutive test fails with the following error:

Error: Uncaught [Error: Not supported]

I am suspecting that the use of Suspense might have something to do with it since this line

https://github.com/CookPete/react-player/blob/2a9e09c7405a67ac767c6f8f03b0559e541046e0/src/ReactPlayer.js#L13

Will continue to use Suspence in a JsDom environment.

Expected Behavior

No error to be thrown

Steps to Reproduce

React component

import React from 'react';
import ReactPlayer from 'react-player';

const VideoTest = ({ play }) => {
  return (
    <ReactPlayer
      url='./test-video.mp4'
      playing={!!play}
      className='react-player'
      width='100%'
      height='100%'
      style={{ lineHeight: 0 }}
    />
  );
};

VideoTest.displayName = 'VideoTest';

export default VideoTest;

Test file

import React from 'react';
import { mount } from 'enzyme';

import VideoTest from './VideoTest';

describe('[molecule] VideoPlayerTest', () => {
  it('This test does not fail', () => {
    mount(<VideoTest file='http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' />);
  });

  it('This test fails even if it should not', () => {
    mount(<VideoTest file='http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' />);
  });
});

Environment

  • Test Runner: Jest
  • Browser: JsDom
  • Operating system: Windows
@cookpete
Copy link
Owner

cookpete commented Jun 7, 2020

This looks very similar to #909. I recommend shallow rendering with Enzyme.

Or, if anyone has any ideas on how to fix this, I'm all ears.

@cookpete
Copy link
Owner

cookpete commented Jun 7, 2020

There also loads of info in the various threads about Enzyme and using mount with Suspense.

@Tokimon
Copy link
Author

Tokimon commented Jun 9, 2020

I will try to use shallow, but that means I have to update my already written tests. And I am unsure that I will be able to in all cases.
I will keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants