Skip to content

Commit

Permalink
feat(automation): Add startuptime test to the nvim tests (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
steinbrueckri authored Sep 16, 2024
1 parent 6ccc884 commit b9a1871
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ RUN git clone https://github.com/bats-core/bats-support.git /opt/bats-support &&
git clone https://github.com/bats-core/bats-core.git /opt/bats && \
/opt/bats/install.sh /usr/local


# Install zyedidia/eget, to install github release like nothing
RUN cd /usr/local/bin && curl https://zyedidia.github.io/eget.sh | sh

# Install rhysd/vim-startuptime
RUN eget rhysd/vim-startuptime --to=/usr/local/bin

# Create a new user
RUN useradd -ms /bin/bash -G sudo testuser
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
Expand Down
17 changes: 17 additions & 0 deletions .tests/2_nvim.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ load '/opt/bats-file/load'
assert_exists "$HOME/.local/share/nvim/lazy/telescope.nvim/lua/telescope/init.lua"
}

@test "bootstrap TSInstall " {
run nvim --headless "+TSInstallSync all" +qall!
assert_success
}

# NOTE: Test is a bit flary because of that the retry
@test "Install all LSPs with Mason" {
# Define a list of LSPs to be installed
Expand Down Expand Up @@ -79,3 +84,15 @@ load '/opt/bats-file/load'
refute_line 'ERROR isort: the command "isort" is not executable.'
refute_line 'ERROR markdownlint: the command "markdownlint" is not executable.'
}

@test "Average startuptime is below 12 msec" {
LOG_FILE="vim-startuptime.log"
run vim-startuptime -vimpath nvim > $LOG_FILE
total_avg=$(grep "Total Average:" "$LOG_FILE" | awk '{print $3}')
total_avg_rounded=$(printf "%.0f" $total_avg)

limit=150

assert_success
assert [ "$total_avg_rounded" -lt "$limit" ]
}

0 comments on commit b9a1871

Please sign in to comment.