small medium large xlarge

Back to: All Forums  React for Real
04 Sep 2017, 20:59
Kel Cecil (1 post)

I’m really enjoying React for Real so far, but I ran into an issue people may run into in Chapter 4. I received an error that looked like the following:

Determining test suites to run...Error: This promise must be present when running with -o.
    at /Users/kelcecil/code/react-for-real/wordcounter-single/node_modules/jest/node_modules/jest-cli/build/search_source.js:192:17
    at (<anonymous>)
    at step (/Users/kelcecil/code/react-for-real/wordcounter-single/node_modules/jest/node_modules/jest-cli/build/search_source.js:20:362)

There appears to be a bug in Jest v21.0.1 where you’ll see this error if you run jest --watch in a directory without a git metadata (.git) directory. You can workaround by running git init in your project directory to create the git metadata directory or by downgrading Jest to v20.0.4.

You can follow the relevant bug report at Github. Hope this helps!

04 Sep 2017, 21:19
Ludovico Fischer (10 posts)

Thank you for your report. It definitely looks like a Jest bug, so let’s hope they fix it soon. Luckily Jest 21 was released just 6 hours ago, so the damage windows should be small. Real breakage will probably occur with Enzyme once Enzyme 3 releases for React 16 compatibility; but I am not sure API changes are definitive yet.

23 Nov 2017, 02:01
Stanford Guillory (2 posts)

A workaround for this bug is to use -watchAll instead of -watch.

23 Nov 2017, 18:42
Ludovico Fischer (10 posts)

Jest merged a fix for this a few days ago: Hopefully they’ll release it soon.

06 Jan 2018, 13:25
Balaji Raghavan (2 posts)

With version 3.0 of Enzyme, you have to connect to an adapter. Please check–16 on how to fix it.

import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
import { shallow } from 'enzyme';

Adding this somewhere before the tests should fix it.

08 Jan 2018, 19:38
Balaji Raghavan (2 posts)

Test ‘displays the correct count as a number’ may not pass. As the counter is not re-rendered. Try and call update on the wordCounter component.

For e.g.

  it('displays the correct count as a number', () => {
    const counter = wordCounter.find(Counter);
08 Jan 2018, 21:42
Ludovico Fischer (10 posts)

I posted on how to update the tests for Enzyme 3 and React 16 in this forum thread

You must be logged in to comment