1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-01 16:46:54 +03:00
Files
node-redis/test/good_traces.spec.js
Ruben Bridgewater 2b4ab10305 chore - remove standard and use individual config
Standard is not as up to date and still uses a old eslint version.
Instead, use the airbnb default with a couple of modifications.

All required changes are included.
2017-11-28 21:38:21 -02:00

61 lines
1.4 KiB
JavaScript

'use strict'
const assert = require('assert')
const config = require('./lib/config')
const helper = require('./helper')
const { fork } = require('child_process')
const { redis } = config
describe('stack traces', () => {
it('should return good traces with NODE_ENV=development set', (done) => {
const external = fork('./test/lib/good-traces.js', {
env: {
NODE_ENV: 'development'
}
})
const id = setTimeout(() => {
external.kill()
done(new Error('Timeout'))
}, 6000)
external.on('close', (code) => {
clearTimeout(id)
assert.strictEqual(code, 0)
done()
})
})
it('should return good traces with NODE_DEBUG=redis env set', (done) => {
const external = fork('./test/lib/good-traces.js', {
env: {
NODE_DEBUG: 'redis'
},
silent: true
})
const id = setTimeout(() => {
external.kill()
done(new Error('Timeout'))
}, 6000)
external.on('close', (code) => {
clearTimeout(id)
assert.strictEqual(code, 0)
done()
})
})
// This is always going to return good stack traces
it('should always return good stack traces for rejected offline commands', () => {
const client = redis.createClient({
enableOfflineQueue: false
})
return client.set('foo').then(helper.fail).catch((err) => {
assert(/good_traces.spec.js/.test(err.stack))
return client.quit()
})
})
})