chore: remove BigInt exists checks (#9744)

This commit is contained in:
Nikolay Vitkov 2023-02-24 19:26:29 +01:00 committed by GitHub
parent 415da92300
commit 3db7d55d26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -72,7 +72,7 @@ export function valueFromRemoteObject(
): any { ): any {
assert(!remoteObject.objectId, 'Cannot extract value when objectId is given'); assert(!remoteObject.objectId, 'Cannot extract value when objectId is given');
if (remoteObject.unserializableValue) { if (remoteObject.unserializableValue) {
if (remoteObject.type === 'bigint' && typeof BigInt !== 'undefined') { if (remoteObject.type === 'bigint') {
return BigInt(remoteObject.unserializableValue.replace('n', '')); return BigInt(remoteObject.unserializableValue.replace('n', ''));
} }
switch (remoteObject.unserializableValue) { switch (remoteObject.unserializableValue) {

View File

@ -23,8 +23,6 @@ import {
} from './mocha-utils.js'; } from './mocha-utils.js';
import utils from './utils.js'; import utils from './utils.js';
const bigint = typeof BigInt !== 'undefined';
describe('Evaluation specs', function () { describe('Evaluation specs', function () {
setupTestBrowserHooks(); setupTestBrowserHooks();
setupTestPageAndContextHooks(); setupTestPageAndContextHooks();
@ -38,7 +36,7 @@ describe('Evaluation specs', function () {
}); });
expect(result).toBe(21); expect(result).toBe(21);
}); });
(bigint ? it : it.skip)('should transfer BigInt', async () => { it('should transfer BigInt', async () => {
const {page} = getTestState(); const {page} = getTestState();
const result = await page.evaluate((a: bigint) => { const result = await page.evaluate((a: bigint) => {
@ -259,7 +257,7 @@ describe('Evaluation specs', function () {
expect(result).not.toBe(object); expect(result).not.toBe(object);
expect(result).toEqual(object); expect(result).toEqual(object);
}); });
(bigint ? it : it.skip)('should return BigInt', async () => { it('should return BigInt', async () => {
const {page} = getTestState(); const {page} = getTestState();
const result = await page.evaluate(() => { const result = await page.evaluate(() => {