This repository was archived by the owner on Mar 5, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +48
-6
lines changed Expand file tree Collapse file tree 8 files changed +48
-6
lines changed Original file line number Diff line number Diff line change 1+ package-lock = false
Original file line number Diff line number Diff line change 1+ {
2+ "fixturesFolder" : false ,
3+ "testFiles" : " **/*cy-spec.js" ,
4+ "viewportWidth" : 500 ,
5+ "viewportHeight" : 500 ,
6+ "experimentalComponentTesting" : true
7+ }
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { mount } from 'cypress-react-unit-test'
3+
4+ describe ( 'components' , ( ) => {
5+ it ( 'works' , ( ) => {
6+ mount ( < div > Text</ div > )
7+ cy . contains ( 'Text' )
8+ } )
9+ } )
Original file line number Diff line number Diff line change 1+ /// <reference types="cypress" />
2+ describe ( 'integration spec' , ( ) => {
3+ it ( 'works' , ( ) => {
4+ expect ( 1 ) . to . equal ( 1 )
5+ } )
6+ } )
Original file line number Diff line number Diff line change 1+ // @ts -check
2+ const webpackPreprocessor = require ( '@cypress/webpack-preprocessor' )
3+ module . exports = ( on , config ) => {
4+ on (
5+ 'file:preprocessor' ,
6+ // @ts -ignore
7+ webpackPreprocessor ( webpackPreprocessor . defaultOptions ) ,
8+ )
9+ }
Original file line number Diff line number Diff line change 1+ require ( 'cypress-react-unit-test/dist/hooks' )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " example-webpack-options" ,
3+ "description" : " Using default Webpack options to transpile simple tests" ,
4+ "private" : true ,
5+ "scripts" : {
6+ "test" : " ../../node_modules/.bin/cypress run" ,
7+ "cy:open" : " ../../node_modules/.bin/cypress open"
8+ },
9+ "devDependencies" : {
10+ "cypress-react-unit-test" : " file:../.."
11+ }
12+ }
Original file line number Diff line number Diff line change @@ -4,16 +4,13 @@ const findWebpack = require('find-webpack')
44const webpackPreprocessor = require ( '@cypress/webpack-preprocessor' )
55const { addImageRedirect } = require ( '../utils/add-image-redirect' )
66
7- const getWebpackOptions = opts => {
7+ const getWebpackPreprocessorOptions = opts => {
88 debug ( 'top level opts %o' , opts )
99
1010 const webpackOptions = findWebpack . getWebpackOptions ( )
1111 if ( ! webpackOptions ) {
1212 console . error ( '⚠️ Could not find Webpack options, using defaults' )
13- return {
14- webpackOptions : webpackPreprocessor . defaultOptions ,
15- watchOptions : { } ,
16- }
13+ return webpackPreprocessor . defaultOptions
1714 }
1815 debug ( 'webpack options: %o' , webpackOptions )
1916 findWebpack . cleanForCypress ( opts , webpackOptions )
@@ -42,7 +39,7 @@ module.exports = config => {
4239 addFolderToTranspile : config . componentFolder ,
4340 coverage : ! coverageIsDisabled ,
4441 }
45- const preprocessorOptions = getWebpackOptions ( opts )
42+ const preprocessorOptions = getWebpackPreprocessorOptions ( opts )
4643
4744 debug ( 'final webpack options %o' , preprocessorOptions . webpackOptions )
4845
You can’t perform that action at this time.
0 commit comments