<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Slava Bezgachev on Medium]]></title>
        <description><![CDATA[Stories by Slava Bezgachev on Medium]]></description>
        <link>https://medium.com/@bezgachev?source=rss-a96bef0adc3f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Uv1Du8CbiTV-eh6n.</url>
            <title>Stories by Slava Bezgachev on Medium</title>
            <link>https://medium.com/@bezgachev?source=rss-a96bef0adc3f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 13:54:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bezgachev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Configuring and debugging Typescript Jest tests in WebStorm]]></title>
            <link>https://medium.com/@bezgachev/configuring-and-debugging-typescript-jest-tests-in-webstorm-aa14e63d27d?source=rss-a96bef0adc3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa14e63d27d</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webstorm]]></category>
            <category><![CDATA[jest]]></category>
            <dc:creator><![CDATA[Slava Bezgachev]]></dc:creator>
            <pubDate>Thu, 23 Aug 2018 14:09:29 GMT</pubDate>
            <atom:updated>2018-08-23T14:09:29.072Z</atom:updated>
            <content:encoded><![CDATA[<p>This small guide/explanation is for people like me, who wanted to debug Typescript Jest tests, with break-point support and everything. Immensely helpful for testing your app on-the-go, especially if you use TDD or just like to test your code as you go.</p><p>If you’re looking for how to do this in <strong>Visual Studio Code</strong>, those two articles might be helpful:</p><ul><li><a href="https://medium.com/@mtiller/debugging-with-typescript-jest-ts-jest-and-visual-studio-code-ef9ca8644132">https://medium.com/@mtiller/debugging-with-typescript-jest-ts-jest-and-visual-studio-code-ef9ca8644132</a></li><li><a href="https://medium.com/@jakubsynowiec/debugging-typescript-jest-unit-tests-with-visual-studio-code-36cd16865bb0">https://medium.com/@jakubsynowiec/debugging-typescript-jest-unit-tests-with-visual-studio-code-36cd16865bb0</a></li></ul><p>Luckily, setting up and debugging Jest and Typescript is simpler in Webstorm. If you just want to look at a finished setup, have a look at <a href="https://github.com/slavabez/typescript-jest-debug">my repository</a>. The demo repository has Jest tests for both a simple Express app (tested with supertest) and the simple React app (tested with Enzyme).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfcRYqAWT1hxpVJrWxAZHg.png" /><figcaption>A break-point in action on a typescript Jest file</figcaption></figure><p>Important stuff to get Typescript and Jest to work:</p><ul><li>Using the <strong>ts-jest</strong> package to automatically transform .ts files to what Jest understands. This can be achieved with the following config in Jest’s configuration:</li></ul><pre>&quot;transform&quot;: {<br>  &quot;^.+\\.(ts|tsx)$&quot;: &quot;ts-jest&quot;<br>}</pre><ul><li>To get proper support for keywords such as describe and test , don’t forget to install the @types/jest package</li><li>To make sure the break-points work as intended make sure you have the &quot;sourceMap&quot;: true in your tsconfig.json file. The tsconfig file needs to be in the <em>root directory</em> of the project, since it’s where Jest is typically launched from.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*oWmTfLzfrOmpJRCY72j4sw.png" /><figcaption>Adding the Run and Debug configuration for Jest</figcaption></figure><p>Almost there! All that’s left to do is add the Run Configuration to WebStorm, in the top right corner or in <strong>Run -&gt; Edit Configurations</strong>, then simply add the Jest template using the plus symbol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*I__CmAY7PIfVqgykYbY7bw.png" /></figure><p>You should now have the Run task, like in this image on the left.</p><p>If you’ve ever debugged Java or .NET code this will feel very familiar to you.</p><p>The green button runs the tests, the red bug button runs the tests in debug mode, which should respect your break-points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSBNe0zqCXk8wrKZztYlfg.png" /><figcaption>Debugging an Enzyme test for a very simple React component with a break-point</figcaption></figure><p>Simple as that! Feel free to ask me any questions about the setup. For a wealth of information on how to setup and use Webstorm’s debugger see the <a href="https://www.jetbrains.com/help/webstorm/using-breakpoints.html">official docs.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa14e63d27d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A simple bash script to update Visual Studio Code Insiders edition on Linux]]></title>
            <link>https://medium.com/@bezgachev/a-simple-bash-script-to-update-visual-studio-code-insiders-edition-on-linux-6d7b6e662163?source=rss-a96bef0adc3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d7b6e662163</guid>
            <category><![CDATA[script]]></category>
            <category><![CDATA[manjaro]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[bash]]></category>
            <dc:creator><![CDATA[Slava Bezgachev]]></dc:creator>
            <pubDate>Wed, 22 Aug 2018 09:11:29 GMT</pubDate>
            <atom:updated>2018-08-22T09:11:29.308Z</atom:updated>
            <content:encoded><![CDATA[<p>Just a quick one, for those like me on Linux, who can neither use the .deb installer nor the .rpm installer, here’s my little script that automatically updates <em>VSCode Insiders</em> for me using the <em>.tar.gz</em> archive.</p><p>This shell script is for my <strong>personal machine</strong> and I will explain what needs to be changed <strong>if you want to use</strong> <strong>it</strong> on your Linux machine.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d80f70c3b7d84e276699aa5aab923f9/href">https://medium.com/media/6d80f70c3b7d84e276699aa5aab923f9/href</a></iframe><blockquote>Cool, I want to use it too, what do I change for it to run on my machine?</blockquote><p>As you probably noticed, the script does everything in my home directory, <strong>/home/slava</strong>, so you should change all instances to your home directory. I use my <strong>/home/slava/Apps</strong> directory for my manually installed apps, change that to your directory.</p><p>The script also assumes you have the following installed:</p><ul><li><strong>curl </strong>— to fetch the .tar.gz file</li><li><strong>rsync</strong> —for an easier time copying the VSCode files</li></ul><p>I’ve also setup my <em>$PATH</em> variable to load <em>/home/slava/Apps/code-insider/bin</em> to be able to launch VSCode from a terminal, as well as adding VSCode to the App menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ZQM_qjc_pP_qolMZ1VooQ.png" /><figcaption>KDE App configuration</figcaption></figure><p>Feel free to ask questions, or suggest a better way of keeping VSCode Insiders updated on non-Debian or Redhat Linux distros. I’m using Manjaro KDE by the way, which I greatly recommend.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d7b6e662163" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6 simple steps to automatically test and deploy your JavaScript app to GitHub Pages]]></title>
            <link>https://medium.com/@bezgachev/6-simple-steps-to-automatically-test-and-deploy-your-javascript-app-to-github-pages-c4c32a34bcb1?source=rss-a96bef0adc3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4c32a34bcb1</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[unit-testing]]></category>
            <dc:creator><![CDATA[Slava Bezgachev]]></dc:creator>
            <pubDate>Thu, 18 May 2017 14:43:26 GMT</pubDate>
            <atom:updated>2017-05-18T14:43:26.196Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NIjF1hy4crepll1cnaxzA.png" /><figcaption>Workflow as per example below</figcaption></figure><p>Wouldn’t it be amazing if your new React app tested and deployed itself automatically? It’s very simple thanks to GitHub and Travis CI (CI stands for Continuous Integration).</p><p>This guide is for you if you:</p><ul><li><strong>Know</strong> how to create a JavaScript app. This example focuses on a simple React app, but all apps that follow the typical test and build jobs can be adapted.</li><li><strong>Know</strong> what unit tests are.</li><li><strong>Reasonably familiar</strong> with Git and/or GitHub.</li><li><strong>Reasonably familiar</strong> with the command line.</li><li><strong>Don’t know</strong> how to set up automatic tests and deployment.</li><li><strong>Need</strong> free hosting to show off your latest JavaScript project.</li></ul><p>The guide will show how to create a simple React application, push it to GitHub, link it to Travis CI and then to GitHub Pages. The tutorial will not focus on what React is.</p><h3>Step 1. Create a JavaScript app. Add tests.</h3><p>For the purposes of this tutorial I will be using <a href="https://github.com/facebookincubator/create-react-app">create-react-app</a>, an ingenious tool for quick and tool-less creation of React apps. Apps made using the tool already have a sample unit test written.</p><ul><li>Make sure you have <a href="https://nodejs.org/en/">NodeJS and NPM</a> installed. Run quick test commands node -v and npm -v to double-check.</li><li>Runnpm install -g create-react-app to install the create-react-app utility globally on your computer</li><li>To create a new app, create-react-app test-app . This command takes some time. Once complete, your app will be located in the /test-app directory.</li><li>Make sure the app runs properly. Navigate to the project directory and run npm run start or npm start to start the development server. Once everything works, cancel the task by pressing ctrl+c.</li><li>Make sure that npm run test runs successfully. It should have a single test suite setup with a single test in it.</li><li>Make sure the npm run build command works. It should create a deployment-ready build in the /build folder.</li></ul><h3>Step 2. Create a GitHub repository, push your app.</h3><p>Create an empty repository in GitHub without any files it. Make sure you have an SSH key added for your machine, then add your project files to a new git repo, then push it:</p><pre>git init<br>git add .<br>git commit -m &quot;first commit&quot;<br>git remote add origin (URL OF YOUR REPOSITORY)<br>git push -u origin master</pre><p>Refresh your repository page to make sure your app is now on GitHub.</p><h3>Step 3. Generate a GitHub token.</h3><p>On GitHub, go to your account settings -&gt; <a href="https://github.com/settings/tokens">Personal Access Tokens</a>.</p><p>Generate a new token. The token has to have the ‘repo’ scope selected in order to be able to access your repositories. Save the token in a save place and do not include in any public repositories in plain text. The token will be used in the next section.</p><p><strong>Note</strong>: the token should not be shared with anyone, it essentially gives an app access to edit your repositories.</p><h3>Step 4. Link your project to Travis CI, add the .travis.yml file.</h3><p>If you haven’t already, <a href="https://travis-ci.org/">create a Travis CI profile</a> using your GitHub profile. Add your newly added GitHub project to Travis using the green switch.</p><p>Before we create the Travis config file, we will add the GitHub token you created above to the Travis project. Go to the project settings in Travis and add a new <strong>Environmental Variable</strong>. Call the variable <strong>github_token</strong>, and set the value to the token you got from GitHub. This will enable Travis to use your token without you having to publicly put in in your repository.</p><p>Add the following .travis.yml file to the root directory of your project:</p><pre><strong>language: </strong>node_js<br><strong>node_js:<br>  </strong>- &quot;stable&quot;<br><strong>cache:<br>  directories:<br>  </strong>- node_modules<br><strong>script:<br>  </strong>- npm test<br>  - npm run build<br><strong>deploy:<br>  provider: </strong>pages<br>  <strong>skip_cleanup: </strong>true<br>  <strong>github_token: </strong>$github_token<br>  <strong>local_dir: </strong>build<br>  <strong>on:<br>    branch: </strong>master</pre><p>What each line means in the file:</p><pre>language: node_js</pre><p>Tells Travis to use NodeJS.</p><pre><strong>node_js:<br>  </strong>- &quot;stable&quot;</pre><p>Tells Travis which version(s) of NodeJS to use. Feel free to add additional versions, such as - &quot;7&quot; or - &quot;6&quot; .</p><pre><strong>cache:<br>  directories:<br>  </strong>- node_modules</pre><p>Tells Travis to cache the node_modules directory between builds instead of re-compiling the whole directory each time you commit.</p><pre><strong>script:<br>  </strong>- npm test<br>  - npm run build</pre><p><strong>Important bit: </strong>tells Travis which commands to run. Commands run in a succession, and if a command fails (i.e. exits with anything but 0), the build is marked as failed. Failed builds do not get deployed. Note that Travis knows to npm install already.</p><pre><strong>deploy:<br>  provider: </strong>pages<br>  <strong>skip_cleanup: </strong>true<br>  <strong>github_token: </strong>$github_token<br>  <strong>local_dir: </strong>build<br>  <strong>on:<br>    branch: </strong>master</pre><p>The deployment structure. Detailed documentation about other deployment platforms available can be found <a href="https://docs.travis-ci.com/user/deployment/">here</a>.</p><p>provider: pages specifies we’re using GitHub Pages.</p><p>skip_cleanup: true tells Travis not to delete build files.</p><p>github_token: $github_token sets the GitHub token. We used an environment variable to avoid exposing our token to the public.</p><p>local_dir: build tells Travis to only take the files from the /build directory for deployment</p><p>on: branch: master tells Travis when to trigger deployment. We only want to deploy when we push to the master branch of the repository.</p><h3>Step 5. Set the homepage address in package.json</h3><p>When you use GitHub Pages, your project is going to be hosted on a URL that looks like this:</p><pre><a href="https://your_github_username.github.io/YOUR_PROJECT_NAME/">https://</a>USERNAME<a href="https://your_github_username.github.io/YOUR_PROJECT_NAME/">.github.io/</a>PROJECT_NAME<a href="https://your_github_username.github.io/YOUR_PROJECT_NAME/">/</a></pre><p>Following the above syntax, edit your package.json file to add a new entry with the URL of your project:</p><pre>&quot;homepage&quot;: &quot;https://USERNAME.github.io/PROJECT_NAME/&quot;</pre><p>Setting the homepage informs the npm run build to add the right paths to the HTML file generated in the build directory.</p><h3>Step 6. Commit and push.</h3><p>Add the new .travis.yml file to git, commit the repository and push it to GitHub. Travis will automatically start building, testing and deploying it.</p><pre>git add .<br>git commit -m &quot;Added the travis file and homepage&quot;<br>git push origin master</pre><p>Travis will queue your project and build it as soon as it can. You can follow the execution on your <a href="https://travis-ci.org/">home page</a>. Once tested and built — your project will update on GitHub in settings to show that it’s now hosted on GitHub Pages. A new branch called gh-pages is created on your repository. The page contains the output from the npm run build command.</p><h3><strong>All done!</strong></h3><p>Check the URL created above and you should see your app there. This is the app I used for the guide, feel free to use for reference: <a href="https://github.com/slavabez/medium-test-app">source code</a>, <a href="https://slavabez.github.io/medium-test-app/">page hosted on GitHub Pages</a> and the <a href="https://travis-ci.org/slavabez/medium-test-app/">Travis logs</a>.</p><h3>References:</h3><p>Travis CI Docs: <a href="https://docs.travis-ci.com/">https://docs.travis-ci.com/</a></p><p>Travis CI Docs - GitHub Pages deployment: <a href="https://docs.travis-ci.com/user/deployment/pages/">https://docs.travis-ci.com/user/deployment/pages/</a></p><p>Create-React-App Docs — Deployment: <a href="https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#github-pages">https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#github-pages</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4c32a34bcb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>