Skip to content
Open
Changes from all commits
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
13 changes: 8 additions & 5 deletions packages/adblocker/test/migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import { allLists } from './utils.js';

async function run(cwd: string, cmd: string, args: string[]) {
return new Promise<string>((resolve, reject) => {
const process = spawn(cmd, args, {
const child = spawn(cmd, args, {
cwd,
});
const chunks: string[] = [];
process.stdout.on('data', (chunk) => chunks.push(chunk));
process.once('error', (error) => reject(error));
process.once('close', (code) => {
child.stdout.on('data', (chunk) => chunks.push(chunk));
child.once('error', (error) => reject(error));
child.once('close', (code) => {
if (code === null) {
Comment on lines 21 to 28

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was messing around with the issue, I realised that having process as a variable name is not great. Not necessary change but I'm willing to change in this pull request.

reject(new Error('Child process terminated!'));
return;
Expand Down Expand Up @@ -79,7 +79,10 @@ async function builder() {

async function createBuilder(version: string = 'latest') {
// Create working dir
const dir = join(import.meta.dirname, '.migration-test');
// This has to be outside of test/ directory as mocha tries to
// scann all file to find actual test files and it will try to
// import wrong files (such as d.ts).
const dir = join(import.meta.dirname, '../.migration-test');
if (!existsSync(dir)) {
await mkdir(dir);
}
Expand Down
Loading