Results 1 to 3 of 3

Thread: Testing a ExtReact app with Jest

  1. #1

    Default Testing a ExtReact app with Jest

    I can't get Jest working with any ExtReact app. I've seen a few messages saying it's supposed to work, but it can't find the Ext global object.

    It fails on my projects, but it also fails on a clean checkout of the ext-react-cra-eject sample linked from the official doc.

    In both cases I get this error:

    Code:
     FAIL  src/App.test.js
      ● Test suite failed to run
    
    
        TypeError: Cannot read property 'ClassManager' of undefined
          
          at Object.<anonymous> (node_modules/@extjs/reactor/dist/ExtJSComponent.js:97:14)
          at Object.<anonymous> (node_modules/@extjs/reactor/dist/reactify.js:34:24)
          at Object.<anonymous> (node_modules/@extjs/reactor/dist/index.js:12:17)
          at Object.<anonymous> (src/App.js:3:37)
          at Object.<anonymous> (src/App.test.js:3:12)
          at process._tickCallback (internal/process/next_tick.js:109:7)
    
    
    Test Suites: 1 failed, 1 total
    Tests:       0 total
    Snapshots:   0 total
    Time:        1.363s
    Ran all test suites.
    What are we supposed to do?

  2. #2

    Default

    As a workaround I've been mocking reactor:

    Code:
    jest.mock("@extjs/reactor", () => {
        return {
            reactify: (name) => {
                const component = (props) => {
                    return <div>Dummy {name} with props: {props}</div>;
                };
                component.displayName = "Reactified" + name;
                return component;
            }
        };
    });
    But then, I'm not sure I even need to use Jest if I end up not using Ext.js...

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    14

    Default

    Any updates on how we can test an Ext-React App with Jest ?

Similar Threads

  1. ExtReact Trial
    By ChrisAtBuddi in forum Q&A
    Replies: 15
    Last Post: 7 Jun 2018, 11:23 AM
  2. Replies: 3
    Last Post: 25 Apr 2018, 11:25 PM
  3. ExtReact box-sizing CSS
    By geniny in forum Q&A
    Replies: 6
    Last Post: 27 Jun 2017, 10:34 AM
  4. Accessing Ext from Jest/Jasmine
    By usmannajeeb in forum Q&A
    Replies: 2
    Last Post: 18 Jun 2017, 10:38 PM
  5. Using extReact with Extjs
    By philiparad in forum Q&A
    Replies: 1
    Last Post: 25 May 2017, 11:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •