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

--ui attempts to load .vue files unrelated to test #485

Closed
6 tasks done
DerYeger opened this issue Jan 8, 2022 · 9 comments · Fixed by #1104
Closed
6 tasks done

--ui attempts to load .vue files unrelated to test #485

DerYeger opened this issue Jan 8, 2022 · 9 comments · Fixed by #1104
Labels
feat: ui Vitest UI

Comments

@DerYeger
Copy link
Member

DerYeger commented Jan 8, 2022

Describe the bug

Attempting to open the use the UI with --ui causes Vitest to load .vue files unrelated to the tests (from the docs in particular).

The following errors are printed:

error: No loader is configured for ".vue" files: demo/components/App.vue
[
    {
      detail: undefined,
      location: {
        column: 16,
        file: 'demo/main.ts',
        length: 25,
        line: 1,
        lineText: "import App from 'demo/components/App.vue'",
        namespace: '',
        suggestion: ''
      },
      notes: [],
      pluginName: '',
      text: 'No loader is configured for ".vue" files: demo/components/App.vue'
    }
],

demo/main.ts is not referenced in the source code or any test.

Reproduction

Repository with reproduction: https://github.com/DerYeger/d3-graph-controller

Can be reproduced by running the test with yarn test:watch --ui.

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor            
    Memory: 16.04 GB / 31.92 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.20.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (96.0.1054.62)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @vitejs/plugin-vue: 2.0.1 => 2.0.1 
    vite: 2.7.10 => 2.7.10 
    vitest: 0.0.139 => 0.0.139

Used Package Manager

yarn

Validations

@edimitchel
Copy link
Member

Hi, is that issue still a problem?

@DerYeger
Copy link
Member Author

Yes. Running yarn test:watch --ui in the repository linked above results in the same error.
I tried it with v0.2.3 without success.

@edimitchel
Copy link
Member

Ok, I'll try to see what is going wrong.

@sheremet-va
Copy link
Member

Is it still happening?

@DerYeger
Copy link
Member Author

Is it still happening?

Yes, just tested it with v0.4.2.

@DerYeger
Copy link
Member Author

DerYeger commented Feb 21, 2022

It's seemingly related to the file names.

After renaming demo/main.ts the error no longer occurs.
However, the UI still doesn't work. I also renamed src/main.ts, but that didn't help.
There's no error, but the UI does open either.

@DerYeger
Copy link
Member Author

I just noticed the v0.5.0 release.

After updating to that version, I do get the message that the UI was started, but the UI still is a 404.

@edimitchel edimitchel added the feat: ui Vitest UI label Mar 15, 2022
@sheremet-va
Copy link
Member

sheremet-va commented Apr 5, 2022

So, this happens because:

By default, Vite will crawl all your .html files to detect dependencies that need to be pre-bundled (ignoring node_modules, build.outDir, tests and coverage). If build.rollupOptions.input is specified, Vite will crawl those entry points instead.

We had it disabled, but removed some time ago - #641 🤔

So, if you do optimizeDeps: { entries: [] }, you won't get the error (maybe apply it conditionally with mode === 'test'). This is a temporary solution, until we find a proper fix

@sheremet-va
Copy link
Member

We had it disabled, but removed some time ago - #641 🤔

Turns out optimizeDeps: undefined doesn't disable optimization, I guess thats why this patch was made. But optimizeDeps: { entries: [] } does disable it, opened a PR #1104

@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: ui Vitest UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants