Skip to content

Commit

Permalink
Removed version-specific info from Timeline data snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Jan 13, 2022
1 parent 102538f commit 91ba67a
Showing 1 changed file with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ describe('Timeline profiler', () => {
clearedMarks = [];
marks = [];

// Remove file-system specific bits of information from the module range marks.
function filterModuleRanges(markName) {
// Remove file-system specific bits or version-specific bits of information from the module range marks.
function filterMarkData(markName) {
if (markName.startsWith('--react-internal-module-start')) {
return `${markName.substr(0, 29)}-<filtered-file-system-path>`;
} else if (markName.startsWith('--react-internal-module-stop')) {
return `${markName.substr(0, 28)}-<filtered-file-system-path>`;
} else if (markName.startsWith('--react-version')) {
return `${markName.substr(0, 15)}-<filtered-version>`;
} else {
return markName;
}
}

// This is not a true polyfill, but it gives us enough to capture marks.
// Reference: https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API
return {
clearMarks(markName) {
if (markName.startsWith('--react-internal-module')) {
markName = filterModuleRanges(markName);
}
markName = filterMarkData(markName);

clearedMarks.push(markName);
marks = marks.filter(mark => mark !== markName);
},
mark(markName, markOptions) {
if (markName.startsWith('--react-internal-module')) {
markName = filterModuleRanges(markName);
}
markName = filterMarkData(markName);

if (featureDetectionMarkName === null) {
featureDetectionMarkName = markName;
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('Timeline profiler', () => {
"--render-start-1",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -157,7 +157,7 @@ describe('Timeline profiler', () => {
"--render-start-16",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -219,7 +219,7 @@ describe('Timeline profiler', () => {
"--suspense-suspend-0-Example-mount-1-",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -261,7 +261,7 @@ describe('Timeline profiler', () => {
"--suspense-suspend-0-Example-mount-1-",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('Timeline profiler', () => {
"--suspense-suspend-0-Example-mount-16-",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -359,7 +359,7 @@ describe('Timeline profiler', () => {
"--suspense-suspend-0-Example-mount-16-",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -410,7 +410,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand All @@ -423,7 +423,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -463,7 +463,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand All @@ -476,7 +476,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -528,7 +528,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -581,7 +581,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -621,7 +621,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand All @@ -636,7 +636,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -670,7 +670,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand All @@ -688,7 +688,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -720,7 +720,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -770,7 +770,7 @@ describe('Timeline profiler', () => {
"--error-ExampleThatThrows-mount-Expected error",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand All @@ -784,7 +784,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -850,7 +850,7 @@ describe('Timeline profiler', () => {
"--error-ExampleThatThrows-mount-Expected error",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand All @@ -863,7 +863,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -929,7 +929,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-16",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -985,7 +985,7 @@ describe('Timeline profiler', () => {
"--render-start-1",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -1019,7 +1019,7 @@ describe('Timeline profiler', () => {
"--render-start-1",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -1069,7 +1069,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-1",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down Expand Up @@ -1109,7 +1109,7 @@ describe('Timeline profiler', () => {
"--component-render-stop",
"--render-stop",
"--commit-start-4",
"--react-version-17.0.3",
"--react-version-<filtered-version>",
"--profiler-version-1",
"--react-internal-module-start-<filtered-file-system-path>",
"--react-internal-module-stop-<filtered-file-system-path>",
Expand Down

0 comments on commit 91ba67a

Please sign in to comment.