0.2.5 • Published 2 years ago

@fpkit/nextjs v0.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

README

Test setup

// package setup
vitest jsdom c8
@testing-library/jest-dom @testing-library/react @testing-library/user-event @types/react-test-renderer react-test-renderer

Setup.js

import '@testing-library/jest-dom'

// *SOURCE https://markus.oberlehner.net/blog/using-testing-library-jest-dom-with-vitest/?s=09&utm_source=pocket_mylist
import matchers from '@testing-library/jest-dom/matchers';
import { expect } from 'vitest';

expect.extend(matchers);

Vite.config.js

/// <reference types="vitest" />
/// <reference types="vite/client" />
import { defineConfig } from "vite";
export default defineConfig({
  test: {
    globals: true,
    environment: "jsdom", // add jsdom
    setupFiles: "./src/test/setup.ts", // setup includes
    coverage: {
      // config coverage
      reporter: ["text", "html"], // generate coverage reports
      exclude: [
        // dont test the following files
        "node_modules/",
        "src/test/setup.ts",
      ],
    },
  },
});

Example test

import React from 'react';

import { describe, expect, test, it  } from 'vitest';
import { render, screen  } from '@testing-library/react';

import App from '../App'
describe('App renders correctly', () => {

  test('renders without crashing', () => {
    render(<App />);
    expect(screen).toMatchSnapshot();
  });
})
0.2.5

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.4

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago