From 0d8dd61257b6d5d73d313016d2f77310205fd4d8 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Sun, 19 Feb 2023 10:25:40 +0100 Subject: [PATCH] test: use expect(dir).to.be.an.instanceof(fs.Dirent); (#37331) --- spec/asar-spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/asar-spec.ts b/spec/asar-spec.ts index 248010ad973b..827b1d612fe3 100644 --- a/spec/asar-spec.ts +++ b/spec/asar-spec.ts @@ -899,7 +899,7 @@ describe('asar package', function () { const p = path.join(asarDir, 'a.asar'); const dirs = fs.readdirSync(p, { withFileTypes: true }); for (const dir of dirs) { - expect(dir instanceof fs.Dirent).to.be.true(); + expect(dir).to.be.an.instanceof(fs.Dirent); } const names = dirs.map(a => a.name); expect(names).to.deep.equal(['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']); @@ -909,7 +909,7 @@ describe('asar package', function () { const p = path.join(asarDir, 'a.asar', 'dir3'); const dirs = fs.readdirSync(p, { withFileTypes: true }); for (const dir of dirs) { - expect(dir instanceof fs.Dirent).to.be.true(); + expect(dir).to.be.an.instanceof(fs.Dirent); } const names = dirs.map(a => a.name); expect(names).to.deep.equal(['file1', 'file2', 'file3']); @@ -941,7 +941,7 @@ describe('asar package', function () { const dirs = await promisify(fs.readdir)(p, { withFileTypes: true }); for (const dir of dirs) { - expect(dir instanceof fs.Dirent).to.be.true(); + expect(dir).to.be.an.instanceof(fs.Dirent); } const names = dirs.map((a: any) => a.name); @@ -1004,7 +1004,7 @@ describe('asar package', function () { const p = path.join(asarDir, 'a.asar'); const dirs = await fs.promises.readdir(p, { withFileTypes: true }); for (const dir of dirs) { - expect(dir instanceof fs.Dirent).to.be.true(); + expect(dir).to.be.an.instanceof(fs.Dirent); } const names = dirs.map(a => a.name); expect(names).to.deep.equal(['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']);