<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Shafiq Jetha</title>
    <description>The latest articles on Forem by Shafiq Jetha (@fasterinnerlooper).</description>
    <link>https://forem.com/fasterinnerlooper</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F395828%2F34be8720-a951-4980-8204-0e478d09a6ea.jpeg</url>
      <title>Forem: Shafiq Jetha</title>
      <link>https://forem.com/fasterinnerlooper</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/fasterinnerlooper"/>
    <language>en</language>
    <item>
      <title>Removing comments from code-based data source</title>
      <dc:creator>Shafiq Jetha</dc:creator>
      <pubDate>Thu, 21 Dec 2023 15:06:16 +0000</pubDate>
      <link>https://forem.com/fasterinnerlooper/removing-comments-from-code-based-data-source-97f</link>
      <guid>https://forem.com/fasterinnerlooper/removing-comments-from-code-based-data-source-97f</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hr_QbuuL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kafuw9i82gs1kgde3x1r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hr_QbuuL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kafuw9i82gs1kgde3x1r.png" alt="A computer screen showing what appears to be code, densely packed together. The code is highlighted in different colours." width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
Photo by Markus Spiske on Unsplash&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I am in the process of experimenting with training an LLM on a codebase. My goal is to build a foundational model that I can then create different generative AIs from that are more focused on a task, say Code Review or High-Level Documentation. I needed to start from a good known source even if it might be a little small for my ultimate goal so that I know whether or not I was going in the right direction. I started by setting up the training process for a BERT-style LLM. I chose BERT because I believe it is best for trying to build understanding of its source material.&lt;/p&gt;
&lt;h2&gt;
  
  
  Getting to work
&lt;/h2&gt;

&lt;p&gt;Under the Microsoft username, there is a dataset called LCC_csharp. I started using this as the codebase I wanted to work with is also written in C#, but I quickly found a significant issue with the codebase.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// See the LICENSE file in the project root for more information. // // using System; using System.Runtime.InteropServices; using Windows.Foundation; #pragma warning disable 436 // Redefining types from Windows.Foundation namespace Windows.UI.Xaml.Media.Media3D&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Where would you put the line breaks for the code snippet above?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The structured C# files had been compressed down to a single line. This isn't so much of an issue but it becomes hard to find where a comment ends and the code itself begins. I wasn't going to sit there and figure this out by hand, so I decided to program my way out of the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Execution
&lt;/h2&gt;

&lt;p&gt;My plan was to use the Roslyn Analyzer developed by one of the .NET teams at Microsoft to do static analysis on C# code. The Analyzer has a concept known as Trivia, and each section of code is a different Trivia. Once the code is read into a Syntax Tree, it becomes a structured document and different parts of the file can be queried and modified easily.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;commentTrivia&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetRoot&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;DescendantTrivia&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;IsKind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SyntaxKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SingleLineCommentTrivia&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt;
          &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;IsKind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SyntaxKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MultiLineCommentTrivia&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt;
          &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;IsKind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SyntaxKind&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SingleLineDocumentationCommentTrivia&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code block finds all of the major types of comment Trivia that exist in the document. The next thing I do is remove those items from the document and normalize the whitespace so that it takes on a more natural shape. I had intended to then save the document as is, with line breaks and all, but I quickly found out that this corrupted the Parquet format that the data was originally saved in. A lot of trial and error later, I settled on removing all of the line breaks, effectively putting all of the code back on one line, but this time, without the comments, the code could be read as a big line of code rather than a document where comments and code intermingled without a clear break between them all.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Runtime.InteropServices&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Windows.Foundation&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="n"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;warning&lt;/span&gt; &lt;span class="n"&gt;disable&lt;/span&gt; &lt;span class="m"&gt;436&lt;/span&gt; &lt;span class="c1"&gt;// Redefining types from Windows.Foundationnamespace Windows.UI.Xaml.Media.Media3D&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Not perfect, but a lot better than before.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Now the codebase can be tokenized from scratch and should contain only meaningful code. Comments are incredibly important for us humans to fully understand a piece of code, but I feel that it's more important for a foundational LLM to be able to generate good code. From there I can reliably build Q&amp;amp;A, code-completion and documentation LLMs that fine-tune the base weights to be better at their individual tasks. Ideally I can then merge these all together in a Mixture of Experts model that can be good at a variety of tasks, and have all been trained or at least fine-tuned on the specific codebase.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>ai</category>
      <category>csharp</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Using GPT 3.5 Turbo to summarise specific YouTube comments</title>
      <dc:creator>Shafiq Jetha</dc:creator>
      <pubDate>Mon, 30 Oct 2023 04:07:18 +0000</pubDate>
      <link>https://forem.com/fasterinnerlooper/using-gpt-35-turbo-to-summarise-specific-youtube-comments-1oo</link>
      <guid>https://forem.com/fasterinnerlooper/using-gpt-35-turbo-to-summarise-specific-youtube-comments-1oo</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dzSVF0HP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AphYXZMXwROgkzkeL" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dzSVF0HP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/0%2AphYXZMXwROgkzkeL" alt="Young boy watching jellyfish in a tank with a purple glow to the image" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Photo by Jeswin Thomas on Unsplash&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Generative AI has become quite the buzzword lately, but there aren’t a lot of projects out there that focus on improving our mental state with regards to the constant barrage we receive from social media.
&lt;/h4&gt;

&lt;p&gt;My first attempt at helping to work towards this goal is to create a service that allows people to parse their YouTube comments and get summarise of comments that are classified as being below a certain threshold. As the criterion for this, I have chosen Psychological Safety, and so any comments that are classified as being of low psychological safety will get summarised by the Generative AI and the exact comment will never be displayed to the user. By doing this, we eliminate or at least significantly reduce the psychological load that social media can put on us.&lt;/p&gt;

&lt;p&gt;Here is the output when running &lt;a href="https://www.youtube.com/watch?v=CmYKJpKsh_c"&gt;this video&lt;/a&gt; through the analyzer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;High Psychological Safety:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Great video as always but why is poor Jango posed like he needs to use the toilet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I like it, thanks for showing the comparison. Definitely be getting the Batman. As always, your builds and opinions are greatly appreciated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You answered a question I was wondering about.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hi again! Im a really big fan of your videos! You inspired me to build my own lego city and to buy many lego sets!!!!??????&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I love this. I just wish lego would make some figures for other technic sets&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I literally just got these two sets, Batman figure and his bike, yesterday! Now I know for sure they will look good enough to be displayed together. Thank you for the video.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Got both the Ducati, and Batcycle earlier in Summer. While both display great on their own, i too was curious how they would scale to the newest buildable figures. I was thinking the bike would be too small, but the scaling is much closer than initially thought. Balance looks to be a bit of an issue but cool to see the comparison shots. Definitely getting the Batman now, and maybe the Captain America as he looks like a good fit for the Ducati as both bikes are very similar in size.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Thanks for this video. Really answered the question that has been on my mind for some time. Nice job&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Medium Psychological Safety:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hi. Unrelated question. But when are we going to hear any news about the speed champions 2024?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Actually, combining construction figures with Technic motorcycles is not a new idea, and can be a fun way to waste some time. Your own Darth Vader Chopper inspired me to put some Star Wars buildable figures on some of the older Technic motorbikes and the results look pretty cool. I’ve put a New Order StormTrooper on an orange Dirtbike and a Pretorian Guard (the ones with the weird helmets and red robes) on a Streetracer and on the Ducati. The Batcycle is still waiting to be built, and I was thinking it would become Darth Vader’s bike with some small modifications. Now what vehicle would I put General Grievous on?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I wish Darth Vader had a motorbike of his own ??&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I think it would have been pretty cool if they released both these products in a single set, which could have lowered the total price perhaps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lol that split on two bikes frame xD&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I like it might only get those sets only for that&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Low Psychological Safety (paraphrased):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;All of these lego figures are not as appealing as I’d like them to be. It would be great if they improved them in the future.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Those buildable figures have ugly design and the proportions are off too. Improvement is needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All of these lego figures are garbage. I wish they came up with a replacement for the old technic figures.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you can see, all of the comments were reproduced as they were written aside from those that had been deemed as having low psychological safety, and were summarised to avoid unnecessary mental strain.&lt;/p&gt;

</description>
      <category>gpt</category>
      <category>generativeai</category>
      <category>chatgpt</category>
      <category>genai</category>
    </item>
    <item>
      <title>Combining Jest and Cypress code coverage reports in your Angular app</title>
      <dc:creator>Shafiq Jetha</dc:creator>
      <pubDate>Sat, 31 Jul 2021 18:38:58 +0000</pubDate>
      <link>https://forem.com/fasterinnerlooper/combining-jest-and-cypress-code-coverage-reports-in-your-angular-app-2bi9</link>
      <guid>https://forem.com/fasterinnerlooper/combining-jest-and-cypress-code-coverage-reports-in-your-angular-app-2bi9</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0u_DmblG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2Apv2AJGKWmqbFC9NjAWXuCg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0u_DmblG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2Apv2AJGKWmqbFC9NjAWXuCg.jpeg" alt="" width="800" height="533"&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@isaacmsmith?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Isaac Smith&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/report-graph?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When writing front-end tests, code coverage is an important metric that helps you determine how many critical paths of your application are covered.&lt;/p&gt;

&lt;p&gt;Cypress has their own tutorial and example repo which uses Babel, but in this post I’ll go through the process of doing this with an Angular application, without using Babel.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instrumenting and reporting
&lt;/h3&gt;

&lt;p&gt;Codecov has a feature whereby any code coverage metrics that are uploaded with the same branch name will be merged into one report. This is a useful feature if you have several different test runners and need them all to be combined into one report. For producing coverage reports for Jest and Cypress some features need to be added and enabled.&lt;/p&gt;

&lt;p&gt;Jest comes with the istanbul instrumenter and coverage reporting tool built-in, and since this is now the standard for instrumenting code, this is a useful feature. To use it, you have to run jest with the --coverage flag added. If you already have this in your package.json file, you can make the following modification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- "test": "ng test"
+ "test": "ng test -- --coverage"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will produce a coverage report for your Jest tests, but this isn’t enough. We also need Jest to collect coverage for all of the files that have no test. In your jest.config.js file, you will need to make this modification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+ rootDirs: ['&amp;lt;rootDir&amp;gt;/src'],
+ collectCoverage: true,
- coverageReporters: ['json', 'html'],
+ coverageReporters: ['lcov'],
+ collectCoverageFrom: ['**/*.ts'],
+ coverageDirectory: './coverage/jest',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create an lcov format coverage report, but will also give us a proper understanding of what is and isn’t covered across our entire application.&lt;/p&gt;

&lt;p&gt;We’re also going to put out output in a separate directory so that when we run our Cypress tests, our Jest coverage report doesn’t get overwritten.&lt;/p&gt;

&lt;p&gt;To get Cypress set up there are a few more steps involved. As mentioned in the readme on &lt;a href="https://github.com/skylock/cypress-angular-coverage-example"&gt;skylock/cypress-angular-coverage-example&lt;/a&gt; because the Cypress package doesn’t do instrumenting, we have to add the @cypress/code-coverage package and modify the build process. This will trigger instrumenting on our code so that we can produce a coverage report. This package uses Istanbul’s successor nyc, and as such a second step is required for us to generate an lcov format report. We also need to modify the webpack config for the development build so that the code gets instrumented correctly.&lt;/p&gt;

&lt;p&gt;Begin by adding the @cypress/code-coverage package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D @cypress/code-coverage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add the package to Cypress’ support/index.ts file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+ import '@cypress/code-coverage/support
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have Cypress set up, we can move onto modifying the build process. We achieve this by using the ngx-build-plus package which can be installed with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D @ngx-build-plus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the cypress folder, a coverage.webpack.js needs to be added with the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  module: {
    rules: [
      {
        test: /\.(js|ts)$/,
        loader: 'istanbul-instrumenter-loader',
        options: { esModules: true },
        enforce: 'post',
        include: require('path').join(__dirname, '..', 'src'),
        exclude: [/\.(e2e|spec)\.ts$/, /node_modules/, /(ngfactory|ngstyle)\.js/],
      },
    ],
  },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will allow us to instrument our code, but we also need to modify our angular.json file to use this webpack file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- "builder": "[@angular](http://twitter.com/angular)-devkit/build-angular:dev-server",
+ "builder": "ngx-build-plus:dev-server",
+ "options": { "browserTarget": "ng-new-app:build", "extraWebpackConfig": "./cypress/coverage.webpack.js" }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can test our project by running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng e2e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run &amp;lt;project&amp;gt;:cypress-run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the test run has completed, you still need to covert the nyc output to lcov so that you can proceed with the next step. You can achieve this by running this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx nyc report --reporter=lcov
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will transform your nyc output into lcov output, so that both reports are in the same format. You can now decide how you wish to track your code coverage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: Codecov
&lt;/h3&gt;

&lt;p&gt;When you upload multiple reports, Codecov will merge these reports together, so simply uploading the coverage directory’s content will combine these results and produce an accurate coverage report.&lt;/p&gt;

&lt;p&gt;If you are using GitHub Actions, uploading the files is as simple as calling the relevant Action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;uses: codecov/codecov-action@v1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it is uploaded, you will get access to Codecov’s different coverage diagrams as well as a histogram of your coverage over time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TA7HZMxY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AuFRKjxrF1KcM9uDBRn6SnQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TA7HZMxY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AuFRKjxrF1KcM9uDBRn6SnQ.png" alt="" width="800" height="220"&gt;&lt;/a&gt;Coverage over time for an example project&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 2: Manually merge the reports
&lt;/h3&gt;

&lt;p&gt;If you simply want to manually merge the reports and feed them into your own code coverage tool, lcov reports can be appended to one another and still retain the same detail. After installing the lcov package in Ubuntu, you can generate a HTML report of the combined coverage by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;genhtml --prefix &amp;lt;directory&amp;gt; lcov.info --output-directory=./cov
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IFe0WVKL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AUiSx5f6quEy5kJC9MAtvYQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IFe0WVKL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2AUiSx5f6quEy5kJC9MAtvYQ.png" alt="" width="800" height="541"&gt;&lt;/a&gt;An example of the genhtml output&lt;/p&gt;

&lt;p&gt;If you’d like to have a ready-to-go project that has all of this included, and more, check out this project I helped out with: &lt;a href="https://github.com/sardapv/angular-material-starter-template"&gt;sardapv/angular-material-starter-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now go forth, and cover!&lt;/p&gt;

</description>
      <category>jest</category>
      <category>cypress</category>
      <category>angular</category>
      <category>testing</category>
    </item>
    <item>
      <title>Why you need Wallaby.js for your Front-End Unit Tests</title>
      <dc:creator>Shafiq Jetha</dc:creator>
      <pubDate>Sat, 03 Jul 2021 06:38:22 +0000</pubDate>
      <link>https://forem.com/fasterinnerlooper/why-you-need-wallaby-js-for-your-front-end-unit-test-4ol3</link>
      <guid>https://forem.com/fasterinnerlooper/why-you-need-wallaby-js-for-your-front-end-unit-test-4ol3</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4QY7O0Fo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2A72in1hS4SADP9RFVzks5Mw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4QY7O0Fo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/1024/1%2A72in1hS4SADP9RFVzks5Mw.jpeg" alt="" width="800" height="583"&gt;&lt;/a&gt;JJKPhoto by &lt;a href="https://unsplash.com/@jn1434?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Jerin J&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/red%20green?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wallaby.js is a test runner for front-end unit tests. It has been written so that tests are run as you type, giving you an incredible amount of insight into the code you write.&lt;/p&gt;

&lt;p&gt;Wallaby.js integrates cleanly with the internet’s favourite IDEs, and can also be run from the command line, allowing for it to be run as part of a git pre-commit hook, or as part of a CI/CD pipeline.&lt;/p&gt;

&lt;p&gt;Wallaby.js provides time-travel debugging, which allows you to step backwards and forwards through your tests to understand precisely what values are being set and when, so that you can build tests that are less flaky.&lt;/p&gt;

&lt;p&gt;Integration into, for example, Visual Studio Code will makes it easy to see which tests pass, which ones fail, and provide gutter highlighting to show you which parts of your code have been covered, and where failures are occurring.&lt;/p&gt;

&lt;p&gt;Wallaby’s strength comes from how quickly it can re-run tests and how quickly it shows errors across both the test file and all of the code that is touched by the test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sR7GAkA---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AtZ7yFPjXdb7oPBiZPm_HBA.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sR7GAkA---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/800/1%2AtZ7yFPjXdb7oPBiZPm_HBA.gif" alt="" width="800" height="316"&gt;&lt;/a&gt;Wallaby.js in action&lt;/p&gt;

&lt;p&gt;In contrast, using Jest’s watch feature, the same change takes more than 4 seconds to run the same test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RkHVITXO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/592/1%2AslB7eqRsD4Q7FNH914cfxA.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RkHVITXO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn-images-1.medium.com/max/592/1%2AslB7eqRsD4Q7FNH914cfxA.gif" alt="" width="592" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if you’re like me and use Visual Studio Code for everything, there are various extensions that try to get close to Wallaby’s speed, but noting gives you that instant feedback and that wonderful feeling quite like Wallaby.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>wallbyjs</category>
      <category>devinnerloop</category>
      <category>testingtools</category>
    </item>
  </channel>
</rss>
