alexanderzeitler.com - Debugging mocha tests in a Docker container using Visual Studio Code









Search Preview

Debugging mocha tests in a Docker container using Visual Studio Code | Alexander Zeitler

alexanderzeitler.com

.com > alexanderzeitler.com

SEO audit: Content analysis

Language Error! No language localisation is found.
Title Debugging mocha tests in a Docker container using Visual Studio Code | Alexander Zeitler
Text / HTML ratio 42 %
Frame Excellent! The website does not use iFrame solutions.
Flash Excellent! The website does not have any flash contents.
Keywords cloud container mocha Docker Visual Studio debugging inside tests Code app debug test running F5 run express => containers vscodemocha task
Keywords consistency
Keyword Content Title Description Headings
container 16
mocha 11
Docker 9
Visual 8
Studio 8
debugging 8
Headings
H1 H2 H3 H4 H5 H6
1 0 0 0 0 0
Images We found 3 images on this web page.

SEO Keywords (Single)

Keyword Occurrence Density
container 16 0.80 %
mocha 11 0.55 %
Docker 9 0.45 %
Visual 8 0.40 %
Studio 8 0.40 %
debugging 8 0.40 %
inside 8 0.40 %
tests 8 0.40 %
Code 7 0.35 %
app 7 0.35 %
debug 6 0.30 %
test 5 0.25 %
running 3 0.15 %
F5 3 0.15 %
run 3 0.15 %
express 3 0.15 %
=> 3 0.15 %
containers 3 0.15 %
vscodemocha 3 0.15 %
task 3 0.15 %

SEO Keywords (Two Word)

Keyword Occurrence Density
the container 9 0.45 %
Visual Studio 8 0.40 %
mocha tests 7 0.35 %
inside the 6 0.30 %
Studio Code 6 0.30 %
a Docker 5 0.25 %
Docker container 4 0.20 %
to debug 4 0.20 %
in a 3 0.15 %
want to 3 0.15 %
have a 3 0.15 %
the end 2 0.10 %
hit F5 2 0.10 %
In the 2 0.10 %
in the 2 0.10 %
tests using 2 0.10 %
As I 2 0.10 %
I have 2 0.10 %
debug the 2 0.10 %
to have 2 0.10 %

SEO Keywords (Three Word)

Keyword Occurrence Density Possible Spam
Visual Studio Code 6 0.30 % No
a Docker container 4 0.20 % No
inside the container 3 0.15 % No
in a Docker 3 0.15 % No
Visual Studio code 2 0.10 % No
mocha tests using 2 0.10 % No
Start the container 2 0.10 % No
want to debug 2 0.10 % No
mocha inside the 2 0.10 % No
Studio Code to 2 0.10 % No
In the end 2 0.10 % No
using Visual Studio 2 0.10 % No
debugging mocha tests 2 0.10 % No
Attach Visual Studio 2 0.10 % No
code and debug 2 0.10 % No
debug the test 2 0.10 % No
and debug the 2 0.10 % No
Studio code and 2 0.10 % No
could even use 1 0.05 % No
at all Whatever 1 0.05 % No

SEO Keywords (Four Word)

Keyword Occurrence Density Possible Spam
in a Docker container 3 0.15 % No
mocha inside the container 2 0.10 % No
Visual Studio Code to 2 0.10 % No
Attach Visual Studio code 2 0.10 % No
Visual Studio code and 2 0.10 % No
Studio code and debug 2 0.10 % No
code and debug the 2 0.10 % No
and debug the test 2 0.10 % No
using Visual Studio Code 2 0.10 % No
Toggle navigation Home Feed 1 0.05 % No
at all Whatever automation 1 0.05 % No
all Whatever automation you 1 0.05 % No
Whatever automation you choose 1 0.05 % No
automation you choose here 1 0.05 % No
you choose here are 1 0.05 % No
choose here are the 1 0.05 % No
to build and run 1 0.05 % No
here are the commands 1 0.05 % No
are the commands to 1 0.05 % No
the commands to build 1 0.05 % No

Internal links in - alexanderzeitler.com

Fixing Chrome 58+ [missing_subjectAltName] with openssl when using self signed certificates
Fixing Chrome 58+ [missing_subjectAltName] with openssl when using self signed certificates | Alexander Zeitler
Accessing an HTTP API running on your MacBook in a Docker container from your iPhone/iPad using dnsmasq
Accessing an HTTP API running on your MacBook in a Docker container from your iPhone/iPad using dnsmasq | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM
Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM | Alexander Zeitler
Deploying Ubuntu Mate Desktop as a developer environment in AWS EC2
Deploying Ubuntu Mate Desktop as a developer environment in AWS EC2 | Alexander Zeitler
Debugging mocha tests in a Docker container using Visual Studio Code
Debugging mocha tests in a Docker container using Visual Studio Code | Alexander Zeitler
Debugging mocha tests with Visual Studio Code when Node.js is installed using nvm
Debugging mocha tests with Visual Studio Code when Node.js is installed using nvm | Alexander Zeitler
Debugging a ES6 Node.js application in a Docker container using Visual Studio Code
Debugging a ES6 Node.js application in a Docker container using Visual Studio Code | Alexander Zeitler
Some thoughts on Open Source Software
Some thoughts on Open Source Software | Alexander Zeitler
Resizing a VMware Workstation VM partition using GParted - get the swap partition out of my way!
Resizing a VMware Workstation VM partition using GParted - get the swap partition out of my way! | Alexander Zeitler
Workflows: using Docker Machine and Docker Compose together in development
Workflows: using Docker Machine and Docker Compose together in development | Alexander Zeitler
Chrome crashes on Ubuntu in VMware Workstation
Chrome crashes on Ubuntu in VMware Workstation | Alexander Zeitler
Rename Visual Studio project including files, folders and namespaces
Rename Visual Studio project including files, folders and namespaces | Alexander Zeitler
A lap around AWS and docker-machine
A lap around AWS and docker-machine | Alexander Zeitler
Integration-testing ASP.NET 5 / MVC 6 Controllers on DNX Beta 4
Integration-testing ASP.NET 5 / MVC 6 Controllers on DNX Beta 4 | Alexander Zeitler
Deploying a ASP.NET MVC 6 API as Azure API App in Azure App Services
Deploying a ASP.NET MVC 6 API as Azure API App in Azure App Services | Alexander Zeitler
lowerCamelCase JSON with ASP.NET MVC 6
lowerCamelCase JSON with ASP.NET MVC 6 | Alexander Zeitler
Running ASP.NET 5 Beta 4 in Docker with DNX runtime #aspnet5 #docker
Running ASP.NET 5 Beta 4 in Docker with DNX runtime #aspnet5 #docker | Alexander Zeitler
Stop complaining or improve yourself
Stop complaining or improve yourself | Alexander Zeitler
#NodeJS / #ExpressJS: Adding routes dynamically at runtime
#NodeJS / #ExpressJS: Adding routes dynamically at runtime | Alexander Zeitler
mongoose: Referencing schema in properties or arrays
mongoose: Referencing schema in properties or arrays | Alexander Zeitler
MongoDB development environment journal size management using mongoctl
MongoDB development environment journal size management using mongoctl | Alexander Zeitler
Farewell...
Farewell... | Alexander Zeitler
Inspecting AngularJS $scope using Firebug and Chrome Developer Tools
Inspecting AngularJS $scope using Firebug and Chrome Developer Tools | Alexander Zeitler
Useful @Brackets extensions for Web Developers
Useful @Brackets extensions for Web Developers | Alexander Zeitler
.NET User Group Karlsruhe: StreamInsight: Complex Event Processing by Microsoft
.NET User Group Karlsruhe: StreamInsight: Complex Event Processing by Microsoft | Alexander Zeitler
“Commit all must be called when a managed buffer has focus” in Microsoft SQL Server Data Tools
“Commit all must be called when a managed buffer has focus” in Microsoft SQL Server Data Tools | Alexander Zeitler
.NET User Group Karlsruhe: Git
.NET User Group Karlsruhe: Git | Alexander Zeitler
Open Source Windows 8 App: Sprudelsuche
Open Source Windows 8 App: Sprudelsuche | Alexander Zeitler
Open Source– Scheissegal?
Open Source– Scheissegal? | Alexander Zeitler
Lowercase JSON with ASP.NET Web API
Lowercase JSON with ASP.NET Web API | Alexander Zeitler
.NET Usergroup Karlsruhe: Think Big – Entwicklung skalierbarer Anwendungen mit Windows Azure
.NET Usergroup Karlsruhe: Think Big – Entwicklung skalierbarer Anwendungen mit Windows Azure | Alexander Zeitler
ASP.NET Web API and RavenDb
ASP.NET Web API and RavenDb | Alexander Zeitler
ASP.NET Web API Round-Up Slides
ASP.NET Web API Round-Up Slides | Alexander Zeitler
ASP.NET MVC 4 public beta including ASP.NET Web API
ASP.NET MVC 4 public beta including ASP.NET Web API | Alexander Zeitler
Hash Bang Urls in Single Page Applications mit ASP.NET MVC
Hash Bang Urls in Single Page Applications mit ASP.NET MVC | Alexander Zeitler
.NET User Group Karlsruhe: Know your Tools
.NET User Group Karlsruhe: Know your Tools | Alexander Zeitler
Git flow init liefert: flags: FATAL unable to determine getopt version unter Cygwin
Git flow init liefert: flags: FATAL unable to determine getopt version unter Cygwin | Alexander Zeitler
Using JsonValue and JsonArray in WCF Web API
Using JsonValue and JsonArray in WCF Web API | Alexander Zeitler
.NET User Group Karlsruhe: PowerShell 3.. 2.. 1..
.NET User Group Karlsruhe: PowerShell 3.. 2.. 1.. | Alexander Zeitler
What’s new in WCF Web API Preview 5 – introducing the test client
What’s new in WCF Web API Preview 5 – introducing the test client | Alexander Zeitler
Externe Templates in KnockoutJS laden
Externe Templates in KnockoutJS laden | Alexander Zeitler
WCF Web API: Role based access control with basic authentication
WCF Web API: Role based access control with basic authentication | Alexander Zeitler
.NET User Group Karlsruhe: Produce Cleaner Code with Aspect-Oriented Programming (AOP)
.NET User Group Karlsruhe: Produce Cleaner Code with Aspect-Oriented Programming (AOP) | Alexander Zeitler
REST using the WCF Web API – POST it!
REST using the WCF Web API – POST it! | Alexander Zeitler
REST using the WCF Web API – getting more RESTful responses (Part 5)
REST using the WCF Web API – getting more RESTful responses (Part 5) | Alexander Zeitler
TypeLoadException when mocking COM objects - Could not load type … from assembly. The type is marked…
TypeLoadException when mocking COM objects - Could not load type … from assembly. The type is marked… | Alexander Zeitler
REST using the WCF Web API – getting RESTful the BDD way (Part 4)
REST using the WCF Web API – getting RESTful the BDD way (Part 4) | Alexander Zeitler
REST using the WCF Web API – refactoring to IoC style (Part 3)
REST using the WCF Web API – refactoring to IoC style (Part 3) | Alexander Zeitler
REST using the WCF Web API – Basics (Part2)
REST using the WCF Web API – Basics (Part2) | Alexander Zeitler
Microsoft Web API – the REST is done by WCF (Part 1)
Microsoft Web API – the REST is done by WCF (Part 1) | Alexander Zeitler
Microsoft Web API – den REST macht WCF (Teil 1)
Microsoft Web API – den REST macht WCF (Teil 1) | Alexander Zeitler
.NET User Group Karlsruhe: Flexible Softwarearchitekturen mit Inversion of Control (IoC)
.NET User Group Karlsruhe: Flexible Softwarearchitekturen mit Inversion of Control (IoC) | Alexander Zeitler
machine.fakes ReSharper Templates
machine.fakes ReSharper Templates | Alexander Zeitler
CreateCert.cmd aus dem Windows Azure Platform Training Kit funktioniert nicht
CreateCert.cmd aus dem Windows Azure Platform Training Kit funktioniert nicht | Alexander Zeitler
JSON via jQuery direkt an einen ASP.NET MVC 3 Controller senden
JSON via jQuery direkt an einen ASP.NET MVC 3 Controller senden | Alexander Zeitler
POSTing Json data using the HttpClient from WCF Web API
POSTing Json data using the HttpClient from WCF Web API | Alexander Zeitler
Using the new WCF Web APIs HttpClient with ASP.NET Forms Authentication
Using the new WCF Web APIs HttpClient with ASP.NET Forms Authentication | Alexander Zeitler
Keyboard Jedi unter x64
Keyboard Jedi unter x64 | Alexander Zeitler
Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication
Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication | Alexander Zeitler
WCF Web APIs / WCF Http mit ASP.NET Forms Authentication verwenden
WCF Web APIs / WCF Http mit ASP.NET Forms Authentication verwenden | Alexander Zeitler
ILSpy – Open Source .NET Assembly Browser und Decompiler
ILSpy – Open Source .NET Assembly Browser und Decompiler | Alexander Zeitler

Alexanderzeitler.com Spined HTML


Debugging mocha tests in a Docker container using Visual StudioLawmaking| Alexander Zeitler Toggle navigation Home Feed Debugging mocha tests in a Docker container using Visual StudioLawmakingWritten on April 10, 2016 In a current Node.js / Docker consumer project I had to debug some mocha tests considering Docker containers use UTC and you know: that timezone stuff... In the end, I was debugging my mocha tests using WebStorm and node-inspector inside the containers and got stuff running. As I have been playing virtually with Visual StudioLawmakingrecently and debugging Node.js in Docker containers as well as debugging mocha tests (both using VS Code), this thought came up: "how would I be worldly-wise to debug mocha tests using Visual StudioLawmakingin Docker containers?" In the end, it worked out to be pretty staight forwarded. Make sure to have ES6 enabled in jsconfig.json for the sample code: { "compilerOptions": { "target": "ES6", "module": "commonjs" } } First, I have a little express using inside ./index.js: const express = require('express'); const app = express(); app.get('/', (req, res) => { res.status(200).send('hello world'); }) app.listen(3000); This using isn't really required for our tests but my same scenario was like it. Furthermore we need a process that prevents our container from exiting without he has been started, so we'll stick with that little app. Next, we have a Dockerfile: FROM node:4.2.3 EXPOSE 3000 EXPOSE 5858 COPY . /app WORKDIR /app RUN cd /app; npm install CMD ["node","index.js"] As this post is well-nigh debugging mocha tests, here's our little test (./test/test.js) we want to debug inside the container: const predicate = require('assert'); describe('Truth', () => { it('should be told', (done) => { assert.equal(true, true) done() }) }) The idea of how I want to debug this test inside a Docker container is as follows: Start the container Run mocha inside the container with --debug-brk at port 5858 to wait for Visual StudioLawmakingto nail to the debuggerNailVisual Studio lawmaking and debug the test There is flipside viable method: Don't use our app in index.js Call mocha with --debug-brk and port 5858 in the Dockerfile CMD Start the containerNailVisual Studio lawmaking and debug the test As I don't want to have a container defended for debugging of mocha tests, I prefer the first version. Starting the container consists of towers the image and running the container. This can be hands streamlined using nodemon, grunt-watch or something similar. You could plane use a Docker Volume and not restart the container at all. Whatever automation you choose, here are the commands to build and run the container: $ docker build -t vscodemocha . $ docker run -d --name vscodemocha -p 3000:3000 -p 5858:5858 vscodemocha With our container stuff up and running, we can configure Visual StudioLawmakingto run mocha inside the container. The Visual StudioLawmakingnail Configuration allows to provide a preLaunchTask which is a task that can be specified inside the tasks configuration in tasks.json. So we'll simply create a runmochaindocker task based on the whack writ in tasks.json (inside the .vscode folder): { "version": "0.1.0", "isShellCommand": true, "command": "bash", "args": [ "-c" ], "tasks": [ { "taskName": "runmochaindocker", "showOutput": "always", "suppressTaskName": true, "args": [ "docker exec -i vscodemocha whack -c "./node_modules/mocha/bin/mocha --debug-brk=5858 -t 10000 test/test.js"" ] } ] } Having that done, we're now referencing that task in the nail configuration in launch.json: { "version": "0.2.0", "configurations": [ { "name": "Attach to Mocha in Docker", "type": "node", "request": "attach", "port": 5858, "preLaunchTask": "runmochaindocker", "address": "localhost", "restart": false, "sourceMaps": false, "outDir": null, "localRoot": "${workspaceRoot}/", "remoteRoot": "/app/" } ] } As once said, runmochaindocker now is specified as a preLaunchTask. And as once described in my recent post on debugging a Node.js app in a Docker container, I set localRoot and remoteRoot accordingly. Guess what? We're done! Just hit F5 now, and you'll get this: Then, hit F5 again: (To be honest, I'm not sure why the debugger breaks here - but we can ignore that). Hit F5 one last time, and we're there: debugging our mocha test in a Docker container: Happy debugging! Please enable JavaScript to view the comments powered by Disqus. Copyright © Alexander Zeitler 2003 - 2016 | Impressum