@@ -43,6 +43,15 @@ test('xo --fix', async t => {
4343 t . is ( fileContent , dedent `console.log('hello');\n` ) ;
4444} ) ;
4545
46+ test ( 'xo --fix-dry-run' , async t => {
47+ const filePath = path . join ( t . context . cwd , 'test.js' ) ;
48+ const original = dedent `console.log('hello')\n` ;
49+ await fs . writeFile ( filePath , original , 'utf8' ) ;
50+ await t . notThrowsAsync ( $ `node ./dist/cli --cwd ${ t . context . cwd } --fix-dry-run` ) ;
51+ const fileContent = await fs . readFile ( filePath , 'utf8' ) ;
52+ t . is ( fileContent , original , 'File should not be modified with --fix-dry-run' ) ;
53+ } ) ;
54+
4655test ( 'xo --fix --space' , async t => {
4756 const filePath = path . join ( t . context . cwd , 'test.js' ) ;
4857 await fs . writeFile ( filePath , dedent `function test() {\n return true;\n}\n` , 'utf8' ) ;
@@ -162,6 +171,11 @@ test('xo --stdin --fix', async t => {
162171 t . is ( stdout , 'const x = true;' ) ;
163172} ) ;
164173
174+ test ( 'xo --stdin --fix-dry-run' , async t => {
175+ const { stdout} = await $ `echo ${ 'const x = true' } ` . pipe `node ./dist/cli --cwd=${ t . context . cwd } --stdin --fix-dry-run` ;
176+ t . is ( stdout , 'const x = true;' ) ;
177+ } ) ;
178+
165179test ( 'xo --stdin --stdin-filename=test.js' , async t => {
166180 const { stdout} = await $ `echo ${ 'const x = true' } ` . pipe `node ./dist/cli --cwd=${ t . context . cwd } --stdin --stdin-filename=test.js` ;
167181 t . true ( stdout . includes ( 'test.js' ) ) ;
0 commit comments