Skip to content

Windows: Multiple issues with Vitest integration and Oxlint in Bit 2.0.11 #10480

Closed

Description

@rvnlord

Summary

1. bit test / bit build incorrectly report "no tests found" on Windows

Tests execute successfully and Vitest reports them as passing, but Bit reports that the tested components have no tests.

I traced the cause of this to @teambit/vite.vite-tester (config-utils.ts), where Windows paths generated with path.resolve() are compared using minimatch, which expects forward slashes.


2. bit test --coverage reports 0% coverage despite that Vitest executes tests successfully

Regardless of whether the istanbul or v8 provider is used, running tests through Bit always reports 0% coverage.

Running the exact same vitest.config.mjs directly with Vitest produces the correct coverage report.

This happens even in a completely fresh Bit workspace without any custom Vitest configuration.


3. teambit.defender/linter:OxlintLint fatally stops bit build

A brand new workspace fails during bit build --skip-tests because OxlintLint throws.

On a fresh project it fails with:

Failed to spawn tsgolint ... %1 is not a valid Win32 application. (OS error 193)

On an existing workspace it fails with:

spawn ENAMETOOLONG

Both errors terminate the build.


Environment

  • Windows 10 / Windows 11
  • Bit v2.0.11 (also tested on v2.0.2, it had these problems, as well as a few others that are already fixed)
  • Node.js >= v22.16 (tested on v22.16 and v25.5)
  • Clean pnpm store
  • Fresh installation (no custom Vitest configuration required to reproduce)
  • Fresh workspace

Issue 1: bit test reports "no tests found"

Vitest executes tests successfully:

✓ projects/converters/string-converter/string-converter.spec.ts (1 test)

But Bit reports:

3 components have no tests
   › projects/apps/react-frontend
   › projects/converters/string-converter
   › projects/envs/my-react-env

no tests found (3 components, none with tests)

Root cause

I traced this to @teambit/vite.vite-tester, config-utils.ts, at line 31.

Current implementation:

const resolvePatternEntry = (patternEntry: ComponentPatternsEntry) => {
  const { componentDir, paths } = patternEntry;

  return paths.map((p) => {
    if (p.relative.startsWith('!')) {
      return `!${componentDir}/${p.relative.slice(1)}`;
    }

    return resolve(componentDir, p.path);
  });
}

On Windows:

resolve(...)

returns paths using backslashes.

Those paths are later matched with minimatch, which expects forward slashes.

Changing it to:

return resolve(componentDir, p.path).replace(/\\/g, '/');

fixes the issue locally.

Additional observations

When investigating, I noticed two more problems in the same file.

getCoverageInclude() has the same path normalization problem

It looks like the mirror image of the issue above.

customPatterns appear to be silently discarded

Current code:

if (customPatterns && !isEmpty(customPatterns)) {
  customPatterns.map((customPattern) => {
    const rootDirs = opts.roots || [patternEntry.componentDir];
    return resolvePattern(customPattern, rootDirs);
  });
}

The result of map() is never returned or used, so all custom patterns are ignored.

These are separate issues from the "no tests found" bug.


Issue 2: Coverage is always reported as 0%

Running through Bit:

bit test --coverage --verbose --debug

produces:

 RUN  v4.1.10 G:/Moje Pliki/Programowanie/TypeScript/Bit2
      Coverage enabled with istanbul

 ✓ projects/converters/string-converter/string-converter.spec.ts (1 test) 5ms
   ✓ StringConverter (1)
     ✓ isNumber (1)
       ✓ should return true for a valid integer 3ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  23:00:37
   Duration  1.78s (transform 279ms, setup 452ms, import 17ms, tests 5ms, environment 1.03s)

 % Coverage report from istanbul
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |
----------|---------|----------|---------|---------|-------------------

This happens regardless of whether the coverage provider is:

  • istanbul
  • v8

After fixing Issue 1 locally, the coverage problem still remains.

But, running Vitest directly with the exact same configuration:

npx vitest run --config projects/envs/my-react-env/config/vitest.config.mjs --coverage --reporter verbose

produces the expected result:

 RUN  v4.1.10 G:/Moje Pliki/Programowanie/TypeScript/Bit2
      Coverage enabled with istanbul

 ✓ projects/converters/string-converter/string-converter.spec.ts > StringConverter > isNumber > should return true for a valid integer 3ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  04:38:06
   Duration  6.45s (transform 409ms, setup 652ms, import 364ms, tests 5ms, environment 4.97s)

 % Coverage report from istanbul
---------------------|---------|----------|---------|---------|-------------------
File                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------|---------|----------|---------|---------|-------------------
All files            |      75 |     87.5 |     100 |      75 |
 string-converter.ts |      75 |     87.5 |     100 |      75 | 4
---------------------|---------|----------|---------|---------|-------------------

So:

  • the tests execute correctly,
  • the configuration is correct,
  • Vitest itself generates correct coverage,

but invoking the same configuration through Bit always produces an empty coverage report.


Issue 3: OxlintLint prevents builds

Running

bit build --skip-tests

in a fresh workspace fails with:

× env: projects/envs/my-react-env, task "teambit.defender/linter:OxlintLint" threw an error
oxlint returned non-JSON output:
Error running tsgolint: "Failed to spawn tsgolint from path `G:\\Moje Pliki\\Programowanie\\TypeScript\\Bit2\\node_modules\\.pnpm\\[email protected]\\node_modules\\oxlint-tsgolint\\bin\\tsgolint.js`, with error: %1 is not a valid Win32 application. (OS error 193)". (os error 193)"

In an existing workspace another fatal error occurs:

× env: projects/commonlib/envs/my-react-env, task "teambit.defender/linter:OxlintLint" threw an error Command failed with ENAMETOOLONG: G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\[email protected][email protected]\node_modules\oxlint\bin\oxlint C:\Users\<User>\AppData\Local\Bit\capsules\2c2020618\projects_commonlib_components_my-css-grid\index.ts C:\Users\<User>\AppData\Local\Bit\capsules\2c2020618\projects_commonlib_components_my-css-grid\my-css-grid.composition.tsx (...) --type-aware --config=G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\@projects+commonlib.envs.my_5aa7f7ca1e9dd92cfb0f8436b1e31a21\node_modules\@projects\commonlib.envs.my-react-env\dist\config\oxlintrc.json --tsconfig=G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\@projects+commonlib.envs.my_5aa7f7ca1e9dd92cfb0f8436b1e31a21\node_modules\@projects\commonlib.envs.my-react-env\dist\config\tsconfig.json --format=json spawn ENAMETOOLONG

during the oxlint task.

Both errors terminate the build.


Steps to reproduce

Run:

bit init --default-scope projects
bit install
bit create react-env envs/my-react-env --aspect bitdev.react/react-env
bit create react-app apps/react-frontend --env projects/envs/my-react-env
bit create module converters/string-converter --env projects/envs/my-react-env

Replace the generated files with the following:

string-converter.ts

export class StringConverter {
    static isNumber(str: string): boolean {
        if (str === null || str === undefined || str.trim().length < 1 || str === "") {
            return false;
        }
        const num = Number(str);
        return !isNaN(num) && isFinite(num);
    }
}

string-converter.spec.ts

import { StringConverter } from "./string-converter.js";

describe("StringConverter", () => {
    describe("isNumber", () => {
        it("should return true for a valid integer", () => {
            expect(StringConverter.isNumber("123")).toBe(true);
        });
    });
});

index.ts

export { StringConverter } from "./string-converter.js";

string-converter.docs.mdx

---
labels: ['StringConverter', 'module']
description: 'A StringConverter module.'
---

A StringConverter module.

```ts
StringConverter();
```

Then run:

bit compile
bit envs
bit status
bit build --skip-tests
bit test --coverage --verbose --debug
npx vitest run --config projects/envs/my-react-env/config/vitest.config.mjs --coverage --reporter verbose

The full command output: reproduce - output.txt

Expected behaviour

  • bit test should correctly detect and report executed tests.
  • bit test --coverage should produce the same coverage report as running Vitest directly with the same configuration.
  • bit build should complete successfully in a newly created workspace without OxlintLint throwing fatal errors.

Actual behaviour

  • Bit reports tested components as having no tests.
  • Coverage is always reported as 0%.
  • OxlintLint throws fatal errors that stop the build.

Activity

  1. davidfirst commented on Jul 13, 2026

    @davidfirst
    Member

    Thanks for the thorough investigation and the root-cause pointers — that made this much faster to fix.

    All three issues are addressed in this Change Request: https://bit.cloud/teambit/vite/~change-requests/windows-vitest-oxlint-fixes

    Summary of the fixes:

    1. bit test reports "no tests found" on Windows — resolved test patterns were matched with minimatch using backslash paths, which never match. They're now normalized to forward slashes (at the source, so both the matching and the include paths are covered).

    2. bit test --coverage reports 0% — the coverage include globs were also built from backslash relative() paths. Normalizing those to forward slashes restores coverage. This was a separate spot from Jsdoc #1, which is why fixing Jsdoc #1 alone didn't bring coverage back. The silently-discarded custom patterns you spotted is fixed too.

    3. OxlintLint stops the build — oxlint now spawns the platform-native tsgolint binary instead of the .js launcher (fixes %1 is not a valid Win32 application, OS error 193), and the file list is split into batches per invocation to stay under the Windows command-line limit (fixes spawn ENAMETOOLONG).

    The fixes have been validated on Windows. The React env (bitdev.react/react-env) will be updated soon to pull in the fixed tester/linter versions.

  2. davidfirst commented on Jul 15, 2026

    @davidfirst
    Member

    This is now released.

    bitdev.react/[email protected] (along with the other affected envs) picks up the fixed Vitest tester and Oxlint linter — updating your env to that version should resolve all three issues:

    • bit test "no tests found" — resolved test patterns are now normalized to forward slashes, so minimatch matches on Windows.
    • bit test --coverage 0% — the coverage include globs are normalized too. This was a separate spot from the above, which is why fixing only the first one didn't bring coverage back. The silently-discarded custom patterns you spotted is fixed as well.
    • OxlintLint failing the build — oxlint now spawns the platform-native tsgolint binary instead of the .js launcher (fixes %1 is not a valid Win32 application, OS error 193), and the file list is split into batches per invocation to stay under the Windows command-line limit (fixes spawn ENAMETOOLONG).

    Details: https://bit.cloud/bitdev/react/~change-requests/update-react-env-windows-fixes

    Thanks again for the thorough investigation and root-cause pointers — they made this much faster to fix.

    Closing as completed; please reopen if anything still misbehaves on Windows.

  3. rvnlord commented on Jul 16, 2026

    @rvnlord
    Author

    First, I would like to thank you for looking into these issues promptly. Also, be aware that my responses might be delayed due to my RL situation.

    Additionally, you told me to reopen the issue if anything else surfaces but I don't have permissions to do that:

    Image

    In short, after updating the packages and physically verifying that the posix conversion is there:

    bit test commonlib/converters/string-converter --verbose --coverage

    • "no tests found" appears FIXED
    • coverage is still 0%
    PS G:\Moje Pliki\Programowanie\TypeScript\Bit> bit test commonlib/converters/string-converter --verbose --coverage
      testing total of 1 components in workspace 'Bit' 
      testing 1 components with environment projects/commonlib/envs/my-react-env 
    
    Vitest Config - Workspace Root: G:/Moje Pliki/Programowanie/TypeScript/Bit/node_modules/.pnpm/@projects+commonlib.envs.my_f71b726406240ae4633394edc0f80ddc
     
     RUN  v4.1.9 G:/Moje Pliki/Programowanie/TypeScript/Bit 
          Coverage enabled with istanbul
    
    Sourcemap for "G:/Moje Pliki/Programowanie/TypeScript/Bit/node_modules/@projects/commonlib.extensions.basic.string-extensions/dist/index.js" points to a source file outside its package: "G:/Moje Pliki/Programowanie/TypeScript/Bit/projects/commonlib/extensions/basic/string-extensions/index.ts"
    (...)
    Sourcemap for "G:/Moje Pliki/Programowanie/TypeScript/Bit/node_modules/@projects/commonlib.extensions.collections.ienumerable-extensions/dist/ienumerable-extensions.js" points to a source file outside its package: "G:/Moje Pliki/Programowanie/TypeScript/Bit/projects/commonlib/extensions/collections/ienumerable-extensions/ienumerable-extensions.ts"
     ✓ projects/commonlib/converters/string-converter/string-converter.spec.ts (32 tests) 16ms
       ✓ StringConverter (32)
         ✓ isBoolean (15)
           ✓ should return true for 'true' 4ms
           (...)
         ✓ isNumber (17)
           ✓ should return true for a valid integer 0ms
           (...)
    
     Test Files  1 passed (1)
          Tests  32 passed (32)
       Start at  21:43:45
       Duration  4.34s (transform 1.94s, setup 512ms, import 2.03s, tests 16ms, environment 1.43s)
    
     % Coverage report from istanbul 
    ----------|---------|----------|---------|---------|------------------- 
    File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
    ----------|---------|----------|---------|---------|-------------------
    All files |       0 |        0 |       0 |       0 | 
    ----------|---------|----------|---------|---------|-------------------
    
    =============================== Coverage summary ===============================
    Statements   : Unknown% ( 0/0 )
    Branches     : Unknown% ( 0/0 )
    Functions    : Unknown% ( 0/0 )
    Lines        : Unknown% ( 0/0 )
    ================================================================================
    
    test results
       ✓ projects/commonlib/converters/string-converter — 32 passed
    
    ✓ 32/32 tests passed across 1 components
    Finished. (13.326s)
    

    Working equivalent: npx vitest run commonlib/converters/string-converter --config projects/commonlib/envs/my-react-env/config/vitest.config.ts --coverage --reporter verbose

    If tests are nested - it still shows "no tests found":

    PS G:\Moje Pliki\Programowanie\TypeScript\Bit> bit test commonlib/envs/my-react-env --verbose
      testing total of 1 components in workspace 'Bit'
    
    1 components have no tests
       › projects/commonlib/envs/my-react-env
    
    no tests found (1 components, none with tests)
    Finished. (8.631s)
    
    Image

    This also means that if I run bit test with no arguments - it will ignore the nested tests altogether.

    There is a bunch of these warnings too (even without using any custom plugins - the source maps are in correct locations though):

    Sourcemap for "G:/Moje Pliki/Programowanie/TypeScript/Bit/node_modules/@projects/crimsonrelays.pages.test/dist/index.js" points to a source file outside its package: "G:/Moje Pliki/Programowanie/TypeScript/Bit/projects/crimsonrelays/pages/test/index.ts"
    Sourcemap for "G:/Moje Pliki/Programowanie/TypeScript/Bit/node_modules/@projects/crimsonrelays.pages.test/dist/test.js" points to a source file outside its package: "G:/Moje Pliki/Programowanie/TypeScript/Bit/projects/crimsonrelays/pages/test/test.tsx"
    

    With test.pool: "threads" tests won't even start:

    With this setting enabled, which is my preferred way of testing, bit build during the Vitest Task will just hang at "0 tests completed" until timeout.

    Error: The server is being restarted or closed. Request is outdated
      Plugin: vite:import-analysis 
      File: C:/Users/Aldaris/AppData/Local/Bit/capsules/2c2020618/node_modules/.pnpm/[email protected]/node_modules/linq-to-typescript/esm/async/_private/selectMany.js:1:38
      1  |  import { BasicAsyncEnumerable } from "../BasicAsyncEnumerable.js";
         |                                        ^
      2  |  export const selectMany = (source, selector) => {
      3  |      if (typeof selector === "function") {
    

    Current workaround is setting the following in defineConfig of vitest.config.ts:

    // Disable the dev-server file watcher: this is a one-shot run inside a Bit
    // build capsule, and other build tasks writing into the same capsule
    // directory were triggering Vite server restarts mid-test, which killed
    // in-flight module resolutions ("The server is being restarted or closed.
    // Request is outdated").
    server: {
        watch: null,
    },
    // Pre-bundle linq-to-typescript's full graph up front so Vite's optimizer
    // never "discovers" one of its deep internal files (e.g. esm/async/_private/
    // selectMany.js) mid-run and restarts to include it - that restart was the
    // other trigger for the outdated-request error.
    optimizeDeps: {
        include: ["linq-to-typescript"],
    },
    

    though the tests from inside the bit build will take an exceedingly long time for some reason.

    bit test will complete successfully without any workarounds (with 0% coverage and ignoring nested tests as mentioned before):

    20 components have no tests (run with --verbose to list)
    
    ✓ 381/381 tests passed across 22 components, 20 without tests
    Finished. (34.131s)
    

    At the same time, regardless of what I throw at native Vitest: nested tests, plugins, customizations, pool options, watcher, coverage, inline modules, VS Code extensions and so on - it just works.

    PS G:\Moje Pliki\Programowanie\TypeScript\Bit> npx vitest run --config projects/commonlib/envs/my-react-env/config/vitest.config.ts
    Vitest Config - Workspace Root: G:/Moje Pliki/Programowanie/TypeScript/Bit 
     
     RUN  v4.1.9 G:/Moje Pliki/Programowanie/TypeScript/Bit 
     
    Aliased Project Paths Mapper v4 
    APPM - Workspace Root: G:/Moje Pliki/Programowanie/TypeScript/Bit 
    APPM - resolveId() called 
    
     Test Files  23 passed (23) 
          Tests  472 passed (472) 
       Start at  20:49:33 
       Duration  72.39s (transform 14.77s, setup 18.22s, import 51.60s, tests 3.41s, environment 110.07s) 
    

    OxlintLint is still throwing an ENAMETOOLONG Error for @teambit/defender.linter v1.0.1064

    I assume that's because the framework is forcefully using @teambit/defender.linter present in C:\Users\<User>\AppData\Local\.bvm\versions\2.0.11\bit-2.0.11\node_modules\@teambit\linter which reports v1.0.1049 in its package.json and refuses to prioritise whatever I have installed in my workspace.

    Image

    I'm currently going insane trying to update and pin the newest versions:

    Package name mismatch found while reading {"integrity":"sha512-egubvNQMeJ6RNj7Xa6JaBvTPnjgnXi0NHlT6DvJlpXw7IVWQDS2qRygwdHwJC1rg07MIvyn/WIxyW4gZZ+HaOw==","tarball":"https://node-registry.bit.cloud/@teambit/defender.linter/-/defender.linter-1.0.1065.tgz"} from the store.
    
    This means that either the lockfile is broken or the package metadata (name and version) inside the package's package.json file doesn't match the metadata in the registry. Expected package: @teambit/[email protected]. Actual package in the store with the given integrity: @teambit/[email protected].
    
    If you want to ignore this issue, set the strict-store-pkg-content-check to false.
    
    This error happened while installing a direct dependency of G:\Moje Pliki\Programowanie\TypeScript\Bit
    
    "overrides": {
        "canvas": "^3.2.3",
        "@types/node": "25.5.0",
        "vite": "8.1.3",
        "vitest": "4.1.9",
        "@bitdev/react.react-env>@types/node": "25.5.0",
        "@teambit/defender.linter": "1.0.1065",
        "@teambit/oxc.linter.oxlint-linter": "2.0.6",
        "@bitdev/general.envs.bit-env": "5.0.13",
        "oxlint": "^1.74.0",
        "@bitdev/react.react-env": "6.0.21",
        "@oxlint-tsgolint/win32-x64": "0.24.0"
    },
    
  4. davidfirst commented on Sep 17, 2026

    @davidfirst
    Member

    @rvnlord, sorry, for some reason I overlooked your last response here. Checking now.

  5. GiladShoham commented on Sep 17, 2026

    @GiladShoham
    Member

    @davidfirst we recently updated the oxlint tools but we need to bump the version in the envs (we need of course to validate it all works fine). we also did some more optimizations in our side to improve performance and stability of it.
    see here - https://bit.cloud/teambit/oxc/linter/oxlint-linter/~compare?baseVersion=2.0.7

    @rvnlord fyi

  6. davidfirst commented on Sep 18, 2026

    @davidfirst
    Member

    @rvnlord The 0% coverage was already fixed in @teambit/[email protected], released at the end of July. What was missing is that no env had picked it up — react-env was still on 0.4.16, so the fix never reached you.

    That part is now done. All envs ship the 0.4.17 tester plus the newer Oxlint linter (2.0.8, including the performance and stability work @GiladShoham mentioned above):

    Since you use a custom env (projects/commonlib/envs/my-react-env), update its dependency on @bitdev/react.react-env to 6.0.29 and run bit install — the tester version comes from the env.

    Verified on a clean workspace with a component and spec like your string-converter, both directly on [email protected] and through a custom env extending it:

     ✓ string-converter.spec.ts (3 tests)
     % Coverage report from istanbul
     All files | 100 | 90 | 100 | 100
    

    bit lint runs clean with the new linter as well. This check ran on macOS — the Windows path fixes landed in 0.4.16, which you confirmed resolved "no tests found", and the coverage part is platform-independent. If anything still misbehaves on Windows, comment here and we'll reopen it for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions