Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

397
Views
Module Parse failed : Unexpected token React JS DOMCollection
Trying to integrate react unit testing in existing rails app. I am getting the below issue after I tried to render a component in test file 

check.test.tsx :

import React from "react"; import * as ReactDOM from 'react-dom'; import { render, fireEvent,queryByAttribute ,screen,cleanup,getByText} from "@testing-library/react";

import CustomDropdown,{APIResponse}  from "../CustomDropdown";


function renderCustomDropdown(props: Partial<APIResponse> = {}) {
    const defaultProps: APIResponse = {
        validateFormHandler() {
        return;
      },
      items: [],
      selectedItems: [],
      inputText: "",
      filteredsortByNameIDs: [],
      placeholderText: "",
    
    };
    return render(<CustomDropdown {...defaultProps} {...props} />);
  }: 

Issue happens after I add render ()

ERROR in ./node_modules/@testing-library/dom/node_modules/pretty-format/build/plugins/DOMCollection.js
rails_1                | Module parse failed: Unexpected token
rails_1                | You may need an appropriate loader to handle this file type.
rails_1                | |                 return props;
rails_1                | |               }, {})
rails_1                | |             : {...collection},
rails_1                | |           config,
rails_1                | |           indentation,

Please help me out to fix this issue.
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!