diff --git a/package.json b/package.json index ee0da14..8b639d5 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "scripts": { "build": "tsc", "prepublishOnly": "npm run build", - "test": "node --loader tsx test/index.ts", + "test": "node --loader tsx test/*.ts", "coverage": "c8 -r html npm test", - "lint": "cross-env eslint src/*.ts" + "lint": "eslint src/*.ts" }, "repository": { "type": "git", @@ -38,18 +38,18 @@ }, "homepage": "https://github.com/NodeSecure/ossf-scorecard-sdk#readme", "devDependencies": { - "@nodesecure/eslint-config": "^1.5.0", + "@nodesecure/eslint-config": "^1.7.0", "@slimio/is": "^2.0.0", - "@types/node": "^18.11.9", - "c8": "^7.12.0", - "eslint": "^8.26.0", + "@types/node": "^18.15.11", + "c8": "^7.13.0", + "eslint": "^8.38.0", "globstar": "^1.0.0", "is-svg": "^5.0.0", "ts-node": "^10.9.1", - "tsx": "^3.12.4", - "typescript": "^4.8.4" + "tsx": "^3.12.6", + "typescript": "^5.0.4" }, "dependencies": { - "undici": "^5.14.0" + "undici": "^5.21.2" } } diff --git a/test/badge.spec.ts b/test/badge.spec.ts index e393e6a..6425274 100644 --- a/test/badge.spec.ts +++ b/test/badge.spec.ts @@ -1,7 +1,9 @@ +// Import Node.js Dependencies +import assert from "node:assert"; +import { after, afterEach, before, beforeEach, describe, it } from "node:test"; + // Import Third-party Dependencies -import assert from 'node:assert'; -import { after, afterEach, before, beforeEach, describe, it } from 'node:test' -import Undici, { Interceptable } from 'undici'; +import Undici, { Interceptable } from "undici"; import isSvg from "is-svg"; import is from "@slimio/is"; @@ -58,9 +60,9 @@ describe("#badge() FT", () => { assert.equal(is.plainObject(result), true); assert.equal(isSvg(result.svg), true); - + const imageUrl = new URL(result.image); - assert.strictEqual(imageUrl.origin, "https://img.shields.io"); + assert.strictEqual(imageUrl.origin, "https://img.shields.io"); }); it("should throw an error for an unknown repository", async() => { @@ -68,9 +70,9 @@ describe("#badge() FT", () => { scorecard.badge("NodeSecure/foobar"), { name: "Error", - message : "Invalid repo path" + message: "Invalid repo path" } - ) + ); }); }); diff --git a/test/index.ts b/test/index.ts deleted file mode 100644 index 88673e6..0000000 --- a/test/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -import fs from "node:fs/promises"; - -async function* findTestFiles(url) { - for await (const dirent of await fs.opendir(url)) { - if (dirent.name === "node_modules" || dirent.name.startsWith(".")) { - continue; - } - - if (dirent.isDirectory()) { - yield* findTestFiles(new URL(`${dirent.name}/`, url)); - } - else if (dirent.name.endsWith(".spec.ts")) { - yield new URL(dirent.name, url); - } - } -} - -for await (const file of findTestFiles(new URL("../", import.meta.url))) { - await import(file); -} \ No newline at end of file diff --git a/test/result.spec.ts b/test/result.spec.ts index 50cb5c7..7a96cc1 100644 --- a/test/result.spec.ts +++ b/test/result.spec.ts @@ -1,9 +1,10 @@ -// Import Third-party Dependencies +// Import Node.js Dependencies import assert from "node:assert"; -import Undici, { Interceptable } from "undici"; import { after, afterEach, before, beforeEach, describe, it } from "node:test"; -import is from "@slimio/is"; +// Import Third-party Dependencies +import Undici, { Interceptable } from "undici"; +import is from "@slimio/is"; // Import Internal Dependencies import * as scorecard from "../src/index.js"; @@ -61,9 +62,9 @@ describe("#result() UT", () => { scorecard.result(expectedRepository), { name: "Error", - message : "Not Found" + message: "Not Found" } - ) + ); }); });