This repository was archived by the owner on Mar 5, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 11const debug = require ( 'debug' ) ( 'cypress-react-unit-test' )
22const path = require ( 'path' )
33const mime = require ( 'mime-types' )
4+ const fs = require ( 'fs' )
45
56/**
67 * User code:
@@ -10,7 +11,7 @@ const mime = require('mime-types')
1011 * image is "/__root/path/to/image.png"
1112 * <img src={image} />
1213 */
13- function staticResourceLoader ( content ) {
14+ function staticResourceLoader ( ) {
1415 debug ( 'loading static resource %s' , this . resourcePath )
1516 debug ( 'cwd' , process . cwd ( ) )
1617 const relativeResourcePath = path . relative ( process . cwd ( ) , this . resourcePath )
@@ -20,7 +21,8 @@ function staticResourceLoader(content) {
2021 debug ( 'resource is outside of the current working directory' )
2122 debug ( 'inlining it instead (performance hit!)' )
2223 const mimetype = mime . lookup ( this . resourcePath )
23- const encoded = content . toString ( 'base64' )
24+ const content = fs . readFileSync ( this . resourcePath )
25+ const encoded = new Buffer ( content ) . toString ( 'base64' )
2426 return `module.exports = "data:${ mimetype } ;base64,${ encoded } "`
2527 }
2628
You can’t perform that action at this time.
0 commit comments