Code coverage of Meteor application using meteor-coverage - meteor

I am working on a Meteor application and we need to generate code coverage reports. For this, I am trying to configure meteor-coverage.
Following is my configuration in settings.coverage.json file.
{
"coverage": {
"coverage_app_folder": "D:\\my\\app\\path\\",
"is_coverage_active": true,
"verbose": true
}
}
and I am running the following command to generate the coverage report.
meteor --settings settings.coverage.json
The problem I am facing is that I am getting the coverage only for some files in the application. There is a lot of code that is executed when I run the application but that isn't reflecting in the report.
My question is if I am going in the right direction or is there any other configuration that will help my cause.

Related

Sonarcloud not displaying issues for .net core app using dotnet-sonarscanner

I've created a test console app using .net core 3.1, added it to github, and setup a GitHub action using the template provided by Sonarcloud.io.
The build analysis part looks like this:
.\.sonar\scanner\dotnet-sonarscanner begin /k:"<projectkey>" /o:"<org>" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.scanner.force-deprecated-java-version=true
dotnet build --configuration Release --no-restore
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
This builds fine and reports no errors. Yet when I go to sonarcloud.io although I can see it's received the analysis, it's not showing any issues, despite my purposely adding some:
The master branch displays this:
Yet, the code is visible in the code tab:
For PRs I see:
But there are issues (I can see them locally when using SonarLint pointing at sonarcloud.io).
What am I missing?
It turns out this wasn't showing any issues because it was considering all my files as test code. I had created this whole repo as a Sonarcloud test, and my project was called SonarCloudTest.csproj and Sonar has some regex rules around categorising code.

Troubleshoot Grunt concat and Uglify in Sails pipeline

I'm working on a Sails.js app using angular 1.5x for front end. Recently I began working with textAngular, which works good in development, however, for some reason running in production, which (I believe to be the issue) runs grunt concat and uglify, therefore minimizing all js, I get a js error regarding injecting into my angular module/app. If I remove all references to textAngular it will concat/uglify and run fine in production. I want to use textAngular, and don't believe it is an issue with those scripts per say. How should I go about troubleshooting this issue? Are there any concat or uglify options that might help me pinpoint or resolve the issue?
ADDITIONAL INFO:
The angular code for injecting textAngular:
var sangularApp = angular.module('sangularApp', ['datatables', 'textAngular']).
config(function($provide) { // provider-injector
$provide.decorator('taOptions', ['$delegate', function(taOptions) { // $delegate is the taOptions we are decorating
taOptions.toolbar = [
['pre', 'bold', 'italics', 'underline', 'strikeThrough','ol','insertLink', 'insertImage','html']
];
return taOptions;
}]);
});
Here is the error I get (when I run in production and the files are minified:
Error: [$injector:modulerr] http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=sangularApp&p1=%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.5.0%2F%24injector%2Funpr%3Fp0%3Da%0Ad%2F%3C%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A1797%0APa%2Fo.%24injector%3C%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A20234%0Ad%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18987%0Ae%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A19221%0Ak%2F%3C.invoke%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A19311%0Ad%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18448%0Aj%2F%3C%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18580%0Af%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A2243%0Aj%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A18357%0APa%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A20389%0A_%2Fg%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A9026%0A_%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A9329%0A%24%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A10%3A8641%0A%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A14%3A26564%0Afa.Callbacks%2Fj%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A2%3A7154%0Afa.Callbacks%2Fk.fireWith%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A2%3A7927%0A.ready%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A2%3A9741%0Ag%40http%3A%2F%2Fcutupcode.com%2Fmin%2Fproduction.min.js%3A1%3A1606%0A
This is a difficult question to respond to without some debugging information or console errors.
From what you've mentioned my suggestion would be to look back over your scripts and make sure that the additional library for textAngular has been included and that the injection of the library into your module is done correctly.
Minification and concatenation typically don't cause any issues for me when the library works fine without those tools applied.

IE WebDriver as a UnitTest Project with a MVC 4 Solution not working

New to Unit testing so please, forgive my naiveness. Browsing through the code provided by the IE Developer Channel. I adopted the code into my MVC project by adding a Unit Test project. On debugging the test I write using the WebDriver API. The first step creating a session using the Command
const string newSessionCommand = #"
{
""command"": {
""name"": ""newSession"",
""parameters"": {
""desiredCapabilities"": {},
""requiredCapabilities"": {}
},
""sessionId"": null
}
}";
response = ExecuteCommand(newSessionCommand, null);
The command fails with the error "WebDriver will only run against the DeveloperPreview build. Please run this EXE with the following argument", compared the sample, added all that is needed like the x64 architecture, registering the dll, NOTE that is works in the BING search sample sln, but NOT as a test case, also added to the debug the command line arguments:
/appvve:9BD02EED-6C11-4FF0-8A3E-0B4733EE86A1_6A0357B5-AB99-4856-8A59-CF2C38579E78
You are getting the "WebDriver will only run against the DeveloperPreview build." because either you not are not running your built application with the "/appvve:9BD02EED-6C11-4FF0-8A3E-0B4733EE86A1_6A0357B5-AB99-4856-8A59-CF2C38579E78" argument or you do not have the Developer Channel build installed.
You need to do this because the IE Developer Channel runs as an AppV application. As such, any application that makes calls into the Developer Channel version using the WebDriver API needs to run in the same AppV environment (which is why you must use the /appvve argument).
Make sure you have the IEDeveloperChannel build install and try running your Unit test executable with the /Appvve argument
Example:
MyUnitTest.exe /appvve:9BD02EED-6C11-4FF0-8A3E-0B4733EE86A1_6A0357B5-AB99-4856-8A59-CF2C38579E78
You can get the Developer Channel here: http://devchannel.modern.ie/

Auto-loading your Kohana project for unit testing in Codeception

I am very much new to Kohana and Codeception world. I was exploring how to do testing in kohana using codeception.
I was able to run acceptance test. But now I want to create my Unit test for my demo app that has only sign and signup functionality.
How should I load the required files or the application instance which I will be using in the unit test.
Like I need to check if "Controller_Login" class exists. And then within this controller if "action_login" method exists or not.
I have gone through the Codeception documentation and it says that you need to auto-load your project in the unit/_bootstrap.php file.
So, how should I auto-load my project. Could you please guide me.
For unit test I have written this simple test
public function testMe()
{
$users = new User;
$this->assertInstanceOf('User', $users);
}
But when I run this it gives me error on console that "Class 'User' not found".
How should I auto-load my project please guide me.
Writing unit test for you app using Codecpetion you need to follow these points.
You need to load all your app in Codecpetion. So, that your test can easily access your classes.
There is one _bootstrap.php file at the root in test folder which Codecpetion creates once you bootstrap Codecpetion.
In this file you need to load your app.
For example I have done it like this to load my application folder.
define('APPPATH', realpath('application').'/');
So like this now you can create a unit test and access any class you would like to access.

Path variables not working on 0.6.5 e.g. METEOR_SETTINGS

i cannot get it working after i updated to 0.6.5.
I created a new meteor project.
I have a start.sh script that looks like this.
export METEOR_SETTINGS=$(cat ./settings.json)
meteor
settings.json:
{
"public":{
"bla":"blup"
}
}
Meteor.settings on the client is undefined. It works if i add the settings json file via "--settings", but unfortunately this is not what i need.
The PORT environment variable or NODE_ENV also does not work for me.
Adding some random stuff like "export MY_ENV_VAR=foo" however works.
Am i missing s.th.? It all worked well before. I would really appreciate your help.
Thx!
(also created an issue: https://github.com/meteor/meteor/issues/1381)
If you are trying to test your meteor app locally (dev mode) or you want to deploy your app to the Meteor hosting, then just pass the file path as settings param:
meteor --settings settings.json
In case of running from bundle on your own server, then you need the environment variable.
Docs.

Resources