From a6c18ab3b5efaab2e9ce59a68a06353126b1c55e Mon Sep 17 00:00:00 2001 From: Nicolas Goudry Date: Sun, 12 Nov 2023 15:06:54 +0100 Subject: [PATCH] test: unreadable directory support --- fixtures/bad-permissions/noread/unreadable.js | 0 tests/ignore.js | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 fixtures/bad-permissions/noread/unreadable.js diff --git a/fixtures/bad-permissions/noread/unreadable.js b/fixtures/bad-permissions/noread/unreadable.js new file mode 100644 index 0000000..e69de29 diff --git a/tests/ignore.js b/tests/ignore.js index a8546eb..798bab2 100644 --- a/tests/ignore.js +++ b/tests/ignore.js @@ -1,3 +1,4 @@ +import {chmod} from 'node:fs/promises'; import path from 'node:path'; import test from 'ava'; import slash from 'slash'; @@ -186,3 +187,21 @@ test('custom ignore files', async t => { ], ); }); + +test.serial('bad permissions', async t => { + const cwd = path.join(PROJECT_ROOT, 'fixtures/bad-permissions'); + const noReadDirectory = path.join(cwd, 'noread'); + + await chmod(noReadDirectory, 0o000); + + await t.notThrowsAsync( + runIsIgnoredByIgnoreFiles( + t, + '**/*', + {cwd, ignore: ['noread']}, + () => {}, + ), + ); + + t.teardown(() => chmod(noReadDirectory, 0o755)); +});