mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54262 Similar to `performance.measure()`, Chrome is adding an optional `detail` arg to `console.timeStamp`. Here we implement this for React Native, by direct passing to the `"TimeStamp"` trace event args. [`console.timeStamp()`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeStamp_static) remains an experimental, non-standard API. Changelog: [Internal] Reviewed By: hoxyq Differential Revision: D85437162 fbshipit-source-id: 36f5f6207cf205df5a216bde95013ea9540fc082
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
* @fantom_mode *
|
|
* @fantom_flags fuseboxEnabledRelease:*
|
|
*/
|
|
|
|
describe('console.timeStamp()', () => {
|
|
it('installed', () => {
|
|
expect(typeof console.timeStamp).toBe('function');
|
|
});
|
|
|
|
it("doesn't throw when label is not specified", () => {
|
|
// $FlowExpectedError[incompatible-call] not passing label intentionally
|
|
expect(() => console.timeStamp()).not.toThrow();
|
|
});
|
|
|
|
it("doesn't throw when label is specified", () => {
|
|
expect(() => console.timeStamp('label')).not.toThrow();
|
|
});
|
|
|
|
it("doesn't throw when additional arguments are specified", () => {
|
|
expect(() =>
|
|
console.timeStamp('label', 100, 500, 'Track', 'Group', 'error', {
|
|
tooltipText: 'Image processing failed',
|
|
}),
|
|
).not.toThrow();
|
|
});
|
|
|
|
it("doesn't throw when invalid arguments are specified", () => {
|
|
// $FlowExpectedError[incompatible-type]
|
|
expect(() => console.timeStamp({})).not.toThrow();
|
|
expect(() =>
|
|
// $FlowExpectedError[incompatible-type]
|
|
console.timeStamp('label', true, null, {}, [], () => {}),
|
|
).not.toThrow();
|
|
});
|
|
});
|