-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathsnapshot-pruning.spec.js
41 lines (36 loc) · 1.18 KB
/
snapshot-pruning.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict'
const { assert } = require('chai')
const { setup } = require('./utils')
describe('Dynamic Instrumentation', function () {
const t = setup()
describe('input messages', function () {
describe('with snapshot', function () {
beforeEach(t.triggerBreakpoint)
it('should prune snapshot if payload is too large', function (done) {
t.agent.on('debugger-input', ({ payload: [payload] }) => {
assert.isBelow(Buffer.byteLength(JSON.stringify(payload)), 1024 * 1024) // 1MB
assert.deepEqual(payload['debugger.snapshot'].captures, {
lines: {
[t.breakpoint.line]: {
locals: {
notCapturedReason: 'Snapshot was too large',
size: 6
}
}
}
})
done()
})
t.agent.addRemoteConfig(t.generateRemoteConfig({
captureSnapshot: true,
capture: {
// ensure we get a large snapshot
maxCollectionSize: Number.MAX_SAFE_INTEGER,
maxFieldCount: Number.MAX_SAFE_INTEGER,
maxLength: Number.MAX_SAFE_INTEGER
}
}))
})
})
})
})