11import * as path from "path" ;
2+ import * as fs from "fs" ;
23import { isDirectory , isFile , runJsr , withTempEnv } from "./test_utils" ;
34import * as assert from "node:assert/strict" ;
45
56describe ( "install" , ( ) => {
67 it ( "jsr i @std/encoding - resolve latest version" , async ( ) => {
78 await withTempEnv ( [ "i" , "@std/encoding" ] , async ( getPkgJson , dir ) => {
89 const pkgJson = await getPkgJson ( ) ;
9- assert (
10+ assert . ok (
1011 pkgJson . dependencies && "@std/encoding" in pkgJson . dependencies ,
1112 "Missing dependency entry"
1213 ) ;
@@ -17,7 +18,14 @@ describe("install", () => {
1718 ) ;
1819
1920 const depPath = path . join ( dir , "node_modules" , "@std" , "encoding" ) ;
20- assert ( await isDirectory ( depPath ) , "Not installed in node_modules" ) ;
21+ assert . ok ( await isDirectory ( depPath ) , "Not installed in node_modules" ) ;
22+
23+ const npmrcPath = path . join ( dir , ".npmrc" ) ;
24+ const npmRc = await fs . promises . readFile ( npmrcPath , "utf-8" ) ;
25+ assert . ok (
26+ npmRc . includes ( "@jsr:registry=https://npm.jsr.io" ) ,
27+ "Missing npmrc registry"
28+ ) ;
2129 } ) ;
2230 } ) ;
2331
@@ -96,7 +104,7 @@ describe("install", () => {
96104 await withTempEnv (
97105 [ "i" , "--npm" , "@std/[email protected] " ] , 98106 async ( _ , dir ) => {
99- assert (
107+ assert . ok (
100108 await isFile ( path . join ( dir , "package-lock.json" ) ) ,
101109 "npm lockfile not created"
102110 ) ;
@@ -108,7 +116,7 @@ describe("install", () => {
108116 await withTempEnv (
109117 [ "i" , "--yarn" , "@std/[email protected] " ] , 110118 async ( _ , dir ) => {
111- assert (
119+ assert . ok (
112120 await isFile ( path . join ( dir , "yarn.lock" ) ) ,
113121 "yarn lockfile not created"
114122 ) ;
@@ -120,7 +128,7 @@ describe("install", () => {
120128 await withTempEnv (
121129 [ "i" , "--pnpm" , "@std/[email protected] " ] , 122130 async ( _ , dir ) => {
123- assert (
131+ assert . ok (
124132 await isFile ( path . join ( dir , "pnpm-lock.yaml" ) ) ,
125133 "pnpm lockfile not created"
126134 ) ;
@@ -140,7 +148,7 @@ describe("remove", () => {
140148 assert . equal ( pkgJson . dependencies , undefined ) ;
141149
142150 const depPath = path . join ( dir , "node_modules" , "@std" , "encoding" ) ;
143- assert (
151+ assert . ok (
144152 ! ( await isDirectory ( depPath ) ) ,
145153 "Folder in node_modules not removed"
146154 ) ;
0 commit comments