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')
4
4
const webpackPreprocessor = require ( '@cypress/webpack-preprocessor' )
5
5
const { addImageRedirect } = require ( '../utils/add-image-redirect' )
6
6
7
- const getWebpackOptions = opts => {
7
+ const getWebpackPreprocessorOptions = opts => {
8
8
debug ( 'top level opts %o' , opts )
9
9
10
10
const webpackOptions = findWebpack . getWebpackOptions ( )
11
11
if ( ! webpackOptions ) {
12
12
console . error ( '⚠️ Could not find Webpack options, using defaults' )
13
- return {
14
- webpackOptions : webpackPreprocessor . defaultOptions ,
15
- watchOptions : { } ,
16
- }
13
+ return webpackPreprocessor . defaultOptions
17
14
}
18
15
debug ( 'webpack options: %o' , webpackOptions )
19
16
findWebpack . cleanForCypress ( opts , webpackOptions )
@@ -42,7 +39,7 @@ module.exports = config => {
42
39
addFolderToTranspile : config . componentFolder ,
43
40
coverage : ! coverageIsDisabled ,
44
41
}
45
- const preprocessorOptions = getWebpackOptions ( opts )
42
+ const preprocessorOptions = getWebpackPreprocessorOptions ( opts )
46
43
47
44
debug ( 'final webpack options %o' , preprocessorOptions . webpackOptions )
48
45
You can’t perform that action at this time.
0 commit comments