bahmutov / react-with-rollup

React application bundled using Rollup and tested using cypress-react-unit-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-with-rollup

React application bundled using Rollup and with component tests using cypress-react-unit-test.

Code is bundled using rollup.config.js file. Component tests point at that file in cypress/plugins/index.js file.

const rollupPreprocessor = require('@bahmutov/cy-rollup')
module.exports = (on, config) => {
  on('file:preprocessor', rollupPreprocessor())
}

A component test src/lib/Dog.spec.js mounts <Dog />

import {mount} from 'cypress-react-unit-test'
import Dog from './Dog'
it('barks', () => {
  mount(<Dog />)
  cy.get('img[alt=dog]').should('be.visible')
})

Test screenshot

Original repo forked from codenaz/create-react-package-tutorial

About

React application bundled using Rollup and tested using cypress-react-unit-test

License:MIT License


Languages

Language:JavaScript 80.6%Language:HTML 18.9%Language:CSS 0.5%