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

233
Views
¿Cómo configurar el portapapeles en Cypress 10?

Soy bastante nuevo en ciprés. Intenté instalar portapapeles en uno de mis proyectos. Pero la guía que encontré en línea como esta se configura principalmente en el ciprés más antiguo que usa el archivo plugins/index.js.

Intenté algo como esto y obtuve un error.

 const { defineConfig } = require("cypress"); const createBundler = require("@bahmutov/cypress-esbuild-preprocessor"); const addCucumberPreprocessorPlugin = require("@badeball/cypress-cucumber-preprocessor").addCucumberPreprocessorPlugin; const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild").createEsbuildPlugin; const clipboardy = require("clipboardy"); module.exports = defineConfig({ e2e: { async setupNodeEvents(on, config) { const bundler = createBundler({ plugins: [createEsbuildPlugin(config)], }); on("file:preprocessor", bundler); await addCucumberPreprocessorPlugin(on, config); on('task', { getClipboard () { return clipboardy.readSync(); } }); return config; }, specPattern: "cypress/e2e/features/*.feature", baseUrl: "XXXXXXXXXXXXX", chromeWebSecurity: false, }, });

El error

Pantalla de error

Rastreo de pila

 Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\XXXXXXXXXXXXXXXXXXXXXXX\node_modules\clipboardy\index.js from C:\Users\XXXXXXXXXXXXXXXXXXXXXXX\cypress.config.js not supported. Instead change the require of index.js in C:\Users\XXXXXXXXXXXXXXXXXXXXXXX\cypress.config.js to a dynamic import() which is available in all CommonJS modules. at Object. (C:\Users\XXXXXXXXXXXXXXXXXXXXXXX\cypress.config.js:8:20) at async Promise.all (index 0) at async loadFile (C:\Users\XXXX\AppData\Local\Cypress\Cache\10.4.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:106:14) at async EventEmitter. (C:\Users\XXXX\AppData\Local\Cypress\Cache\10.4.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:116:32)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Es porque el paquete portapapeles tiene el type: "module" en su 'paquete.json'.

Esto le dice a cualquier cosa que use el paquete que debe usar import not require para cargar el paquete.

Use importaciones dinámicas, como se indica en el mensaje de error

En su lugar, cambie el requerimiento de index.js en ... a una importación dinámica ()

 const clipboard = import('clipboardy')
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!