1
1
import * as path from "path" ;
2
+ import * as fs from "fs" ;
2
3
import { isDirectory , isFile , runJsr , withTempEnv } from "./test_utils" ;
3
4
import * as assert from "node:assert/strict" ;
4
5
5
6
describe ( "install" , ( ) => {
6
7
it ( "jsr i @std/encoding - resolve latest version" , async ( ) => {
7
8
await withTempEnv ( [ "i" , "@std/encoding" ] , async ( getPkgJson , dir ) => {
8
9
const pkgJson = await getPkgJson ( ) ;
9
- assert (
10
+ assert . ok (
10
11
pkgJson . dependencies && "@std/encoding" in pkgJson . dependencies ,
11
12
"Missing dependency entry"
12
13
) ;
@@ -17,7 +18,14 @@ describe("install", () => {
17
18
) ;
18
19
19
20
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
+ ) ;
21
29
} ) ;
22
30
} ) ;
23
31
@@ -96,7 +104,7 @@ describe("install", () => {
96
104
await withTempEnv (
97
105
[ "i" , "--npm" , "@std/[email protected] " ] ,
98
106
async ( _ , dir ) => {
99
- assert (
107
+ assert . ok (
100
108
await isFile ( path . join ( dir , "package-lock.json" ) ) ,
101
109
"npm lockfile not created"
102
110
) ;
@@ -108,7 +116,7 @@ describe("install", () => {
108
116
await withTempEnv (
109
117
[ "i" , "--yarn" , "@std/[email protected] " ] ,
110
118
async ( _ , dir ) => {
111
- assert (
119
+ assert . ok (
112
120
await isFile ( path . join ( dir , "yarn.lock" ) ) ,
113
121
"yarn lockfile not created"
114
122
) ;
@@ -120,7 +128,7 @@ describe("install", () => {
120
128
await withTempEnv (
121
129
[ "i" , "--pnpm" , "@std/[email protected] " ] ,
122
130
async ( _ , dir ) => {
123
- assert (
131
+ assert . ok (
124
132
await isFile ( path . join ( dir , "pnpm-lock.yaml" ) ) ,
125
133
"pnpm lockfile not created"
126
134
) ;
@@ -140,7 +148,7 @@ describe("remove", () => {
140
148
assert . equal ( pkgJson . dependencies , undefined ) ;
141
149
142
150
const depPath = path . join ( dir , "node_modules" , "@std" , "encoding" ) ;
143
- assert (
151
+ assert . ok (
144
152
! ( await isDirectory ( depPath ) ) ,
145
153
"Folder in node_modules not removed"
146
154
) ;
0 commit comments