Skip to main content

chart-baseline-generation

Generate Plotly.NET test baselines from real chart rendering so expected data or layout markup is derived from actual output instead of hand-written from memory.

跳到安装

来源信息

仓库
plotly/Plotly.NET
最近来源活动
2026年4月19日 09:31
检测到的 SKILL.md 语言
英语
星标
860
分支
99

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
chart-baseline-generation
description
Generate Plotly.NET test baselines from real chart rendering so expected data or layout markup is derived from actual output instead of hand-written from memory.
compatibility
opencode
metadata
{"audience":"maintainers","workflow":"chart-tests"}
# Chart Baseline Generation Use this skill when a Plotly.NET test needs an expected string derived from actual chart output. ## Goal Generate the real chart output first, inspect it, then copy only the stable part into the test as the expected value. Do not hand-write large expected strings from memory. ## Prerequisites The script loads Plotly.NET assemblies from `tests/ConsoleApps/CSharpConsole/bin/Debug/net10.0/`. Before running the script, verify that directory contains `Plotly.NET.dll` and `Plotly.NET.CSharp.dll`. If it is empty or the DLLs are missing, build them first via the FAKE pipeline: ```powershell ./build.cmd Build ``` Any of the `Run*TestsFast` targets also produce these assemblies as a side effect, so if you are about to run tests anyway you can skip the explicit build step. If you edit sources in `src/Plotly.NET` or `src/Plotly.NET.CSharp` during the investigation, rebuild before re-running the script. `dotnet fsi` will happily use stale assemblies. ## Workflow 1. Ensure the dependency DLLs exist. 2. Identify the chart fixture or chart-construction expression you want to validate. 3. Prefer an existing fixture from `tests/Common/FSharpTestBase/TestCharts/`. 4. If there is no suitable fixture, put a temporary focused chart expression into `tools/chart-baseline-generation/generate-chart-markup.fsx`. 5. Use that script for both F# tests and C# tests. 6. For C# wrapper baselines, call `Plotly.NET.CSharp.Chart...` inside the F# script. 7. Keep `UseDefaults = false` on the chart to avoid noisy default template output. 8. Generate output with the same renderer the test uses. 9. Copy the smallest stable section into the test. 10. Revert any temporary helper code in the script before finishing. ## Canonical Harness Always use `tools/chart-baseline-generation/generate-chart-markup.fsx` as the investigation harness. Edit `createChart()` in that script, run it for the section you need, inspect the generated output, then revert the temporary chart expression when finished. ## Commands ```powershell dotnet fsi tools/chart-baseline-generation/generate-chart-markup.fsx dotnet fsi tools/chart-baseline-generation/generate-chart-markup.fsx -- data dotnet fsi tools/chart-baseline-generation/generate-chart-markup.fsx -- layout dotnet fsi tools/chart-baseline-generation/generate-chart-markup.fsx -- html dotnet fsi tools/chart-baseline-generation/generate-chart-markup.fsx -- data --write-html temp/chart.html ``` ## Assertions Prefer the smallest stable assertion that proves the behavior: - full `var data = ...;` block when validating trace serialization - full `var layout = ...;` block when validating layout generation - a small but meaningful substring only when the full block is too brittle Avoid asserting volatile values such as generated DOM ids. ## Verification Use the smallest matching FAKE target while iterating: - `./build.cmd RunCSharpTestsFast` - `./build.cmd RunTestsCoreFast` - `./build.cmd RunTestsExtensionLibsFast` Run the broader suite before committing when the change scope warrants it.
在 GitHub 查看