From 899020da66f81518020da063f78dd1c11bf08728 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Mar 2023 11:08:26 +0000 Subject: [PATCH] build(deps-dev): bump glob from 8.1.0 to 9.1.0 (#475) * build(deps-dev): bump glob from 8.1.0 to 9.1.0 Bumps [glob](https://github.com/isaacs/node-glob) from 8.1.0 to 9.1.0. - [Release notes](https://github.com/isaacs/node-glob/releases) - [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md) - [Commits](https://github.com/isaacs/node-glob/compare/v8.1.0...v9.1.0) --- updated-dependencies: - dependency-name: glob dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * test(index): async removal of test files --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Frazer Smith --- package.json | 2 +- src/index.test.js | 30 ++++++++++++------------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 06e4347b..b01351fb 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "eslint-plugin-promise": "^6.1.1", "eslint-plugin-security": "^1.7.1", "eslint-plugin-security-node": "^1.1.1", - "glob": "^8.1.0", + "glob": "^9.1.0", "husky": "^8.0.3", "jest": "^29.4.2", "jsdoc-to-markdown": "^8.0.0", diff --git a/src/index.test.js b/src/index.test.js index 7fea2b80..5f949ead 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -2,7 +2,7 @@ /* eslint-disable security/detect-child-process */ /* eslint-disable security/detect-non-literal-fs-filename */ const fs = require("fs"); -const glob = require("glob"); +const { glob } = require("glob"); const path = require("upath"); const { execFile } = require("child_process"); const { promisify } = require("util"); @@ -38,25 +38,19 @@ switch (process.platform) { break; } -/** - * @description Removes leftover test files. - * @returns {Promise} 'done' on resolve. - */ -function clean() { - return new Promise((resolve) => { - const files = glob.GlobSync( - `${testDirectory}!(test.txt|pdf_1.3_NHS_Constitution.pdf|pdf_1.3_NHS_Constitution_attached_detach.pdf|pdf_1.7_NHS_Constitution_Handbook.pdf)` - ).found; - files.forEach((foundFile) => { - fs.unlinkSync(foundFile); - }); - resolve("done"); - }); -} - describe("Node-Poppler module", () => { afterEach(async () => { - await clean(); + // Remove leftover test files + const files = await glob(`${testDirectory}**/*`, { + ignore: [ + `${testDirectory}/pdf_1.3_NHS_Constitution_attached_detach.pdf`, + `${testDirectory}/pdf_1.3_NHS_Constitution.pdf`, + `${testDirectory}/pdf_1.7_NHS_Constitution_Handbook.pdf`, + `${testDirectory}/test.txt`, + ], + }); + + await Promise.all(files.map((filed) => fs.promises.unlink(filed))); }); describe("Constructor", () => {