"use strict";
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const console_helpers_js_1 = require("../helpers/console-helpers.js");
describe('console.time', () => {
    it('produces time messages', async ({ devToolsPage, inspectedPage }) => {
        await inspectedPage.evaluate(async () => {
            console.time();
            await new Promise(resolve => setTimeout(resolve, 1));
            console.timeEnd();
            console.time('42');
            await new Promise(resolve => setTimeout(resolve, 1));
            console.timeEnd('42');
            // @ts-expect-error not supported type in @types/node.
            console.time(239);
            await new Promise(resolve => setTimeout(resolve, 1));
            // @ts-expect-error not supported type in @types/node.
            console.timeEnd(239);
            // @ts-expect-error not supported type in @types/node.
            console.time({});
            await new Promise(resolve => setTimeout(resolve, 1));
            // @ts-expect-error not supported type in @types/node.
            console.timeEnd({});
        });
        await devToolsPage.waitForFunction(async function () {
            try {
                let messages = await (0, console_helpers_js_1.getCurrentConsoleMessages)(false, undefined, undefined, devToolsPage);
                messages = messages.map(message => message.replace(/\d+\.\d+ ?ms/, '<time>'));
                chai_1.assert.deepEqual(messages, ['default: <time>', '42: <time>', '239: <time>', '[object Object]: <time>']);
                return true;
            }
            catch {
                return false;
            }
        });
    });
});
//# sourceMappingURL=console-time.test.js.map