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

105
Views
vitest crypto.randomUUID() no es una función

vite.config.ts

 import { sveltekit } from '@sveltejs/kit/vite';

const config = {
 plugins: [sveltekit()],
 test: {
 include: ['**/*.spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
 environment: 'jsdom',
 globals: true,
 setupFiles: 'src/setupTests.ts'
 }
};

export default config;

src/setupTests.ts

 import '@testing-library/jest-dom/extend-expect';

MyComponent.svelte

 onMount(() => {
 postElementId = crypto.randomUUID();
 ...
});

Error

 TypeError: crypto.randomUUID is not a function

Tengo un componente que usa la API criptográfica para crear una identificación aleatoria y funciona según lo previsto, pero cuando quiero probarlo, cada vez que lo hago aparece este error, ¡se agradece cualquier ayuda!

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Solo revisando, hiciste:

import crypto from 'node:crypto';

¿en algún momento?

almost 4 years ago · Santiago Trujillo 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!