Skip to content

Commit

Permalink
chore: test the nupm installation (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine authored Nov 3, 2023
1 parent 0375379 commit 33ffb98
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,24 @@ jobs:
with:
version: '0.86'

- name: Install Nupm from Source
run: git clone --depth 1 https://github.com/nushell/nupm ~/nupm/
- name: Download the source of Nupm
run: git clone --depth 1 https://github.com/nushell/nupm /tmp/nupm/

- name: Install Nupm
run: |
use /tmp/nupm/nupm
with-env {NUPM_HOME: ("~/.local/share/nupm" | path expand)} {
# FIXME: use --no-confirm option
# related to https://github.com/nushell/nupm/pull/42
mkdir ("~/.local/share/nupm" | path expand)
nupm install --force --path /tmp/nupm
}
- name: Show Nushell Version
run: version

- name: Run the tests
run: |
use ~/nupm/nupm/
# FIXME: is there a way to not rely on hardcoded paths here?
use ~/.local/share/nupm/modules/nupm
nupm test
17 changes: 17 additions & 0 deletions tests/mod.nu
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,20 @@ export def cache-manipulation [] {

rm --recursive --verbose --force $CACHE_DIR
}

export def install-package [] {
# FIXME: is there a way to not rely on hardcoded paths here?
use ~/.local/share/nupm/modules/nupm

with-env {NUPM_HOME: ($nu.temp-path | path join "nu-git-manager/tests" (random uuid))} {
# FIXME: use --no-confirm option
# related to https://github.com/nushell/nupm/pull/42
mkdir $env.NUPM_HOME;
nupm install --path .

assert length (ls ($env.NUPM_HOME | path join "scripts")) 0
assert equal (ls ($env.NUPM_HOME | path join "modules") --short-names | get name) [nu-git-manager, nu-git-manager-sugar]

rm --recursive --force --verbose $env.NUPM_HOME
}
}

0 comments on commit 33ffb98

Please sign in to comment.