Is anyone doing CodeMirror development inside a docker container?
I was able to get everything setup and run the tests to get an “All passed” message.
However, when I add a failing test and run npm test again, it still returns “All passed”!
I’ve been able to get the tests running correctly on two different systems using “normal” (non-containerized) node.js installs.
See below for the contents of my Dockerfile, I’ve tried both the node:10-slim and the node:10 base images.
Any ideas or requests for more info would be appreciated.
FROM node:10-slim
EXPOSE 3000
RUN npm install -g nodemon
# Install PhantomJS dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
bzip2 \
libfontconfig1 \
fontconfig \
libfontconfig1-dev \
libfreetype6-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Don't run `npm install` or `npm run build` steps here.
# After running container, will need to `docker exec -it` into it and `npm install` then
# Run nodemon to have a long-lived process to keep container running
CMD [ "nodemon" ]
TL;DR - There’s nothing wrong with running the test suite inside a container.
I’m a very silly person who can’t see my own typo in the keyword function.
I finally spotted the error in the browser dev tools console.
All of this started so that I can have a CodeMirror dev repo on my VPS…without installing anything on my work laptop (the admins at my company are strict and I’m too cheap to buy my own).
But I certainly learned lots before fixing my typo!:
I changed my Dockerfile to use nodemon --inspector-brk=0.0.0.0 to start debugger and break on 1st line of node ./test/run.js
With the appropriate port available via an ssh-tunnel, I remotely connected from Chrome dev tools on my laptop to the container running on my VPS
Chrome has node-specific dev tools which appeared automatically as a green icon within the menus once I’d loaded 127.0.0.1:9229 in a new tab.
Breakpoints didn’t work, but I was able to single step through the running test suite and CodeMirror modules and look at stuff (I mostly just got more confused).
Somehow, I ended up unable to run npm test anymore from w/in my container, but while it was trying to run, I was able to load http://127.0.0.1:3000/test/index.html and run tests in browser.
That’s where I finally saw the console error in vim_test.js…ON THE EXACT LINE NUMBER WHERE I ADDED MY NEW TEST!!!
It was a SyntaxError: missing ) after argument list, which got me to a good page on MDN, but I still had trouble seeing my typo.
I also installed mosh on my VPS and the client chrome extension on my laptop (thankfully, I’m allowed to install my own extensions on the work laptop).
Mosh handles all network changes gracefully, no more dropped connections when switching wifi networks.
It’s nice to just leave that window open and not have to lose my place while looking through CodeMirror codebase
In the end, I didn’t even need the container, I added the path to /test/index.html under my CodeMirror dev directory as an nginx location so I can run tests in browser from my own custom URL.
So maybe my question should have been, “does it ever make sense to run CodeMirror tests from the command line?”.
I usually get an ‘All passed’ message on the CLI, even if there are failures running in the browser.
There’s probably a deep rabbit-hole here related to browser-version incompatabilites between Phantom running on the CLI and the current version of Chrome, so I won’t hold my breath waiting for an answer to that one.