{"id":78,"date":"2019-04-09T19:56:07","date_gmt":"2019-04-09T19:56:07","guid":{"rendered":"http:\/\/yer.ac\/blog\/?p=78"},"modified":"2019-04-10T10:58:03","modified_gmt":"2019-04-10T10:58:03","slug":"debugging-es6-mocha-unit-tests-using-vs-code","status":"publish","type":"post","link":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/","title":{"rendered":"Debugging ES6 Mocha unit tests using VS Code"},"content":{"rendered":"\n<p>The world of Mocha, VS Code and Node is still fairly new to me. Typically in the past all my JS unit tests have been debuggable in-browser using DevTools, but with Mocha this is not the case (As I am not deploying my spec files). I got Mocha to load via a launch config, but it would not originally work due to using ES6 directly.<\/p>\n\n\n\n<p><strong>If you do not have a launch.json, start here. Otherwise skip to the next section<\/strong>.  Add a new Debug Configuration by selecting &#8220;Debug&#8221;, and then &#8220;Add Configuration&#8221;. Selecting &#8220;Node.js&#8221; automatically creates a &#8220;launch.json&#8221; under a root folder named .vscode. If you already had debug set up, this step would be irrelevant.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add Mocha configuration to launch.json<\/h2>\n\n\n\n<p>In the launch.json, much like the surprisingly helpful comments suggest, you can simply type &#8220;Mocha&#8221; then [ctrl]+[space] to bring up the intellisense for a Mocha configuration!<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"292\" data-attachment-id=\"79\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/image-14\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=723%2C292&amp;ssl=1\" data-orig-size=\"723,292\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283&amp;ssl=1\" src=\"https:\/\/i2.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283\" alt=\"\" class=\"wp-image-79\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?w=723&amp;ssl=1 723w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=300%2C121&amp;ssl=1 300w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=700%2C283&amp;ssl=1 700w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/><\/figure>\n\n\n\n<p>Which will insert the appropriate snippet.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"484\" data-attachment-id=\"80\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/image-15\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-2.png?fit=753%2C484&amp;ssl=1\" data-orig-size=\"753,484\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-2.png?fit=700%2C450&amp;ssl=1\" src=\"https:\/\/i1.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-2.png?fit=700%2C450\" alt=\"\" class=\"wp-image-80\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-2.png?w=753&amp;ssl=1 753w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-2.png?resize=300%2C193&amp;ssl=1 300w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-2.png?resize=700%2C450&amp;ssl=1 700w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/figure>\n\n\n\n<p>Now, in theory it is as simple as clicking the play icon in debug, with &#8220;Mocha Tests&#8221; selected.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"275\" height=\"103\" data-attachment-id=\"81\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/image-16\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-3.png?fit=275%2C103&amp;ssl=1\" data-orig-size=\"275,103\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-3.png?fit=275%2C103&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-3.png?resize=275%2C103\" alt=\"\" class=\"wp-image-81\"\/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Supporting ES6.<\/h2>\n\n\n\n<p>For me however, this <strong>didn&#8217;t<\/strong> work. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"84\" data-attachment-id=\"82\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/image-17\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-4.png?fit=786%2C84&amp;ssl=1\" data-orig-size=\"786,84\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-4.png?fit=700%2C75&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-4.png?fit=700%2C75\" alt=\"\" class=\"wp-image-82\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-4.png?w=786&amp;ssl=1 786w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-4.png?resize=300%2C32&amp;ssl=1 300w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-4.png?resize=768%2C82&amp;ssl=1 768w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-4.png?resize=700%2C75&amp;ssl=1 700w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/figure>\n\n\n\n<p>The issue here is that I get a lot of unexpected token errors as my tests are using ES6 and I suspect that by default it wants to use ES5. The issue of using ES6 for unit tests was resolved in another <a href=\"http:\/\/yer.ac\/blog\/2019\/04\/08\/attempting-to-use-mocha-chai-to-unit-test-es6\/\">post<\/a> .<\/p>\n\n\n\n<p>Much like my previous post, I can update the launch arguments to use require to pull in the same 2 Babel modules, and will also specify a wild card file name of my tests so it doesn&#8217;t pick up any other code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"Mocha Tests\",\n            \"program\": \"${workspaceFolder}\/node_modules\/mocha\/bin\/_mocha\",\n            \"args\": [\n                \".\/test\/**\/*.spec.js\",\n                \"--require\", \"@babel\/polyfill\",\n                \"--require\", \"@babel\/register\",\n                \"-u\",\n                \"tdd\",\n                \"--timeout\",\n                \"999999\",\n                \"--colors\",           \n            ],\n            \"internalConsoleOptions\": \"openOnSessionStart\"\n        }<\/code><\/pre>\n\n\n\n<p>Now for me, this also didn&#8217;t work as I am using Chai for my BDD test syntax.<\/p>\n\n\n\n<p>For this I had to change &#8220;tdd&#8221; to &#8220;bdd&#8221; under the args.<\/p>\n\n\n\n<p>Now I can attach and debug, providing a breakpoint is set!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The world of Mocha, VS Code and Node is still fairly new to me. Typically in the past all my JS unit tests have been debuggable in-browser using DevTools, but with Mocha this is not the case (As I am not deploying my spec files). I got Mocha to load via a launch config, but &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,11],"tags":[16,12,13,14],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-development","category-testing","tag-es6","tag-javascript","tag-mocha","tag-vscode"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Debugging ES6 Mocha unit tests using VS Code - yer.ac | Adventures of a developer, and other things.<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Debugging ES6 Mocha unit tests using VS Code - yer.ac | Adventures of a developer, and other things.\" \/>\n<meta property=\"og:description\" content=\"The world of Mocha, VS Code and Node is still fairly new to me. Typically in the past all my JS unit tests have been debuggable in-browser using DevTools, but with Mocha this is not the case (As I am not deploying my spec files). I got Mocha to load via a launch config, but &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/\" \/>\n<meta property=\"og:site_name\" content=\"yer.ac | Adventures of a developer, and other things.\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-09T19:56:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-10T10:58:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i2.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283\" \/>\n<meta name=\"author\" content=\"yer.ac\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"yer.ac\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/\"},\"author\":{\"name\":\"yer.ac\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"headline\":\"Debugging ES6 Mocha unit tests using VS Code\",\"datePublished\":\"2019-04-09T19:56:07+00:00\",\"dateModified\":\"2019-04-10T10:58:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/\"},\"wordCount\":320,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i2.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/image-1.png?fit=700%2C283\",\"keywords\":[\"ES6\",\"Javascript\",\"Mocha\",\"VSCODE\"],\"articleSection\":[\"Development\",\"Testing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/\",\"name\":\"Debugging ES6 Mocha unit tests using VS Code - yer.ac | Adventures of a developer, and other things.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i2.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/image-1.png?fit=700%2C283\",\"datePublished\":\"2019-04-09T19:56:07+00:00\",\"dateModified\":\"2019-04-10T10:58:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i2.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/image-1.png?fit=700%2C283\",\"contentUrl\":\"https:\\\/\\\/i2.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/image-1.png?fit=700%2C283\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/04\\\/09\\\/debugging-es6-mocha-unit-tests-using-vs-code\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Debugging ES6 Mocha unit tests using VS Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\",\"name\":\"yer.ac | Adventures of a developer, and other things.\",\"description\":\"Blog to keep track of things I am upto\",\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/yer.ac\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\",\"name\":\"yer.ac\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"caption\":\"yer.ac\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Debugging ES6 Mocha unit tests using VS Code - yer.ac | Adventures of a developer, and other things.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/","og_locale":"en_US","og_type":"article","og_title":"Debugging ES6 Mocha unit tests using VS Code - yer.ac | Adventures of a developer, and other things.","og_description":"The world of Mocha, VS Code and Node is still fairly new to me. Typically in the past all my JS unit tests have been debuggable in-browser using DevTools, but with Mocha this is not the case (As I am not deploying my spec files). I got Mocha to load via a launch config, but &hellip;","og_url":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/","og_site_name":"yer.ac | Adventures of a developer, and other things.","article_published_time":"2019-04-09T19:56:07+00:00","article_modified_time":"2019-04-10T10:58:03+00:00","og_image":[{"url":"https:\/\/i2.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283","type":"","width":"","height":""}],"author":"yer.ac","twitter_card":"summary_large_image","twitter_misc":{"Written by":"yer.ac","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#article","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/"},"author":{"name":"yer.ac","@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"headline":"Debugging ES6 Mocha unit tests using VS Code","datePublished":"2019-04-09T19:56:07+00:00","dateModified":"2019-04-10T10:58:03+00:00","mainEntityOfPage":{"@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/"},"wordCount":320,"commentCount":2,"publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"image":{"@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#primaryimage"},"thumbnailUrl":"https:\/\/i2.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283","keywords":["ES6","Javascript","Mocha","VSCODE"],"articleSection":["Development","Testing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/","url":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/","name":"Debugging ES6 Mocha unit tests using VS Code - yer.ac | Adventures of a developer, and other things.","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#primaryimage"},"image":{"@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#primaryimage"},"thumbnailUrl":"https:\/\/i2.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283","datePublished":"2019-04-09T19:56:07+00:00","dateModified":"2019-04-10T10:58:03+00:00","breadcrumb":{"@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#primaryimage","url":"https:\/\/i2.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283","contentUrl":"https:\/\/i2.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?fit=700%2C283"},{"@type":"BreadcrumbList","@id":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/yer.ac\/blog\/"},{"@type":"ListItem","position":2,"name":"Debugging ES6 Mocha unit tests using VS Code"}]},{"@type":"WebSite","@id":"https:\/\/yer.ac\/blog\/#website","url":"https:\/\/yer.ac\/blog\/","name":"yer.ac | Adventures of a developer, and other things.","description":"Blog to keep track of things I am upto","publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/yer.ac\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d","name":"yer.ac","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","caption":"yer.ac"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paP5IW-1g","jetpack-related-posts":[{"id":69,"url":"https:\/\/yer.ac\/blog\/2019\/04\/08\/attempting-to-use-mocha-chai-to-unit-test-es6\/","url_meta":{"origin":78,"position":0},"title":"Attempting to use Mocha &#038; Chai to unit test ES6.","author":"yer.ac","date":"April 8, 2019","format":false,"excerpt":"In this post I will cover using Mocha (JS test framework) and Chai (For BDD syntax) to unit test ES6 Javascript in VS Code. I started working on a small side project, for no reason other than to play with ES6+. It's a(nother) relatively simple toast library written in as\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":112,"url":"https:\/\/yer.ac\/blog\/2019\/05\/29\/remote-nlog-logging-with-azure-functions-part-one\/","url_meta":{"origin":78,"position":1},"title":"Remote NLOG logging with Azure Functions (Part one).","author":"yer.ac","date":"May 29, 2019","format":false,"excerpt":"Part of a journey I was on today to learn about Azure Functions and Cosmos DB. The final code for the Azure Functions element can be found on https:\/\/github.com\/Wabbbit\/AzLog Part one: Setup, Creating my first function, forwarding NLOG events and deploying to Azure within VS Code.Part two: persisting the incoming\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/yer.ac\/blog\/category\/development\/azure\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-4.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":599,"url":"https:\/\/yer.ac\/blog\/2026\/01\/23\/from-acceptance-criteria-to-playwright-tests-with-mcp\/","url_meta":{"origin":78,"position":2},"title":"From Acceptance Criteria to Playwright Tests with MCP","author":"yer.ac","date":"January 23, 2026","format":false,"excerpt":"Modern UI test tooling has quietly raised the bar for who can participate. Playwright is powerful, but it assumes comfort with TypeScript, selectors, repo structure, and terminal use. That gap often collapses testing back onto developers, creating pressure to almost validate their own work. This proof of concept explores using\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/yer.ac\/blog\/category\/development\/ai\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":315,"url":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/","url_meta":{"origin":78,"position":3},"title":"Ensuring &#8220;dotnet test&#8221; TRX &#038; Coverage files end up in SonarQube","author":"yer.ac","date":"October 16, 2019","format":false,"excerpt":"I have written before about using SonarQube to do static analysis, but one issue I never came back to was ensuring that code coverage files generated via a build pipeline end up being picked up by the Sonar Scanner to assess code coverage. Note that the following I am actually\u2026","rel":"","context":"In &quot;DevOps&quot;","block_context":{"text":"DevOps","link":"https:\/\/yer.ac\/blog\/category\/devops\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":151,"url":"https:\/\/yer.ac\/blog\/2019\/05\/29\/remote-nlog-logging-with-azure-functions-part-two-persisting-data-into-azure-cosmos-db\/","url_meta":{"origin":78,"position":4},"title":"Remote NLOG logging with Azure Functions (Part two) &#8211; Persisting data into Azure Cosmos DB.","author":"yer.ac","date":"May 29, 2019","format":false,"excerpt":"Last time, I got a very basic C# Azure Function hooked up to accept a request from an NLOG web service target. This time, I will be attempting to persist(insert) the incoming log information into an Azure Cosmos database container, direct from my Azure Function in VS Code. Disclaimer: This\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/yer.ac\/blog\/category\/development\/azure\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":285,"url":"https:\/\/yer.ac\/blog\/2019\/07\/31\/setting-up-a-self-hosted-build-agent-for-azure-devops\/","url_meta":{"origin":78,"position":5},"title":"Setting up a self-hosted build agent for Azure DevOps","author":"yer.ac","date":"July 31, 2019","format":false,"excerpt":"Azure DevOps has brilliant build pipeline options and as easy as it is to get set up with their hosted build agents, it can get quite costly rather quick. In this post I cover off setting up a self-hosted build agent for use with Azure. This post won't cover setting\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/yer.ac\/blog\/category\/development\/azure\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/07\/image.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":2,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}