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

159
Views
Calling the same imports onto a single cypress file

We are using Cypress v10 and our .cy.js files always use these same imports:

import Customers from "../imports/Customer"
import Search from "../imports/Search"
import PostComment from "../imports/PostComment"
import Feedback from "../imports/Feedback"
import Login from "../imports/Login"

Is there a better way that I can include all these imports in a single or two lines and not call them manually like this? I tried creating a complete.js file that contains copy pasted code as above then try to import that complete.js but it does not seem to work. I'm not sure if I'm missing anything.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can use an index file to re-export and simplify the import.

// imports/index.js
export { Customers } from 'Customer'
export { Search } from 'Search'
export { PostComment } from 'PostComment'
export { Feedback } from 'Feedback'
export { Login } from 'Login'

// test.cy.js
import { Customers, Search, PostComment, Feedback, Login } from '../imports'
about 4 years ago · Juan Pablo Isaza Report

0

To convert default exports in the individual files to named exports in the barrel index

export { * as Customers } from 'Customer'
export { * as Search } from 'Search'
export { * as PostComment } from 'PostComment'
export { * as Feedback } from 'Feedback'
export { * as Login } from 'Login'
about 4 years ago · Juan Pablo Isaza Report
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!