flakiness 0.304.0 → 0.306.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/cli.js +62 -6
- package/package.json +3 -3
- package/types/tsconfig.tsbuildinfo +1 -1
package/lib/cli/cli.js
CHANGED
|
@@ -983,9 +983,51 @@ var TestOutcomes;
|
|
|
983
983
|
TestOutcomes2.formatCounts = formatCounts;
|
|
984
984
|
})(TestOutcomes || (TestOutcomes = {}));
|
|
985
985
|
|
|
986
|
+
// ../server/lib/common/timePeriod.js
|
|
987
|
+
var TimePeriod;
|
|
988
|
+
((TimePeriod2) => {
|
|
989
|
+
TimePeriod2.PERIODS = ["3h", "day", "usweek", "monthweek", "month", "quarter"];
|
|
990
|
+
const LENGTHS = {
|
|
991
|
+
"3h": { hours: 3 },
|
|
992
|
+
day: { days: 1 },
|
|
993
|
+
usweek: { weeks: 1 },
|
|
994
|
+
month: { months: 1 },
|
|
995
|
+
quarter: { months: 3 }
|
|
996
|
+
};
|
|
997
|
+
function periodStart(period, time) {
|
|
998
|
+
if (period === "3h")
|
|
999
|
+
return time.round({ smallestUnit: "hour", roundingIncrement: 3, roundingMode: "floor" });
|
|
1000
|
+
const day = time.toPlainDate();
|
|
1001
|
+
if (period === "day")
|
|
1002
|
+
return day.toPlainDateTime();
|
|
1003
|
+
if (period === "usweek")
|
|
1004
|
+
return day.subtract({ days: day.dayOfWeek % 7 }).toPlainDateTime();
|
|
1005
|
+
if (period === "monthweek")
|
|
1006
|
+
return day.with({ day: Math.min(Math.floor((day.day - 1) / 7), 3) * 7 + 1 }).toPlainDateTime();
|
|
1007
|
+
if (period === "month")
|
|
1008
|
+
return day.with({ day: 1 }).toPlainDateTime();
|
|
1009
|
+
return day.with({ month: Math.floor((day.month - 1) / 3) * 3 + 1, day: 1 }).toPlainDateTime();
|
|
1010
|
+
}
|
|
1011
|
+
TimePeriod2.periodStart = periodStart;
|
|
1012
|
+
function periodEnd(period, time) {
|
|
1013
|
+
const start = periodStart(period, time);
|
|
1014
|
+
if (period === "monthweek")
|
|
1015
|
+
return start.day < 22 ? start.add({ days: 7 }) : periodEnd("month", start);
|
|
1016
|
+
return start.add(LENGTHS[period]);
|
|
1017
|
+
}
|
|
1018
|
+
TimePeriod2.periodEnd = periodEnd;
|
|
1019
|
+
function lastDay(until) {
|
|
1020
|
+
return until.subtract({ nanoseconds: 1 }).toPlainDate();
|
|
1021
|
+
}
|
|
1022
|
+
TimePeriod2.lastDay = lastDay;
|
|
1023
|
+
})(TimePeriod || (TimePeriod = {}));
|
|
1024
|
+
|
|
986
1025
|
// ../server/lib/common/wireTypes.js
|
|
987
1026
|
var WireTypes;
|
|
988
1027
|
((WireTypes2) => {
|
|
1028
|
+
WireTypes2.OUTCOME_CLASSIFICATIONS = ["eod", "worst"];
|
|
1029
|
+
WireTypes2.HISTORY_TYPES = ["commit", ...TimePeriod.PERIODS];
|
|
1030
|
+
WireTypes2.ANALYTICS_OUTCOMES = ["expected", "unexpected", "flaked", "skipped"];
|
|
989
1031
|
WireTypes2.SORT_AXES = {
|
|
990
1032
|
tests: [
|
|
991
1033
|
"name",
|
|
@@ -1054,11 +1096,12 @@ import { Command, Option } from "commander";
|
|
|
1054
1096
|
import debug2 from "debug";
|
|
1055
1097
|
import fs7 from "fs";
|
|
1056
1098
|
import path7 from "path";
|
|
1099
|
+
import { Temporal as Temporal2 } from "temporal-polyfill";
|
|
1057
1100
|
|
|
1058
1101
|
// ../package.json
|
|
1059
1102
|
var package_default = {
|
|
1060
1103
|
name: "@flakiness/monorepo",
|
|
1061
|
-
version: "0.
|
|
1104
|
+
version: "0.306.0",
|
|
1062
1105
|
type: "module",
|
|
1063
1106
|
private: true,
|
|
1064
1107
|
scripts: {
|
|
@@ -2080,8 +2123,8 @@ async function cmdListTests(options) {
|
|
|
2080
2123
|
let preset;
|
|
2081
2124
|
if (options.pr !== void 0)
|
|
2082
2125
|
preset = { type: "pr", number: options.pr };
|
|
2083
|
-
else if (options.branch !== void 0)
|
|
2084
|
-
preset = { type: "branch", name: options.branch };
|
|
2126
|
+
else if (options.branch !== void 0 || options.day !== void 0)
|
|
2127
|
+
preset = { type: "branch", name: options.branch, day: options.day };
|
|
2085
2128
|
const result = await api.report.testStats.POST({
|
|
2086
2129
|
orgSlug,
|
|
2087
2130
|
projectSlug,
|
|
@@ -2106,6 +2149,8 @@ async function cmdListTests(options) {
|
|
|
2106
2149
|
scope = `PR #${options.pr}`;
|
|
2107
2150
|
else if (options.branch !== void 0)
|
|
2108
2151
|
scope = `branch \`${options.branch}\``;
|
|
2152
|
+
if (options.day !== void 0)
|
|
2153
|
+
scope += `, ${options.day}`;
|
|
2109
2154
|
const lines = [
|
|
2110
2155
|
`# Tests for \`${orgSlug}/${projectSlug}\` (${scope})`,
|
|
2111
2156
|
"",
|
|
@@ -2217,7 +2262,7 @@ var BUNDLED_SKILLS = [
|
|
|
2217
2262
|
"files": [
|
|
2218
2263
|
{
|
|
2219
2264
|
"path": "SKILL.md",
|
|
2220
|
-
"content": "---\nname: flakiness-investigation\ndescription: >-\n TRIGGER when: CI fails, tests fail, PR checks fail, user asks about test results, regressions, flakiness, or test health.\n Always use this INSTEAD OF `gh` CLI for investigating test failures \u2014 it distinguishes regressions (caused by the PR) from pre-existing failures and flakes.\n DO NOT TRIGGER when: the user is asking about non-test CI issues (e.g. build failures, deployment problems).\n---\n\n# Flakiness Investigation\n\nUse the `flakiness` CLI to query and analyze test data from Flakiness.io.\n\n## Prerequisites\n\n- The `flakiness` CLI must be available in PATH (installed via `npm install -g flakiness` or `npx flakiness`).\n- A project must be specified: `--project <org/project>` or set `FLAKINESS_PROJECT` env var.\n- Authentication: run `flakiness auth login` first, or set `FLAKINESS_ACCESS_TOKEN`.\n\n## Core command\n\n```bash\nflakiness list tests --project <org/project> [--pr <number>] [--branch <name>] [--history commit|day] [--fql <query>] [--sort <axis>] [--sort-dir asc|desc] [--page <n>] [--page-size <n>] [--env-name <value>] [--env-path <value>] [--env-category <value>] [--env-os <value>] [--env-arch <value>] [--env-metadata <key=value>]\n```\n\n### Scope options\n\n| Flag | Effect |\n|------|--------|\n| *(none)* | Default branch \u2014 tests from the day of its head commit (in the project's timezone) |\n| `--pr <number>` | Pull request \u2014 tests from the merge-commit of the PR branch into the target branch |\n| `--branch <name>` | Named branch \u2014 tests from the day of its head commit (in the project's timezone) |\n\n`--pr`
|
|
2265
|
+
"content": "---\nname: flakiness-investigation\ndescription: >-\n TRIGGER when: CI fails, tests fail, PR checks fail, user asks about test results, regressions, flakiness, or test health.\n Always use this INSTEAD OF `gh` CLI for investigating test failures \u2014 it distinguishes regressions (caused by the PR) from pre-existing failures and flakes.\n DO NOT TRIGGER when: the user is asking about non-test CI issues (e.g. build failures, deployment problems).\n---\n\n# Flakiness Investigation\n\nUse the `flakiness` CLI to query and analyze test data from Flakiness.io.\n\n## Prerequisites\n\n- The `flakiness` CLI must be available in PATH (installed via `npm install -g flakiness` or `npx flakiness`).\n- A project must be specified: `--project <org/project>` or set `FLAKINESS_PROJECT` env var.\n- Authentication: run `flakiness auth login` first, or set `FLAKINESS_ACCESS_TOKEN`.\n\n## Core command\n\n```bash\nflakiness list tests --project <org/project> [--pr <number>] [--branch <name>] [--day <YYYY-MM-DD>] [--history commit|day] [--fql <query>] [--sort <axis>] [--sort-dir asc|desc] [--page <n>] [--page-size <n>] [--env-name <value>] [--env-path <value>] [--env-category <value>] [--env-os <value>] [--env-arch <value>] [--env-metadata <key=value>]\n```\n\n### Scope options\n\n| Flag | Effect |\n|------|--------|\n| *(none)* | Default branch \u2014 tests from the day of its head commit (in the project's timezone) |\n| `--pr <number>` | Pull request \u2014 tests from the merge-commit of the PR branch into the target branch |\n| `--branch <name>` | Named branch \u2014 tests from the day of its head commit (in the project's timezone) |\n| `--day <YYYY-MM-DD>` | A specific calendar day, in the project's timezone. Combine with `--branch`, or use alone for the default branch. |\n\n`--pr` is mutually exclusive with both `--branch` and `--day`: a PR query is pinned to the PR's last tested commit, so a day has no meaning there.\n\n### History granularity (`--history`)\n\nControls how the preceding history is bucketed \u2014 which affects the duration trend, flip rate, fail rate, and the per-test history. Omit it to use the project's configured default.\n\n| Value | Buckets history by | Use when |\n|-------|--------------------|----------|\n| `--history commit` | Each commit | Pinpointing the exact commit that changed a test's behavior or duration. |\n| `--history day` | Each day (project timezone) | Reviewing a test's **performance over time** \u2014 day-over-day duration trends and flip/fail rates are smoother and less noisy than commit-to-commit, so slow drifts and recurring flakes stand out. |\n\nFor \"is this test getting slower / flakier over time?\" questions, prefer `--history day`:\n\n```bash\nflakiness list tests --project <org/project> --history day --sort duration_trend --sort-dir desc\nflakiness list tests --project <org/project> --history day --fql 'flip>0%' --sort flip_rate --sort-dir desc\n```\n\n### Environment filter options\n\nFilter results by environment. All flags are repeatable. Multiple values for the same flag are OR'd; different flags are AND'd.\n\n| Flag | Filters by | Example |\n|------|-----------|---------|\n| `--env-name <value>` | Environment name | `--env-name chromium` |\n| `--env-path <value>` | Config file path | `--env-path playwright.config.ts` |\n| `--env-category <value>` | Test category | `--env-category playwright` |\n| `--env-os <value>` | OS name + version | `--env-os \"Ubuntu 22.04\"` |\n| `--env-arch <value>` | CPU architecture | `--env-arch x86_64` |\n| `--env-metadata <key=value>` | User-supplied metadata | `--env-metadata browser=chromium` |\n\nThe output for each test shows environment info in the same `key=value` format:\n- **Env** line: system-collected data with keys matching the `--env-*` flag suffixes (`category=`, `name=`, `path=`, `os=`, `arch=`)\n- **Env Metadata** line (if any): user-supplied key=value pairs\n\nThis makes it easy to copy a value from the output and use it as a filter flag.\n\n### Status semantics with `--pr`\n\nWhen querying a PR, the status values have specific meaning:\n\n| Status | Meaning |\n|--------|---------|\n| `regressed` | Test was passing on the target branch but fails in this PR \u2014 **caused by the PR** |\n| `failed` | Test also fails on the target branch \u2014 **pre-existing failure, not caused by the PR** |\n| `flaked` | Test failed but passed on retry \u2014 flaky, not a real failure |\n| `passed` | Test passes |\n| `skipped` | Test was skipped |\n\n### Sort axes\n\n- `outcome` \u2014 sort by test outcome severity (default)\n- `flip_rate` \u2014 sort by flip rate (how often a test flips between pass/fail)\n- `fail_rate` \u2014 sort by fail rate (share of commits where the test's terminal status was failing)\n- `duration` \u2014 sort by test duration\n- `duration_trend` \u2014 sort by duration trend\n- `name` \u2014 sort alphabetically\n\n### Common queries\n\n| Goal | FQL + flags |\n|------|-------------|\n| Flaky tests | `--fql 'flip>0%' --sort flip_rate --sort-dir desc` |\n| Very flaky (>50%) | `--fql 'flip>50%' --sort flip_rate --sort-dir desc` |\n| Tests that have failed (terminal failure) | `--fql 'fail>0%' --sort fail_rate --sort-dir desc` |\n| Tests that fail most often (>50%) | `--fql 'fail>50%' --sort fail_rate --sort-dir desc` |\n| Failed tests | `--fql 's:failed' --sort outcome --sort-dir desc` |\n| Regressions | `--fql 's:regressed'` |\n| All broken tests | `--fql 'status:(failed, regressed)'` |\n| Slow tests | `--fql 'd>5s' --sort duration --sort-dir desc` |\n| Tests matching error | `--fql '$timeout'` |\n| Tests in file | `--fql 'f:login.spec.ts'` |\n| Tests on Linux | `--env-os \"Ubuntu 22.04\"` |\n| Tests for chromium project | `--env-name chromium` |\n| Tests with specific metadata | `--env-metadata browser=firefox` |\n| Linux or macOS failures | `--env-os \"Ubuntu 22.04\" --env-os \"Darwin 24.0\" --fql 's:failed'` |\n\n## FQL (Filter Query Language)\n\nFull reference: [references/fql.md](references/fql.md)\n\nKey rules:\n- Multiple tokens combine with AND: `s:failed f:e2e` means \"failed AND in e2e files\"\n- Prefix with `-` to exclude: `-#smoke` excludes smoke-tagged tests\n- Same filter type uses OR: `status:(failed, regressed)` means \"failed OR regressed\"\n- Quote values with spaces: `f:'tests/e2e checkout'`\n\n### Filter types\n\n| Filter | Syntax | Example |\n|--------|--------|---------|\n| Text search | `<text>` | `login` |\n| Status | `s:<status>` | `s:failed`, `status:(failed, regressed)` |\n| File | `f:<path>` | `f:login.spec.ts` |\n| Error | `$<text>` | `$timeout` |\n| Tag | `#<tag>` | `#smoke` |\n| Duration | `d><time>` | `d>2s`, `d<=500ms` |\n| Flip rate | `flip><pct>` | `flip>0%`, `fr>50%` |\n| Annotation | `@<type>` | `@skip` |\n\n### Status values\n\n`passed`, `failed`, `flaked`, `skipped`, `regressed`\n\n## Workflow: Fix My PR Tests\n\nWhen a user asks to fix failing tests in a PR, follow these steps:\n\n1. **Find the project slug:** Search the codebase for `flakinessProject` to find the `--project` value. It is typically configured in a test reporter config (e.g. `playwright.config.ts`, `jest.config.ts`) as `flakinessProject: 'org/project'`.\n\n2. **Fetch regressions from the PR:**\n ```bash\n flakiness list tests --project <org/project> --pr <number> --fql 's:regressed' --page-size 50\n ```\n Tests with status `regressed` were passing on the target branch but fail in this PR \u2014 these are **caused by the PR** and must be fixed.\n\n3. **Analyze the output:** Look at the error messages, file paths, and test names to understand what the PR broke.\n\n4. **Fix the regressions** by reading the reported file paths and error messages, then making targeted code changes.\n\n5. **Optionally check pre-existing failures:** Tests with status `failed` also fail on the target branch and are not caused by the PR. You can list them with:\n ```bash\n flakiness list tests --project <org/project> --pr <number> --fql 's:failed' --page-size 50\n ```\n These are informational \u2014 fixing them is a bonus, not a requirement.\n\n6. **Ignore flakes:** Tests with status `flaked` failed but passed on retry \u2014 they are flaky and not actionable in the context of a PR fix.\n\n## Workflow tips\n\n1. Start broad: `flakiness list tests --project <org/project> --page-size 20`\n2. Filter down with FQL based on what you're investigating\n3. Use `--page-size 50` or higher to see more results at once\n4. Combine filters: `--fql 's:failed $timeout f:e2e -#smoke'`\n\nMore recipes: [references/recipes.md](references/recipes.md)\n"
|
|
2221
2266
|
},
|
|
2222
2267
|
{
|
|
2223
2268
|
"path": "references/fql.md",
|
|
@@ -2225,7 +2270,7 @@ var BUNDLED_SKILLS = [
|
|
|
2225
2270
|
},
|
|
2226
2271
|
{
|
|
2227
2272
|
"path": "references/recipes.md",
|
|
2228
|
-
"content": "# Investigation Recipes\n\nReplace `myorg/myproject` with the target project slug, or set `FLAKINESS_PROJECT`.\n\n## Query a pull request\n\nShows tests from the merge-commit of the PR branch into the target branch.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42\n```\n\n## Find PR regressions (caused by the PR)\n\nTests marked `regressed` were passing on the target branch but fail in this PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:regressed'\n```\n\n## Find pre-existing failures in a PR\n\nTests marked `failed` also fail on the target branch \u2014 not caused by the PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:failed'\n```\n\n## Find all broken tests in a PR\n\nIncludes both PR-caused regressions and pre-existing failures.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 'status:(failed, regressed)' --page-size 50\n```\n\n## Query a specific branch\n\nShows tests from the day of the branch's head commit, in the project's timezone.\n\n```bash\nflakiness list tests --project myorg/myproject --branch feature/login\n```\n\n## Find all flaky tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>0%' --sort flip_rate --sort-dir desc\n```\n\n## Find the most flaky tests (>50% flip rate)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>50%' --sort flip_rate --sort-dir desc\n```\n\n## Find tests that have ever failed (terminal failure, retries exhausted)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'fail>0%' --sort fail_rate --sort-dir desc\n```\n\n## Find tests that fail more than half the time\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'fail>50%' --sort fail_rate --sort-dir desc\n```\n\n## Show failed tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed' --sort outcome --sort-dir desc\n```\n\n## Show regressions\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:regressed'\n```\n\n## Show all currently broken tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'status:(failed, regressed)' --sort outcome --sort-dir desc\n```\n\n## Show flaked tests (passed on retry)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:flaked' --sort flip_rate --sort-dir desc\n```\n\n## Find slow tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'd>5s' --sort duration --sort-dir desc\n```\n\n## Find tests by error text\n\n```bash\nflakiness list tests --project myorg/myproject --fql '$timeout'\nflakiness list tests --project myorg/myproject --fql '$\"network error\"'\n```\n\n## Combine filters\n\nFailed tests in e2e files, excluding smoke-tagged tests:\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed f:e2e -#smoke'\n```\n\n## Narrow to a specific file\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'f:login.spec.ts'\n```\n\n## Find tests with a specific annotation\n\n```bash\nflakiness list tests --project myorg/myproject --fql '@skip'\nflakiness list tests --project myorg/myproject --fql '@fixme'\n```\n\n## Filter by environment\n\n### Show tests for a specific OS\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\"\n```\n\n### Show tests for a specific environment name\n\n```bash\nflakiness list tests --project myorg/myproject --env-name chromium\n```\n\n### Show tests for a specific architecture\n\n```bash\nflakiness list tests --project myorg/myproject --env-arch arm64\n```\n\n### Show tests for multiple OSes (OR)\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --env-os \"Darwin 24.0\"\n```\n\n### Combine env filter with FQL\n\nFailed tests on Linux only:\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --fql 's:failed'\n```\n\n### Filter by user-supplied metadata\n\n```bash\nflakiness list tests --project myorg/myproject --env-metadata browser=firefox\n```\n\n### Combine multiple env filters (AND)\n\nTests on Linux with arm64 architecture:\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --env-arch arm64\n```\n\n## Review performance over time (day history)\n\nBucket history by day instead of by commit so duration trends and flip/fail rates read as a smooth day-over-day time series.\n\n### Tests getting slower over time\n\n```bash\nflakiness list tests --project myorg/myproject --history day --sort duration_trend --sort-dir desc\n```\n\n### Recurring flakes, day over day\n\n```bash\nflakiness list tests --project myorg/myproject --history day --fql 'flip>0%' --sort flip_rate --sort-dir desc\n```\n\n### Force per-commit history (override a project default of `day`)\n\n```bash\nflakiness list tests --project myorg/myproject --history commit\n```\n"
|
|
2273
|
+
"content": "# Investigation Recipes\n\nReplace `myorg/myproject` with the target project slug, or set `FLAKINESS_PROJECT`.\n\n## Query a pull request\n\nShows tests from the merge-commit of the PR branch into the target branch.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42\n```\n\n## Find PR regressions (caused by the PR)\n\nTests marked `regressed` were passing on the target branch but fail in this PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:regressed'\n```\n\n## Find pre-existing failures in a PR\n\nTests marked `failed` also fail on the target branch \u2014 not caused by the PR.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 's:failed'\n```\n\n## Find all broken tests in a PR\n\nIncludes both PR-caused regressions and pre-existing failures.\n\n```bash\nflakiness list tests --project myorg/myproject --pr 42 --fql 'status:(failed, regressed)' --page-size 50\n```\n\n## Query a specific branch\n\nShows tests from the day of the branch's head commit, in the project's timezone.\n\n```bash\nflakiness list tests --project myorg/myproject --branch feature/login\n```\n\n## Query a specific day\n\nThe day is a calendar day in the project's timezone. Without `--branch` it applies to the default branch.\n\n```bash\nflakiness list tests --project myorg/myproject --day 2026-09-16\nflakiness list tests --project myorg/myproject --branch feature/login --day 2026-09-16\n```\n\nTo compare a test's behaviour across days, run the same query for each day and diff the results.\n\n## Find all flaky tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>0%' --sort flip_rate --sort-dir desc\n```\n\n## Find the most flaky tests (>50% flip rate)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'flip>50%' --sort flip_rate --sort-dir desc\n```\n\n## Find tests that have ever failed (terminal failure, retries exhausted)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'fail>0%' --sort fail_rate --sort-dir desc\n```\n\n## Find tests that fail more than half the time\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'fail>50%' --sort fail_rate --sort-dir desc\n```\n\n## Show failed tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed' --sort outcome --sort-dir desc\n```\n\n## Show regressions\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:regressed'\n```\n\n## Show all currently broken tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'status:(failed, regressed)' --sort outcome --sort-dir desc\n```\n\n## Show flaked tests (passed on retry)\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:flaked' --sort flip_rate --sort-dir desc\n```\n\n## Find slow tests\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'd>5s' --sort duration --sort-dir desc\n```\n\n## Find tests by error text\n\n```bash\nflakiness list tests --project myorg/myproject --fql '$timeout'\nflakiness list tests --project myorg/myproject --fql '$\"network error\"'\n```\n\n## Combine filters\n\nFailed tests in e2e files, excluding smoke-tagged tests:\n\n```bash\nflakiness list tests --project myorg/myproject --fql 's:failed f:e2e -#smoke'\n```\n\n## Narrow to a specific file\n\n```bash\nflakiness list tests --project myorg/myproject --fql 'f:login.spec.ts'\n```\n\n## Find tests with a specific annotation\n\n```bash\nflakiness list tests --project myorg/myproject --fql '@skip'\nflakiness list tests --project myorg/myproject --fql '@fixme'\n```\n\n## Filter by environment\n\n### Show tests for a specific OS\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\"\n```\n\n### Show tests for a specific environment name\n\n```bash\nflakiness list tests --project myorg/myproject --env-name chromium\n```\n\n### Show tests for a specific architecture\n\n```bash\nflakiness list tests --project myorg/myproject --env-arch arm64\n```\n\n### Show tests for multiple OSes (OR)\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --env-os \"Darwin 24.0\"\n```\n\n### Combine env filter with FQL\n\nFailed tests on Linux only:\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --fql 's:failed'\n```\n\n### Filter by user-supplied metadata\n\n```bash\nflakiness list tests --project myorg/myproject --env-metadata browser=firefox\n```\n\n### Combine multiple env filters (AND)\n\nTests on Linux with arm64 architecture:\n\n```bash\nflakiness list tests --project myorg/myproject --env-os \"Ubuntu 22.04\" --env-arch arm64\n```\n\n## Review performance over time (day history)\n\nBucket history by day instead of by commit so duration trends and flip/fail rates read as a smooth day-over-day time series.\n\n### Tests getting slower over time\n\n```bash\nflakiness list tests --project myorg/myproject --history day --sort duration_trend --sort-dir desc\n```\n\n### Recurring flakes, day over day\n\n```bash\nflakiness list tests --project myorg/myproject --history day --fql 'flip>0%' --sort flip_rate --sort-dir desc\n```\n\n### Force per-commit history (override a project default of `day`)\n\n```bash\nflakiness list tests --project myorg/myproject --history commit\n```\n"
|
|
2229
2274
|
}
|
|
2230
2275
|
]
|
|
2231
2276
|
}
|
|
@@ -2358,6 +2403,16 @@ var optTestsPR = new Option("--pr <number>", "Show tests from a specific pull re
|
|
|
2358
2403
|
return parsed;
|
|
2359
2404
|
}).conflicts("branch");
|
|
2360
2405
|
var optTestsBranch = new Option("--branch <name>", "Show tests from a specific branch").conflicts("pr");
|
|
2406
|
+
var optTestsDay = new Option("--day <YYYY-MM-DD>", "Show tests from a specific day, in the project timezone (defaults to the day of the branch head commit)").argParser((value) => {
|
|
2407
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
2408
|
+
throw new Error("day must be a YYYY-MM-DD date, e.g. 2026-09-17");
|
|
2409
|
+
try {
|
|
2410
|
+
Temporal2.PlainDate.from(value, { overflow: "reject" });
|
|
2411
|
+
} catch {
|
|
2412
|
+
throw new Error(`'${value}' is not a valid calendar date`);
|
|
2413
|
+
}
|
|
2414
|
+
return value;
|
|
2415
|
+
}).conflicts("pr");
|
|
2361
2416
|
var optTestsHistory = new Option("--history <granularity>", "History granularity for trends, flip/fail rates, and the history column: per `commit` or per `day` (defaults to the project setting)").choices(["commit", "day"]);
|
|
2362
2417
|
function collectValues(value, prev) {
|
|
2363
2418
|
return [...prev ?? [], value];
|
|
@@ -2372,7 +2427,7 @@ var optTestsEnvMetadata = new Option("--env-metadata <key=value>", "Filter by us
|
|
|
2372
2427
|
throw new Error(`Invalid env-metadata format '${value}'; expected key=value`);
|
|
2373
2428
|
return [...prev ?? [], value];
|
|
2374
2429
|
});
|
|
2375
|
-
list.command("tests").description("Query tests data. Defaults to the default branch (day of head commit in project timezone). Use --pr for PR merge-commit tests, or --branch for a named branch.").addOption(optTestsPage).addOption(optTestsPageSize).addOption(optTestsSort).addOption(optTestsSortDir).addOption(optTestsFQL).addOption(optTestsPR).addOption(optTestsBranch).addOption(optTestsHistory).addOption(optTestsEnvName).addOption(optTestsEnvPath).addOption(optTestsEnvCategory).addOption(optTestsEnvOs).addOption(optTestsEnvArch).addOption(optTestsEnvMetadata).addOption(mustFlakinessProject).addOption(optEndpoint).addOption(optAccessToken).action(async (options) => runCommand(async () => {
|
|
2430
|
+
list.command("tests").description("Query tests data. Defaults to the default branch (day of head commit in project timezone). Use --pr for PR merge-commit tests, or --branch for a named branch, and --day to pick a day.").addOption(optTestsPage).addOption(optTestsPageSize).addOption(optTestsSort).addOption(optTestsSortDir).addOption(optTestsFQL).addOption(optTestsPR).addOption(optTestsBranch).addOption(optTestsDay).addOption(optTestsHistory).addOption(optTestsEnvName).addOption(optTestsEnvPath).addOption(optTestsEnvCategory).addOption(optTestsEnvOs).addOption(optTestsEnvArch).addOption(optTestsEnvMetadata).addOption(mustFlakinessProject).addOption(optEndpoint).addOption(optAccessToken).action(async (options) => runCommand(async () => {
|
|
2376
2431
|
await cmdListTests({
|
|
2377
2432
|
page: options.page,
|
|
2378
2433
|
pageSize: options.pageSize,
|
|
@@ -2381,6 +2436,7 @@ list.command("tests").description("Query tests data. Defaults to the default bra
|
|
|
2381
2436
|
fql: options.fql,
|
|
2382
2437
|
pr: options.pr,
|
|
2383
2438
|
branch: options.branch,
|
|
2439
|
+
day: options.day,
|
|
2384
2440
|
history: options.history,
|
|
2385
2441
|
envName: options.envName,
|
|
2386
2442
|
envPath: options.envPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flakiness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.306.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"flakiness": "./lib/cli/cli.js"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "Degu Labs, Inc",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@flakiness/server": "0.
|
|
23
|
-
"@flakiness/shared": "0.
|
|
22
|
+
"@flakiness/server": "0.306.0",
|
|
23
|
+
"@flakiness/shared": "0.306.0",
|
|
24
24
|
"@playwright/test": "^1.62.1",
|
|
25
25
|
"@types/debug": "^4.1.13",
|
|
26
26
|
"@types/express": "^4.17.25",
|