Skip to content

Commit

Permalink
Fix incorrect usage of assert.rejects argument
Browse files Browse the repository at this point in the history
Updated error test to reflect bug fix
  • Loading branch information
james-pre committed Jan 7, 2025
1 parent 227e248 commit 580b86c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tests/fs/dir.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ suite('Dir', () => {
test('close()', async () => {
const dir = fs.opendirSync(testDirPath);
await dir.close();
rejects(dir.read(), 'Can not use closed Dir');
rejects(dir.read());
});

test('closeSync()', () => {
const dir = fs.opendirSync(testDirPath);
dir.closeSync();
assert.throws(() => dir.readSync(), 'Can not use closed Dir');
assert.throws(() => dir.readSync());
});

test('asynchronous iteration', async () => {
Expand All @@ -119,13 +119,13 @@ suite('Dir', () => {
test('read after directory is closed', async () => {
const dir = fs.opendirSync(testDirPath);
await dir.close();
await assert.rejects(dir.read(), 'Can not use closed Dir');
await assert.rejects(dir.read());
});

test('readSync after directory is closed', () => {
const dir = fs.opendirSync(testDirPath);
dir.closeSync();
assert.throws(() => dir.readSync(), 'Can not use closed Dir');
assert.throws(() => dir.readSync());
});

test('close multiple times', async () => {
Expand Down
1 change: 0 additions & 1 deletion tests/fs/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ suite('Error messages', () => {
const path = '/non-existent';

fs.promises.stat(path).catch((error: ErrnoError) => {
assert.equal(error.toString(), error.message);
assert.equal(error.bufferSize(), 4 + JSON.stringify(error.toJSON()).length);
});

Expand Down

0 comments on commit 580b86c

Please sign in to comment.