Here's an example of how to debug Mocha v4 if it hangs.
Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).
If you run your test, you'll notice it hangs:
$ mocha test.js
// A SO answer to https://stackoverflow.com/questions/286141/remove-blank-attributes-from-an-object-in-javascript | |
// based off the recursive cleanEmpty function by @chickens. | |
// This one can also handle Date objects correctly | |
// and has a defaults list for values you want stripped. | |
const cleanEmpty = function(obj, defaults = [undefined, null, NaN, '']) { | |
if (defaults.includes(obj)) return | |
if (Array.isArray(obj)) | |
return obj |
Here's an example of how to debug Mocha v4 if it hangs.
Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).
If you run your test, you'll notice it hangs:
$ mocha test.js
A collection of links to the "Master the JavaScript Interview" series of medium stories by Eric Elliott.
A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.
Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.
If you are learning npm then i would suggest to go for yarn, dont waste your time in learning npm
npm install -g npm
# Downgrade to a specific version
# start nodeenv virtual env if it exists | |
# for whenever you open integrated terminal in vscode | |
if [ -d ".nenv" ]; then | |
. ".nenv/bin/activate" | |
fi |
docker run -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb |
for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done |
# Export the vars in .env into your shell: | |
export $(egrep -v '^#' .env | xargs) |
# ./my_script.sh --arg1 value1 --arg2 value2 --arg3 value3 | |
# ./my_script.sh -a value1 -b value2 -c value3 | |
#!/usr/bin/env bash | |
while [[ "$#" -gt 0 ]]; do case $1 in | |
-a|--arg1) var1="$2"; shift;; | |
-b|--arg2) var2="$2"; shift;; | |
-c|--arg3) var3="$2"; shift;; | |
*) echo "Unknown parameter passed: $1"; exit 1;; | |
esac; shift; done |