Skip to content
Merged
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: 1 addition & 12 deletions apps/oxlint/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'node:fs/promises';
import { join as pathJoin } from 'node:path';

import { execa } from 'execa';
Expand Down Expand Up @@ -52,17 +51,7 @@ export async function testFixtureWithCommand(options: TestFixtureOptions): Promi
}
}

let expectedSnapshot = null;
try {
expectedSnapshot = await fs.readFile(snapshotPath, 'utf8');
} catch (err) {
if (err?.code !== 'ENOENT') throw err;
}

if (snapshot !== expectedSnapshot) {
await fs.writeFile(snapshotPath, snapshot);
if (expectedSnapshot !== null) expect(snapshot).toBe(expectedSnapshot);
}
await expect(snapshot).toMatchFileSnapshot(snapshotPath);
}

/**
Expand Down
Loading