Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(automation): Add startuptime test to the nvim tests #49

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" ]
}