File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { assert , assertEquals } from "deno/testing/asserts.ts"
1+ import { assert , assertEquals , assertFalse } from "deno/testing/asserts.ts"
22import { useTestConfig } from "./useTestConfig.ts"
33import { _internals } from "../utils/host.ts"
44import { stub } from "deno/testing/mock.ts"
@@ -47,3 +47,13 @@ Deno.test("runtime.env", async () => {
4747
4848 _config_internals . reset ( )
4949} )
50+
51+ Deno . test ( "missing()" , ( ) => {
52+ useTestConfig ( { TEA_PANTRY_PATH : "/a" } )
53+ assert ( usePantry ( ) . missing ( ) )
54+ } )
55+
56+ Deno . test ( "!missing()" , ( ) => {
57+ useTestConfig ( )
58+ assertFalse ( usePantry ( ) . missing ( ) )
59+ } )
Original file line number Diff line number Diff line change @@ -181,7 +181,17 @@ export default function usePantry() {
181181 return undefined
182182 }
183183
184- const missing = ( ) => ! pantry_paths ( ) . some ( x => x . exists ( ) )
184+ const missing = ( ) => {
185+ try {
186+ return ! pantry_paths ( ) . some ( x => x . exists ( ) )
187+ } catch ( e ) {
188+ if ( e instanceof PantryNotFoundError ) {
189+ return false
190+ } else {
191+ throw e
192+ }
193+ }
194+ }
185195
186196 const neglected = ( ) => {
187197 if ( ! prefix . exists ( ) ) return true
You can’t perform that action at this time.
0 commit comments