Skip to content

Commit 66c04b8

Browse files
committed
fixup! fix: prevent EMFILE error in environment low file descriptors limit
1 parent b3c146a commit 66c04b8

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

test/content/read.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getReadStatFailure = (t, err) => getRead(t, {
2424
throw err
2525
},
2626
},
27-
'fs/promises': {
27+
'fs-extra': {
2828
...fs.promises,
2929
stat: async () => {
3030
throw err
@@ -219,7 +219,7 @@ t.test('read: returns only first result if other hashes fails', function (t) {
219219
t.test('read: opening large files', function (t) {
220220
const CACHE = t.testdir()
221221
const mockedRead = getRead(t, {
222-
'fs/promises': {
222+
'fs-extra': {
223223
...fs.promises,
224224
stat: async () => {
225225
return { size: Number.MAX_SAFE_INTEGER }

test/entry-index.insert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ t.test('ENOENT from appendFile is ignored', async (t) => {
224224
const cache = t.testdir()
225225

226226
const indexMocked = t.mock('../lib/entry-index.js', {
227-
'fs/promises': {
227+
'fs-extra': {
228228
...fs,
229229
appendFile: async () => {
230230
throw Object.assign(new Error('fake enoent'), { code: 'ENOENT' })
@@ -239,7 +239,7 @@ t.test('generic error from appendFile rejects', async (t) => {
239239
const cache = t.testdir()
240240

241241
const indexMocked = t.mock('../lib/entry-index.js', {
242-
'fs/promises': {
242+
'fs-extra': {
243243
...fs,
244244
appendFile: async () => {
245245
throw Object.assign(new Error('fake eperm'), { code: 'EPERM' })

test/entry-index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ missingFileError.code = 'ENOENT'
1717

1818
const getEntryIndex = (t, opts) => t.mock('../lib/entry-index', opts)
1919
const getEntryIndexReadFileFailure = (t, err) => getEntryIndex(t, {
20-
'fs/promises': {
20+
'fs-extra': {
2121
...fs.promises,
2222
readFile: async () => {
2323
throw err
@@ -233,7 +233,7 @@ t.test('lsStream: missing files error', async (t) => {
233233
t.test('lsStream: unknown error reading dirs', (t) => {
234234
const cache = t.testdir(cacheContent)
235235
const { lsStream } = getEntryIndex(t, {
236-
'fs/promises': {
236+
'fs-extra': {
237237
...fs.promises,
238238
readdir: async () => {
239239
throw genericError

test/verify.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ t.test('missing file error when validating cache content', async t => {
216216
const missingFileError = new Error('ENOENT')
217217
missingFileError.code = 'ENOENT'
218218
const mockVerify = getVerify(t, {
219-
'fs/promises': Object.assign({}, fs, {
219+
'fs-extra': Object.assign({}, fs, {
220220
stat: async () => {
221221
throw missingFileError
222222
},
@@ -238,7 +238,7 @@ t.test('missing file error when validating cache content', async t => {
238238

239239
t.test('unknown error when validating content', async t => {
240240
const mockVerify = getVerify(t, {
241-
'fs/promises': Object.assign({}, fs, {
241+
'fs-extra': Object.assign({}, fs, {
242242
stat: async () => {
243243
throw genericError
244244
},
@@ -274,7 +274,7 @@ t.test('unknown error when rebuilding bucket', async t => {
274274
// shouldFail controls the right time to mock the error
275275
let shouldFail = false
276276
const mockVerify = getVerify(t, {
277-
'fs/promises': Object.assign({}, fs, {
277+
'fs-extra': Object.assign({}, fs, {
278278
stat: async (path) => {
279279
if (shouldFail) {
280280
throw genericError

0 commit comments

Comments
 (0)