melos icon indicating copy to clipboard operation
melos copied to clipboard

fix: Tests Failing in Windows Environment

Open jessicatarra opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Version

main

Description

Currently, there are two issues related to the Windows environment:

  1. The status codes when running some melos commands are not reliable. For example, the command melos test --no-select is expected to be the same as running melos exec --dir-exists=test --concurrency 1 -- "dart test". However, using the latter command directly provides the actual exit code of the process in windows environment pipeline, while the former does not.

  2. Due to the recent fix to maintain the working directory across script steps, as merged in PR #711, the log output will look like the following one:

'Microsoft Windows [Version 10.0.20348.2655]\n'
              '(c) Microsoft Corporation. All rights reserved.\n'
              '\n'
              'd:\\a\\melos\\melos\\packages\\melos\\.dart_tool\\a9ed4760>      echo "➡️ step: melos run list" && melos run list || VER>NUL && if %ERRORLEVEL% NEQ 0 (echo __FAILURE_COMMAND_END__) else (echo )\n'
              '"➡️ step: melos run list" \n'
              'melos run list\n'
              '  └> echo "list script"\n'
              '     └> RUNNING\n'
              '\n'
              '"list script"\n'
              '\n'
              'melos run list\n'
              '  └> echo "list script"\n'
              '     └> SUCCESS\n'
              '\n'
              'd:\\a\\melos\\melos\\packages\\melos\\.dart_tool\\a9ed4760>    \n'
              'd:\\a\\melos\\melos\\packages\\melos\\.dart_tool\\a9ed4760>      echo "➡️ step: echo "hello world"" && echo "hello world" || VER>NUL && if %ERRORLEVEL% NEQ 0 (echo __FAILURE_COMMAND_END__) else (echo )\n'
              '"➡️ step: echo "hello world"" \n'
              '"hello world" \n'
              '\n'
              'd:\\a\\melos\\melos\\packages\\melos\\.dart_tool\\a9ed4760>    \n'
              'd:\\a\\melos\\melos\\packages\\melos\\.dart_tool\\a9ed4760>SUCCESS\n'

Steps to reproduce

Run the test suite as a GitHub Actions Workflow: https://github.com/invertase/melos/actions/runs/10889115119

Expected behavior

  • Status codes should be reliable and consistent across environments
  • Log output for melos script with steps should be consistently formatted across environments

Screenshots

No response

Additional context and comments

No response

jessicatarra avatar Sep 16 '24 19:09 jessicatarra

This also happens when you add steps as follows:

scripts:
  test:
    steps:
      - melos exec -f --dir-exists=test -- flutter test
      - echo "Continue the step like nothing happened"

If you run melos test you will hit exit code 0 on macOS. This is not platform specific. However, if you run melos exec -f --dir-exists=test -- flutter test directly, you will get exit code 1.

bvoq avatar Sep 17 '24 11:09 bvoq

@bvoq this issue is about the internal Melos windows tests. There should be another issue open for the issue you're describing though.

spydon avatar Sep 17 '24 14:09 spydon

Still a number of tests failing for Windows: https://github.com/invertase/melos/actions/runs/15727041513/job/44319098341?pr=912

We have the same problem on FlutterFire CLI regarding test suite passing on Windows whilst tests fail.

russellwheatley avatar Jun 18 '25 08:06 russellwheatley