hey24sheep / azure-flutter-tasks

Easily build and deploy with latest Flutter build tasks for Azure DevOps Pipelines Tasks
https://marketplace.visualstudio.com/items?itemName=Hey24sheep.flutter
MIT License
89 stars 22 forks source link

Specifying special characters in the Command or Test task #113

Closed sk92129 closed 9 months ago

sk92129 commented 9 months ago

To get flutter to be fully integrated with sonarqube, this article specifies that the output from the flutter tests need to be put into a file named tests.output.

https://medium.com/@meaghosh/static-code-analysis-with-sonarqube-with-flutter-11a74beb9950

flutter.bat test --coverage --machine > tests.output

I tried adding the > into the Test task but could not get the task to handle that special character correctly.

Then I tried with the Command task, but encountered the similar problem. Any ideas?

If I leave off the > tests.output in the test step, then the sonarqube scanner indicates that it was not able to locate that tests.output file.

sk92129 commented 9 months ago
- task: FlutterCommand@0
  displayName: 'Flutter Command - Run tests'
  inputs:
    projectDirectory: .
    arguments: 'test --coverage --file-reporter \"json:tests.output\"'

C:\Windows\system32\cmd.exe /D /S /C "D:\BuildAgentMobileWeb_work_tool\Flutter\3.16.3\windows\flutter\bin\flutter.bat test --coverage --file-reporter "\""json:tests.output\""""

Couldn't parse --file-reporter "\"json:tests.output\"": "\"json" is not a supported reporter

sk92129 commented 9 months ago

removed the quotes and escape chars. then it seems to work.

flutter.bat test --coverage --file-reporter json:tests.output