/react-with-rollup

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

Primary LanguageJavaScriptMIT LicenseMIT

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