How to view code coverage as html in Windows? - flutter

I did flutter test --coverage
A lcov.info was generated under coverage
I want to convert this into html but I don't find a tool for Windows.
On linux, you just do:
sudo apt-get update -qq -y
sudo apt-get install lcov -y
Then you do
genhtml coverage/lcov.info -o coverage/html
I am on Windows and
'genhtml' is not recognized as an internal or external command,
operable program or batch file.

Ok I found it. I will leave the anwser here in case it maybe helpful for anyone.
Actually genhtml is a perl script. If you are have git bash installed, you should have perl already. Try where perl on the cmd and it will show you the path.
For me it was at C:\Program Files\Git\usr\bin\perl.exe
Now create a file called genhtml.perl inside your flutter project root directory. (Make sure to .gitignore it)
Then in the file, copy and paste the content this https://raw.githubusercontent.com/valbok/lcov/master/genhtml.perl
Finally open git bash and run $ ./genhtml.perl ./coverage/lcov.info -o coverage/html .
Check You are done html files at coverage/html.
On android studio, select index.html then CTRL+SHIFT+C to copy the file path.
Open Chrome and on the url bar add file:///+CTRL+V. Tap enter. You are done.
PS : Who so ever is facing an error like No common filename prefix found! or some other issue, they can try replacing content of genhtml.perl file from below link.
https://raw.githubusercontent.com/linux-test-project/lcov/master/bin/genhtml

Related

How to generate HTML from a lcov file on Windows via WSL?

I am using Flutter to generate the lcov file and now I want to use WSL to generate the HTML file for reading the data. How can I achieve this?
First of all, after generating the lcov.info files on windows you must replace all \ characters for / because linux can't understand the backslashes.
Then you can simply invoke the linux command for lcov generation through any windows terminal via:
wsl genhtml coverage/lcov.info -o coverage/output/
You invoke this command inside the project you are working on.
The first parameter coverage/lcov.info is the path for the lcov file.
The second parameter -o coverage/output/ is the output folder where the html files will be placed.

Trying to add path to locate flutter to run "flutter doctor" to solve "zsh: command not found: flutter"

Trying to add path to locate flutter so 'flutter doctor' can be run, to solve zsh: command not found: flutter,
then I found that creating below is first step to solution, but again terminal says nano ~/.bash_profile zsh: command not found: nano
then trying to create bash profile also not working, may be it's existing, but somehow it says below.
$HOME/.bash_profile
zsh: permission denied: /Users/prettygirl/.bash_profile
terminal is given full file access in macOS
restarted my macmini
vscode quitted and restarted,
terminal quitted and restarted
problem still persists. Is there any way to add path variables easily than going through all this hassle with terminal? like macos menu or something to add system path variables?
You're trying to open your bash_profile using nano (text editor) which you don't have installed. You can open that file using any text editor you have. Also, I see you're using zsh and not bash, this means that you should actually edit your ~/.zshrc or ~/.zprofile instead and add
PATH=</path/to/flutter>:$PATH
where you replace </path/to/flutter> with the actual path to flutter on your machine. You can do this if you don't want to add it manually:
echo 'export PATH=</path/to/flutter>:$PATH' >> ~/.zshrc && source ~/.zshrc
again, replacing </path/to/flutter> with your actual flutter path.
This is the only thing that worked for me.
Go to where your flutter folder is and right-click, get info, and copy where the path then paste it in the YOUR_PATH part below.
Open the .zshrc file using the command: nano ~/.zshrc,
Now add the following to the file: export PATH="$PATH:/YOUR_PATH/flutter/bin/"
Save the file by pressing Control + X followed by Enter.
Apply the changes by command: source ~/.zshrc

How to install nano using GitBash in Windows 10?

I am trying to install nano editor. From all the previous posts, I am stuck on path. What is path? How do I fix put my path?
I have:
$ mv nano ~/path/to/git/share
$ nano abc
bash: nano: command not found
You can add it via chocolatey.
choco install nano
PATH is the environment variable which is used to locate an executable you want to run.
See "How to permanently set $PATH on Linux?": you can add the folder where nano is in your .bashrc (which you can create directly under %USERPROFILE%, used by Git bash as $HOME)
Add to ~/.bashrc:
export PATH=$PATH:~/path/to/git/share
Then type
source ~/.bashrc
If you don't want to add it to your PATH, you can follow this step-by-step procedure, which does include the installation of nano-git-0d9a7347243.exe.
If your ultimate goal is to have and use nano on Windows 10, you can download the nano installer from here and just install the .msi file the usual Windows way. No manual path configurations required.

Actions on Google - Mac gactions won't run

I am trying to set up the Actions sdk as described here:
https://developers.google.com/actions/sdk
I downloaded gactions for a Mac 64-bit machine. If I try to open the file, it opens as text. When I am in the folder containing gactions, I try to run gactions init and get the response:
-bash: gactions: command not found
Any thoughts?
Try this:
Download Google gactions cli from gaction CLI
On Mac and Linux, to make the binary executable run from terminal:
$ cd folder_with_gactions
$ chmod +x gactions
Execute gactions
$ cd folder_with_gactions
$ ./gactions init
Also, you may find this tutorial interesting if you are trying to create an action in Google Home : How to create a custom private Google Home Action with API.AI and Google App Engine. In STEP 8 you can find an example of gactions.
If you have already setup google-cloud-sdk correctly, then you can drop the gactions file into the google-cloud-sdk/bin folder. Alternatively, you can add a path to bash directly to the folder you have gactions.
To add the gactions command CLI location to the System Paths:
Use “Go to the Folder” option of Finder, to search “~/.bash_profile”
Open the File “~/.bash_profile”
 in edit mode and add the following command, at the top the file, Save and Close.
export PATH="$PATH:$HOME/gactionsCLI"
Note: Above path refers to the folder which contains the executable
file “Unix Executable”
Restart the Terminal and try the commands
Download gactions
copy downloaded gactions and put into a local Project folder
and then go to your project directory cd "project directory"
run following commands :
$ chmod +x gactions
$ ./gactions init
it will create action.json into your folder
Ensure you run chmod +x gactions to make the binary executable
Copy the binary executable into the project directory
Run ./gactions init from the terminal/command line

Using a sort of portable JDK on centOs

This is the first time that I use linux in my life, I'm a little bit strugling.
Permissions, user, folder structure, it's a lot to take in.
Everything I did, I did with the ATH user which is a regular non sudoer user.
I got Centos minimal and put it in a VM
then I extracted the linux tar.gz jdk in /home/ath/monitoring/jdk1.8.0_70_linux64
And I added this to a sh script, this sh script call other sh script
I want them to only use this jdk
below #!/bin/sh I added
export JAVA_HOME=/home/ath/monitoring/jdk1.8.0_70_linux64
However when I launch the script I get :
Which : no java in (/usr/local/bin:/usr/bin:usr/local/sbin:/usr/sbin:/home/ath.local/bin:/home/ath/bin)
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME
What am I doing wrong?
Thanks
ps : I used (logged as root) chmod +x /home/ath/monitoring/elasticsearch/bin/elasticsearch/bin/elasticsearch.sh
on the sh script otherwhise it would not run
So I also had to add this line because the script was looking into PATH :
export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH
And I had to render all the file in jdk/bin executable running this inside
chmod a+x *
I don't get it tho, each time I'm getting a software I have to manually go and chmod every file that need it? quite bothersome.