mirror of
https://github.com/software-mansion/argent.git
synced 2026-09-14 19:27:14 +08:00
7cb6e7b457
* feat: rename previous profiler tools to react-profiler * feat: add ios-instruments profiler with default tracetemplate * fix: copying Argent.tracetemplate on install * feat: enhance CPU profiling capabilities in react-profiler and ios-instruments + initial enable re-querying (investigating) the profiler output * feat: enable analyzing old profiling sessions, enhance profiling tools interoperability * refactor: stream react profiler data to files instead of runtime aggregate var * chore: add xml-parser test * chore: rm clg * feat: ad ios-instruments timeout * chore: cleanup reactProfilerAnalyze warning cond * refactor: ensure not dividing by 0 in profilerCombinedReportTool * fix: inject react commit-capture hook before startProfiling * fix: rm main signature from rn framework trace analysis * chore: writeReport fail * fix: potential sampleIdx in parseCpuXml * fix: timeDeltas[i] potentially undefined * fix: decodeXml amp resolution sequence * fix: rm rn-profiler skill from local repo * feat: rename instruments to ios-profiler + improve react session stability
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { parseCpuXml } from "../../src/utils/ios-profiler/pipeline/xml-parser";
|
|
|
|
function makeXml(frameName: string): string {
|
|
return `<row>
|
|
<sample-time>1000</sample-time>
|
|
<thread fmt="main"></thread>
|
|
<weight>1000000</weight>
|
|
<backtrace id="1">
|
|
<frame id="1" name="${frameName}"/>
|
|
</backtrace>
|
|
</row>`;
|
|
}
|
|
|
|
function getFirstFrameName(xml: string): string {
|
|
const samples = parseCpuXml(xml);
|
|
return samples[0]?.stack[0]?.name ?? "";
|
|
}
|
|
|
|
describe("decodeXml (via parseCpuXml)", () => {
|
|
it("double-encoded entity decodes only once — &lt; becomes <, not <", () => {
|
|
const result = getFirstFrameName(makeXml("&lt;tag&gt;"));
|
|
expect(result).toBe("<tag>");
|
|
});
|
|
|
|
it("decodes < and > to angle brackets", () => {
|
|
const result = getFirstFrameName(makeXml("<func>"));
|
|
expect(result).toBe("<func>");
|
|
});
|
|
|
|
it("decodes & to &", () => {
|
|
const result = getFirstFrameName(makeXml("&"));
|
|
expect(result).toBe("&");
|
|
});
|
|
|
|
it("decodes " to double quote", () => {
|
|
const result = getFirstFrameName(makeXml(""hello""));
|
|
expect(result).toBe('"hello"');
|
|
});
|
|
|
|
it("decodes ' to single quote", () => {
|
|
const result = getFirstFrameName(makeXml("'x'"));
|
|
expect(result).toBe("'x'");
|
|
});
|
|
});
|