Karma – 0 tests completed

Running unit testing with Karma on Google Chrome browser on a Angular 2 application.

No tests were running 😥

SUMMARY:
√ 0 tests completed

In the Chrome window, the console said

Refused to execute script from 'http://localhost:9876/base/src/tests/test.ts?b58784c03c82bb3f722dcb6d25bd26cdf145b12b' because its MIME type ('video/mp2t') is not executable

I found a solution here saying that I just need to add the following line to karma.conf.js

mime: {
'text/x-typescript': ['ts','tsx']
},

Docker – boot2docker -Share folder

To share another folder than the default one (C:\Users)

First, add the folder to share in VirtualBox

boot2docker-share-drive

Than, connect to the docker VM by running

docker-machine ssh

There you need to run

sudo mkdir --parents //d/tangu
sudo mount -t vboxsf tangu //d/tangu

The first command create the folder where the shared drive will be mounted and the second command actually mount the shared drive.

Of course you’ll need to adapt the paths I used here to match yours.
Note that the mount command takes as arguments

  • -t specifies the filesystem. Here its the one from virtualbox
  • tangu is the named of the shared folder defined in virtual box
  • //d/tangu is the destination of the mount shared drive that was created by the first command

You don’t want to type those commands everytime

Add those lines between the step STEP=”Checking status on $VM” and the step STEP=”Setting env” :

STEP="Mounting web directory"
"${DOCKER_MACHINE}" ssh default 'sudo mkdir --parents //d/tangu'
"${DOCKER_MACHINE}" ssh default 'sudo mount -t vboxsf tangu //d/tangu'

To the file start.sh located where you installed Docker Toolbox

Now everytime you will start boot2docker, it will auto mount this shared folder.

Credits : https://github.com/docker/machine/issues/1814#issuecomment-239957893