From c63158d2d104e18b9d38d818701e1e232a37d157 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Tue, 20 Feb 2024 21:39:17 +0100 Subject: [PATCH] chore: fix tests --- test/{install.test.ts => commands.test.ts} | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) rename test/{install.test.ts => commands.test.ts} (96%) diff --git a/test/install.test.ts b/test/commands.test.ts similarity index 96% rename from test/install.test.ts rename to test/commands.test.ts index 080b0c9..3545660 100644 --- a/test/install.test.ts +++ b/test/commands.test.ts @@ -1,14 +1,13 @@ import { describe, it } from "node:test"; -import * as fs from "fs"; import * as path from "path"; import { isDirectory, isFile, runJsr, withTempEnv } from "./test_utils"; -import * as assert from "node:assert/strict"; +import * as assert from "node:assert"; describe("install", () => { it("jsr i @std/encoding - resolve latest version", async () => { await withTempEnv(["i", "@std/encoding"], async (getPkgJson, dir) => { const pkgJson = await getPkgJson(); - assert( + assert.ok( pkgJson.dependencies && "@std/encoding" in pkgJson.dependencies, "Missing dependency entry" ); @@ -19,7 +18,7 @@ describe("install", () => { ); const depPath = path.join(dir, "node_modules", "@std", "encoding"); - assert(await isDirectory(depPath), "Not installed in node_modules"); + assert.ok(await isDirectory(depPath), "Not installed in node_modules"); }); }); @@ -98,7 +97,7 @@ describe("install", () => { await withTempEnv( ["i", "--npm", "@std/encoding@0.216.0"], async (_, dir) => { - assert( + assert.ok( await isFile(path.join(dir, "package-lock.json")), "npm lockfile not created" ); @@ -110,7 +109,7 @@ describe("install", () => { await withTempEnv( ["i", "--yarn", "@std/encoding@0.216.0"], async (_, dir) => { - assert( + assert.ok( await isFile(path.join(dir, "yarn.lock")), "yarn lockfile not created" ); @@ -122,7 +121,7 @@ describe("install", () => { await withTempEnv( ["i", "--pnpm", "@std/encoding@0.216.0"], async (_, dir) => { - assert( + assert.ok( await isFile(path.join(dir, "pnpm-lock.yaml")), "pnpm lockfile not created" ); @@ -142,7 +141,7 @@ describe("remove", () => { assert.equal(pkgJson.dependencies, undefined); const depPath = path.join(dir, "node_modules", "@std", "encoding"); - assert( + assert.ok( !(await isDirectory(depPath)), "Folder in node_modules not removed" );