Skip to content

Conversation

@liskin
Copy link
Contributor

@liskin liskin commented Oct 18, 2025

Quite often I get errors like this one:

ERROR | 2025-10-18T18:40:14Z+0100 | ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:309 | Couldn't find positions in path <redacted> ...tart/neotest-vstest/lua/neotest-vstest/vstest/client.lua:44: Expected value but found unexpected end of string at character 292
stack traceback:
        [C]: in function 'decode'
        ...tart/neotest-vstest/lua/neotest-vstest/vstest/client.lua:44: in function 'discover_tests_in_project'
        .../start/neotest-vstest/lua/neotest-vstest/vstest/init.lua:34: in function 'discover_tests'
        ...undle/start/neotest-vstest/lua/neotest-vstest/client.lua:39: in function 'discover_tests'
        .../bundle/start/neotest-vstest/lua/neotest-vstest/init.lua:299: in function 'discover_positions'
        ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:300: in function <...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:264>
        [C]: in function 'xpcall'
        ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:264: in function '_update_positions'
        ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:317: in function <...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:315>

I think that's because the test discovery doesn't flush the outputFile before signalling back by writing "1" to the waitFile. Using using to dispose of the outputFile StreamWriter seems to fix this — I don't get those errors any more.

Quite often I get errors like this one:

    ERROR | 2025-10-18T18:40:14Z+0100 | ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:309 | Couldn't find positions in path <redacted> ...tart/neotest-vstest/lua/neotest-vstest/vstest/client.lua:44: Expected value but found unexpected end of string at character 292
    stack traceback:
            [C]: in function 'decode'
            ...tart/neotest-vstest/lua/neotest-vstest/vstest/client.lua:44: in function 'discover_tests_in_project'
            .../start/neotest-vstest/lua/neotest-vstest/vstest/init.lua:34: in function 'discover_tests'
            ...undle/start/neotest-vstest/lua/neotest-vstest/client.lua:39: in function 'discover_tests'
            .../bundle/start/neotest-vstest/lua/neotest-vstest/init.lua:299: in function 'discover_positions'
            ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:300: in function <...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:264>
            [C]: in function 'xpcall'
            ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:264: in function '_update_positions'
            ...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:317: in function <...te/pack/bundle/start/neotest/lua/neotest/client/init.lua:315>

I think that's because the test discovery doesn't flush the `outputFile`
before signalling back by writing "1" to the `waitFile`. Using `using`
to dispose of the `outputFile` `StreamWriter` seems to fix this — I
don't get those errors any more.
@Dynge
Copy link
Contributor

Dynge commented Oct 19, 2025

Looks good to me. :)

@Nsidorenco
Copy link
Owner

Makes a lot of sense - Thank you for investigating this

@Nsidorenco Nsidorenco merged commit 31fdda9 into Nsidorenco:main Oct 19, 2025
6 checks passed
@liskin liskin deleted the fix-test-discovery branch October 19, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants