Skip to content

Instantly share code, notes, and snippets.

@SoyRol4ndo
Forked from Klerith/testing-configuration.md
Created December 16, 2025 19:55
Show Gist options
  • Select an option

  • Save SoyRol4ndo/39c4ad2089241eb9ef96055f4ce18376 to your computer and use it in GitHub Desktop.

Select an option

Save SoyRol4ndo/39c4ad2089241eb9ef96055f4ce18376 to your computer and use it in GitHub Desktop.

Revisions

  1. @Klerith Klerith revised this gist Jun 17, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion testing-configuration.md
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ npm install --save-dev @testing-library/react @testing-library/dom vitest jsdom
    ```

    4. Configurar `vite.config.ts`
    ```
    ```ts
    import { defineConfig } from 'vitest/config';
    import react from '@vitejs/plugin-react-swc';

  2. @Klerith Klerith revised this gist Jun 17, 2025. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions testing-configuration.md
    Original file line number Diff line number Diff line change
    @@ -27,3 +27,18 @@ npm install --save-dev @testing-library/react @testing-library/dom vitest jsdom
    "coverage": "vitest run --coverage"
    }
    ```

    4. Configurar `vite.config.ts`
    ```
    import { defineConfig } from 'vitest/config';
    import react from '@vitejs/plugin-react-swc';
    // https://vite.dev/config/
    export default defineConfig({
    plugins: [react()],
    test: {
    environment: 'jsdom',
    globals: true,
    },
    });
    ```
  3. @Klerith Klerith created this gist Jun 17, 2025.
    29 changes: 29 additions & 0 deletions testing-configuration.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    # Instalar dependencias Testing

    1. [Vitest](https://vitest.dev/guide/)

    ```bash
    npm install --save-dev vitest jsdom
    ```

    2. React [Testing Library](https://testing-library.com/docs/react-testing-library/intro)

    ```bash
    npm install --save-dev @testing-library/react @testing-library/dom
    ```

    - Todo en un sólo comando

    ```bash
    npm install --save-dev @testing-library/react @testing-library/dom vitest jsdom
    ```

    3. Crear estos scripts en el `package.json`

    ```json
    "scripts": {
    "test": "vitest",
    "test:ui": "vitest --ui",
    "coverage": "vitest run --coverage"
    }
    ```