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
import { execFile } from 'child_process'; | |
import { JSDOM } from 'jsdom'; | |
const { Promise } = global; | |
const options = { resources: 'usable', runScripts: 'dangerously' }; | |
const server = execFile('node', [ './dist/server/index.js' ], { cwd: process.cwd() }); | |
const browser = { }; | |
beforeAll(async () => { |
var request = require('supertest'); | |
var fs = require('fs'); | |
var reqData = { | |
title: 'Rahh!', | |
fileName: 'test-image.jpeg' | |
}; | |
var req = request(context.app) //context.app = your express object | |
.post('/v1/images') |
'use strict' | |
const {logOnRequest} = require('pino-wrapper') | |
const app = require('express')() | |
app.use(logOnRequest()) // should attach a log instance to req.log |
{ | |
pid: 93535, | |
hostname: 'your host', | |
level: 30, | |
msg: 'my request', | |
time: '2016-03-07T12:21:48.766Z', | |
v: 0, | |
req: { | |
id: 42, | |
method: 'GET', |
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
sudo rabbitmqctl add_user {user} {password} | |
sudo rabbitmqctl set_user_tags {user} administrator | |
sudo rabbitmqctl set_permissions -p / {user} ".*" ".*" ".*" |
First, you have to enable profiling
> db.setProfilingLevel(1)
Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...
const R = require('ramda') | |
const assert = require('assert') | |
const body = '<h1>body</>' | |
const subject = '<h1> subject</h1>' | |
// function populateDefaults (profile) { | |
// const cloneProfile = R.clone(profile) | |
// if (!cloneProfile.template || !cloneProfile.template.products) { | |
// console.log('No template or no products') |
[Unit] | |
Description=Raddit application | |
After=network.target | |
[Service] | |
Type=simple | |
User=obeng | |
WorkingDirectory=/home/obeng/raddit | |
ExecStart=/bin/bash -lc 'puma' | |
Restart=always |