facebook / facebook/relay

Failed: "TypeError: (0 , _css.default) is not a function"

Open
#2,926 2 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I run a test with jest and relay-test-utils and take this error
The error is pointed out in the call `resolveMostRecentOperation`

`Test`
```
import React from 'react';
import { render, cleanup } from '@testing-library/react';
import { createMockEnvironment, MockPayloadGenerator } from 'relay-test-utils';
import UserListDefault from '../UserList';
import Environment from '../relay/Environment';

const env = createMockEnvironment();
let UserListRenderer;

beforeEach(() => {
Environment.environment = env;
UserListRenderer = render();
UserListRenderer.debug();
});

afterEach(cleanup);

describe('', () => {
it('should resolve query but no data', async () => {
env.mock.resolveMostRecentOperation((operation) =>
MockPayloadGenerator.generate(operation),
);

expect(UserListRenderer.baseElement).toMatchSnapshot();
});
});
```

relay-test-utils: 5.0.0,
react-relay: 5.0.0,

Contributor guide

Open the contributing guide

Research direction

Start with the shown Jest test, especially the call to resolveMostRecentOperation, and reproduce it using relay-test-utils 5.0.0 and react-relay 5.0.0. Trace the reported TypeError from that call into the UserList and relay/Environment imports; done means the operation resolves without the TypeError and the snapshot assertion can run.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.