Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update execa to v6 (and update scripts to ESM) #502

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update test:integration to work with latest execa
mansona committed Aug 19, 2022
commit 5be447521eabfb3c27463096850d5a6cb4406273
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
"lint": "eslint . --cache",
"release": "release-it",
"test": "codemod-cli test --coverage",
"test:integration": "node ./test/run-test.js",
"test:integration": "node ./test/run-test.mjs",
"test:notelemetry": " node ./test/run-test-without-telemetry.js"
},
"jest": {
59 changes: 0 additions & 59 deletions test/run-test.js

This file was deleted.

58 changes: 58 additions & 0 deletions test/run-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* eslint-disable no-console */

import { spawn } from 'child_process';
import { execa } from 'execa';
import path from 'path';

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


console.log('installing deps');

await execa('rm', ['-rf', 'node_modules'], execOpts);
await execa('yarn', ['install'], execOpts);

console.log('starting serve');

// We use spawn for this one so we can kill it later without throwing an error
const emberServe = spawn('yarn', ['start'], execOpts);
emberServe.stderr.pipe(process.stderr);
emberServe.stdout.pipe(process.stdout);

await new Promise((resolve) => {
emberServe.stdout.on('data', (data) => {
if (data.toString().includes('Build successful')) {
resolve();
}
});
});

console.log('running codemod');

const codemod = execa(
'../../../bin/cli.js',
['--telemetry', 'http://localhost:4200', 'app'],
execOpts
);
codemod.stdout.pipe(process.stdout);
await codemod;

console.log('codemod complete, ending serve');

emberServe.kill('SIGTERM');

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);