Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Feb 20, 2024
1 parent 1931759 commit c63158d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions test/install.test.ts → test/commands.test.ts
Original file line number Diff line number Diff line change
@@ -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"
);
Expand All @@ -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");
});
});

Expand Down Expand Up @@ -98,7 +97,7 @@ describe("install", () => {
await withTempEnv(
["i", "--npm", "@std/[email protected]"],
async (_, dir) => {
assert(
assert.ok(
await isFile(path.join(dir, "package-lock.json")),
"npm lockfile not created"
);
Expand All @@ -110,7 +109,7 @@ describe("install", () => {
await withTempEnv(
["i", "--yarn", "@std/[email protected]"],
async (_, dir) => {
assert(
assert.ok(
await isFile(path.join(dir, "yarn.lock")),
"yarn lockfile not created"
);
Expand All @@ -122,7 +121,7 @@ describe("install", () => {
await withTempEnv(
["i", "--pnpm", "@std/[email protected]"],
async (_, dir) => {
assert(
assert.ok(
await isFile(path.join(dir, "pnpm-lock.yaml")),
"pnpm lockfile not created"
);
Expand All @@ -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"
);
Expand Down

0 comments on commit c63158d

Please sign in to comment.