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

After Pendo React Native integration into codebase, Jest test are failing. #3

Closed
shariq-muhammad opened this issue Oct 3, 2022 · 3 comments

Comments

@shariq-muhammad
Copy link

After integrating Pendo SDK for React Native with React Navigation, Jest tests are failing with the following error:

  FAIL  src/components/Button/Button.test.tsx
  ● Test suite failed to run

    Invariant Violation: `new NativeEventEmitter()` requires a non-null argument.

      at invariant (node_modules/invariant/invariant.js:40:15)
      at new NativeEventEmitter (node_modules/react-native/Libraries/EventEmitter/NativeEventEmitter.js:44:7)
      at Object.<anonymous> (node_modules/rn-pendo-sdk/lib/pendoRNN.js:1:766)
      at Object.<anonymous> (node_modules/rn-pendo-sdk/lib/pendoAPI.js:1:723)

Not sure if there needs to be a Jest setup for PendoSDK. Test cases are failing for even simple presentation components, e.g.:

import React from 'react';
import { render } from 'test-utils';

import { Button } from './Button';

describe('Button', () => {
  it('should render without error', () => {
    expect(render(<Button>Test</Button>)).toBeTruthy();
  });
});

What should be done to make PendoSDK pass Jest unit tests?

@MikePendo
Copy link
Collaborator

@shariq-muhammad
Please have a look at how jest should be configured. I have the same error but after additional configurations (which is not related to Pendo the test start to work).
I have created separated PR for that u can look at the branch APP-69568.
Please note u will need explicitly mock Pendo if needed .
Basically the same error can be found here

@MikePendo
Copy link
Collaborator

@shariq-muhammad
Did u have the chance to look in to it?

@shariq-muhammad
Copy link
Author

@MikePendo Unfortunately, I didn't get a chance, will look into this today.

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