Skip to content

Instantly share code, notes, and snippets.

@mainfraame
Last active November 2, 2020 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mainfraame/c67180cfb70d5ef97c7dbe8f1c15b2d0 to your computer and use it in GitHub Desktop.
Save mainfraame/c67180cfb70d5ef97c7dbe8f1c15b2d0 to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
import { act } from 'react-dom/test-utils'
import { AfterAll, BeforeAll } from 'cucumber';
import App from './path/to/your/app';
const $root = document.createElement('div');
document.body.appendChild($root);
BeforeAll(function () {
act(() => {
ReactDOM.render(
<App/>,
$root
)
});
});
AfterAll(function () {
act(() => {
ReactDOM.unmountComponentAtNode(
$root
)
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment