Skip to content

Commit faa76f7

Browse files
authored
Fix deprecated get -i flag; Fix unreliable test (#125)
* Replaces the deprecated `get -i` with `get -o` * `$env.NUPM_REGISTRIES` is set on `nupm` startup by reading the index file. If the index file contains some custom entries, testing it for the default value would fail. Now the test just checks if the default value is present. cc #122
1 parent 7f95181 commit faa76f7

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- uses: hustcer/[email protected]
3030
with:
31-
version: "0.105.1"
31+
version: "0.106.1"
3232

3333
- name: Show Nushell Version
3434
run: version

nupm/publish.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def guess-revision []: nothing -> string {
222222

223223
def get-registry-path []: string -> path {
224224
let registry = $in
225-
$env.NUPM_REGISTRIES | get -i $registry | default ($registry | path expand)
225+
$env.NUPM_REGISTRIES | get -o $registry | default ($registry | path expand)
226226
}
227227

228228
def open-registry-file []: path -> table<name: string, path: string, url: string> {

nupm/utils/package.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export def open-package-file [dir: path] {
2020
log debug "checking package file for missing required keys"
2121
let required_keys = [$. $.name $.version $.type]
2222
let missing_keys = $required_keys
23-
| where {|key| ($package | get -i $key) == null}
23+
| where {|key| ($package | get -o $key) == null}
2424
if not ($missing_keys | is-empty) {
2525
throw-error "invalid_package_file" (
2626
$"($package_file) is missing the following required keys:"

tests/mod.nu

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ export def env-vars-are-set [] {
146146
assert equal $env.NUPM_HOME $dirs.DEFAULT_NUPM_HOME
147147
assert equal $env.NUPM_TEMP $dirs.DEFAULT_NUPM_TEMP
148148
assert equal $env.NUPM_CACHE $dirs.DEFAULT_NUPM_CACHE
149-
assert equal $env.NUPM_REGISTRIES $dirs.DEFAULT_NUPM_REGISTRIES
149+
(assert equal
150+
$env.NUPM_REGISTRIES
151+
($env.NUPM_REGISTRIES | merge $dirs.DEFAULT_NUPM_REGISTRIES))
150152
}
151153

152154
export def generate-local-registry [] {

0 commit comments

Comments
 (0)