Skip to content

Commit

Permalink
test: add test for object type RemoteObject serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
cola119 committed Mar 21, 2022
1 parent b35ee26 commit 1d0da48
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions test/parallel/test-debugger-object-type-remote-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

const fixtures = require('../common/fixtures');
const startCLI = require('../common/debugger');

const assert = require('assert');

const cli = startCLI([fixtures.path('debugger/empty.js')]);

function onFatal(error) {
cli.quit();
throw error;
}

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => cli.command('exec new Date(0)'))
.then(() => assert.match(cli.output, /1970-01-01T00:00:00\.000Z/))
.then(() => cli.command('exec null'))
.then(() => assert.match(cli.output, /null/))
.then(() => cli.command('exec /regex/g'))
.then(() => assert.match(cli.output, /\/regex\/g/))
.then(() => cli.command('exec new Map()'))
.then(() => assert.match(cli.output, /{ size: 0 }/))
.then(() => cli.command('exec new Map([["a",1],["b",2]])'))
.then(() => assert.match(cli.output, /{ size: 2 }/))
.then(() => cli.command('exec new Set()'))
.then(() => assert.match(cli.output, /{ size: 0 }/))
.then(() => cli.command('exec new Set([1,2])'))
.then(() => assert.match(cli.output, /{ size: 2 }/))
.then(() => cli.command('exec new Set([{a:1},new Set([1])])'))
.then(() => assert.match(cli.output, /{ size: 2 }/))
.then(() => cli.command('exec a={}; a'))
.then(() => assert.match(cli.output, /{ {2}}/))
.then(() => cli.command('exec a={a:1,b:{c:1}}; a'))
.then(() => assert.match(cli.output, /{ a: 1, b: Object }/))
.then(() => cli.command('exec a=[]; a'))
.then(() => assert.match(cli.output, /\[ {2}\]/))
.then(() => cli.command('exec a=[1,2]; a'))
.then(() => assert.match(cli.output, /\[ 1, 2 \]/))
.then(() => cli.quit())
.then(null, onFatal);

0 comments on commit 1d0da48

Please sign in to comment.