Skip to content

Commit

Permalink
fix test:notelemetry script to work with latest execa
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Aug 19, 2022
1 parent 5be4475 commit d35bfdb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"release": "release-it",
"test": "codemod-cli test --coverage",
"test:integration": "node ./test/run-test.mjs",
"test:notelemetry": " node ./test/run-test-without-telemetry.js"
"test:notelemetry": " node ./test/run-test-without-telemetry.mjs"
},
"jest": {
"collectCoverageFrom": [
Expand Down
33 changes: 0 additions & 33 deletions test/run-test-without-telemetry.js

This file was deleted.

30 changes: 30 additions & 0 deletions test/run-test-without-telemetry.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable no-console */
import { execa } from 'execa';
import path from 'path';

// resolved from the root of the project
const inputDir = path.resolve('./test/fixtures/without-telemetry/input');
const binPath = path.resolve('./bin/cli.js');
const execOpts = { cwd: inputDir, stderr: 'inherit' };

console.log('running codemod');

const codemod = execa(binPath, ['app'], execOpts);
codemod.stdout.pipe(process.stdout);
await codemod;

console.log('codemod complete');

console.log('comparing results');

try {
await execa('diff', ['-rq', './app', '../output/app'], execOpts);
} catch (e) {
console.error('codemod did not run successfully');
console.log(e);

process.exit(1);
}

console.log('codemod ran successfully! 🎉');
process.exit(0);

0 comments on commit d35bfdb

Please sign in to comment.