Fix Vitest timeout deprecation warnings

Update test files to use the new Vitest timeout syntax. Instead of passing
timeout as an object `{timeout: 5000}`, we now pass it directly as a number
as the third parameter to `it()`.

This resolves deprecation warnings in:
- test/packager-tests.ts
- test/filter-tests.ts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Matt Godbolt
2025-05-27 12:08:31 -05:00
co-authored by Claude
parent d27d59fc1e
commit aaf07fefe2
2 changed files with 27 additions and 40 deletions
+7 -12
View File
@@ -61,18 +61,13 @@ const stringifyKeysInOrder = (data: any): string => {
function testFilter(filename: string, suffix: string, filters: ParseFiltersAndOutputOptions) {
const testName = path.basename(filename + suffix);
it(
testName,
// Bump the timeout a bit so that we don't fail for slow cases
{timeout: 10000},
async () => {
const result = processAsm(filename, filters);
delete result.parsingTime;
delete result.filteredCount;
// TODO normalize line endings?
await expect(stringifyKeysInOrder(result)).toMatchFileSnapshot(path.join(casesRoot, testName + '.json'));
},
);
it(testName, async () => {
const result = processAsm(filename, filters);
delete result.parsingTime;
delete result.filteredCount;
// TODO normalize line endings?
await expect(stringifyKeysInOrder(result)).toMatchFileSnapshot(path.join(casesRoot, testName + '.json'));
}, 10000); // Bump the timeout a bit so that we don't fail for slow cases
}
describe('Filter test cases', () => {
+20 -28
View File
@@ -36,40 +36,32 @@ async function writeTestFile(filepath) {
}
describe('Packager', () => {
it(
'should be able to package 1 file',
async () => {
const pack = new Packager();
it('should be able to package 1 file', async () => {
const pack = new Packager();
const dirPath = newTempDir();
await writeTestFile(path.join(dirPath, 'hello.txt'));
const dirPath = newTempDir();
await writeTestFile(path.join(dirPath, 'hello.txt'));
const targzPath = path.join(dirPath, 'package.tgz');
await pack.package(dirPath, targzPath);
const targzPath = path.join(dirPath, 'package.tgz');
await pack.package(dirPath, targzPath);
await expect(fs.stat(targzPath)).resolves.toBeDefined();
},
{timeout: 5000},
);
await expect(fs.stat(targzPath)).resolves.toBeDefined();
}, 5000);
it(
'should be able to unpack',
async () => {
const pack = new Packager();
it('should be able to unpack', async () => {
const pack = new Packager();
const dirPath = newTempDir();
await writeTestFile(path.join(dirPath, 'hello.txt'));
const dirPath = newTempDir();
await writeTestFile(path.join(dirPath, 'hello.txt'));
const targzPath = path.join(dirPath, 'package.tgz');
await pack.package(dirPath, targzPath);
const targzPath = path.join(dirPath, 'package.tgz');
await pack.package(dirPath, targzPath);
const unpackPath = newTempDir();
const pack2 = new Packager();
await pack2.unpack(targzPath, unpackPath);
const unpackPath = newTempDir();
const pack2 = new Packager();
await pack2.unpack(targzPath, unpackPath);
const unpackedFilepath = path.join(unpackPath, 'hello.txt');
await expect(fs.stat(unpackedFilepath)).resolves.toBeDefined;
},
{timeout: 5000},
);
const unpackedFilepath = path.join(unpackPath, 'hello.txt');
await expect(fs.stat(unpackedFilepath)).resolves.toBeDefined;
}, 5000);
});