Skip to content

Infra: refactor global snap test #2032

Description

@liangmiQwQ

At the moment, Vite+ runs global snap test with the real Vite+ installed on the contributor's computer, and real VP_HOME (~/.vite-plus). It means every test command which runs vp is nothing different from directly running vp in the terminal.

This can make problems:

  1. Some commands' output will be influenced by contributors' environment. Like vp list -g, vp env list -g, vp env outdated -g.
  2. Running some commands will modify contributors Vite+ setting and environment. Like vp install -g, vp env default. Even if it's cleaned after the test completed, there might still something left. (Like vp env default, we only set to lts)

Personally, I've already met some cases, where I want to use global snap test, but I can't considering contributors' computer environment #1659 (comment) #1698 (comment) #2003 (comment)

To improve that, I suggest to install Vite+ in another place for global snap tests, and use fake VP_HOME, and we will have two implementation method:

  1. Use custom VP_HOME. It's direct but probably not stable (Just fixed some in fix(global): respect custom VP_HOME #2029, Vite+ still falls back to ~/.vite-plus for some cases)
  2. Custom HOME. So Vite+ can still install into $HOME/.vite-plus.

@jong-kyung @fengmk2 Have you ever met similar situations? WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions