File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -330,6 +330,22 @@ export default SvgFile
330330"
331331` ;
332332
333+ exports [` cli should transform a whole directory and output relative destination paths 1` ] = `
334+ "
335+ __fixtures__/cased/PascalCase.svg -> __fixtures_build__/whole/cased/PascalCase.js
336+ __fixtures__/cased/camelCase.svg -> __fixtures_build__/whole/cased/CamelCase.js
337+ __fixtures__/cased/kebab-case.svg -> __fixtures_build__/whole/cased/KebabCase.js
338+ __fixtures__/cased/multiple---dashes.svg -> __fixtures_build__/whole/cased/MultipleDashes.js
339+ __fixtures__/complex/skype.svg -> __fixtures_build__/whole/complex/Skype.js
340+ __fixtures__/complex/telegram.svg -> __fixtures_build__/whole/complex/Telegram.js
341+ __fixtures__/nesting/a/two.svg -> __fixtures_build__/whole/nesting/a/Two.js
342+ __fixtures__/nesting/one.svg -> __fixtures_build__/whole/nesting/One.js
343+ __fixtures__/simple/file.svg -> __fixtures_build__/whole/simple/File.js
344+ __fixtures__/withPrettierRc/file.svg -> __fixtures_build__/whole/withPrettierRc/File.js
345+ __fixtures__/withSvgoYml/file.svg -> __fixtures_build__/whole/withSvgoYml/File.js
346+ __fixtures__/withSvgrRc/file.svg -> __fixtures_build__/whole/withSvgrRc/File.js"
347+ ` ;
348+
333349exports [` cli should work with a simple file 1` ] = `
334350"import React from 'react'
335351
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ async function dirCommand(
3232 const dest = path . resolve ( program . outDir , relative )
3333 const code = await convertFile ( src , options )
3434 outputFileSync ( dest , code )
35- process . stdout . write ( `${ src } -> ${ dest } \n` )
35+ process . stdout . write ( `${ src } -> ${ path . relative ( process . cwd ( ) , dest ) } \n` )
3636 return true
3737 }
3838
Original file line number Diff line number Diff line change @@ -48,8 +48,13 @@ describe('cli', () => {
4848 expect ( result ) . toMatchSnapshot ( )
4949 } , 10000 )
5050
51- it ( 'should transform a whole directory' , async ( ) => {
52- await cli ( '--out-dir __fixtures_build__/whole __fixtures__' )
51+ it ( 'should transform a whole directory and output relative destination paths' , async ( ) => {
52+ const result = await cli ( '--out-dir __fixtures_build__/whole __fixtures__' )
53+ const sorted = result
54+ . split ( / \n / )
55+ . sort ( )
56+ . join ( '\n' )
57+ expect ( sorted ) . toMatchSnapshot ( )
5358 } , 10000 )
5459
5560 it ( 'should support --prettier-config as json' , async ( ) => {
You can’t perform that action at this time.
0 commit comments