experience-lwc-accessibility-jest-run
Use ALWAYS when running Sa11y accessibility Jest tests for a Lightning Web Component — locally before pushing, producing the exact command(s), runni…
它会碰到什么
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
<!-- adk-managed-skill -->
Running LWC Accessibility Jest Tests
Run Sa11y accessibility unit tests on Lightning Web Components in either:
- Core (Bazel) — when a
WORKSPACEfile is present. - Standalone (Jest) — when there's no
WORKSPACE.
Selenium-level reproductions, GUS A11yBug ingestion, and other internal
Salesforce-only flows are out of scope for this skill. For source-code-level
WCAG review without running tests, see experience-lwc-accessibility-validate.
When to Use This Skill
- User wants to run accessibility unit tests (Sa11y Jest) locally before
pushing a fix.
- User has a known failing test file path (e.g. from an A11yBug's
Test_Names__c) and wants to target it directly.
- User is iterating on an accessibility fix and needs the fastest
pass/fail signal.
Prerequisites
- For Bazel Jest tests: a Salesforce core build environment (a
WORKSPACE
file is present).
- For standalone Jest tests:
@sa11y/jestinstalled and configured.
Workflow
Follow [running-sa11y-jest-tests.md](references/running-sa11y-jest-tests.md).
Pick the correct mode:
- Core (Bazel) — use when
WORKSPACEis present. Prefer single-file
targets (//{moduleName}:{relativePath}) over module targets when the
failing test file path is already known (.test.js extension dropped).
Bazel commands must pass `--test_env=SA11Y_AUTO=1
--test_env=SA11Y_ENABLE_DOM_MUTATION_OBSERVER=1`; when debugging, add
SA11Y_ENABLE_RENDERED_DOM_SAVE=1 with the documented save path to avoid
EPERM issues.
- Standalone (Jest) — use when there's no
WORKSPACE. Run
npm test -- --testMatch="**/*.accessibility.test.js" for the whole suite,
or npm test -- <file> targeting the file by the name/path given in the
prompt (a bare filename when it is "in this directory"). Do not
prepend SA11Y_* env vars in standalone mode — Sa11y runs automatically
because @sa11y/jest is wired into the project's Jest setup; no extra
environment variables are needed.
Answer only what is asked. Emit just the command(s) the prompt requests plus
the exit-code meaning. Do not pad the plan with unrequested variants (watch,
coverage, verbose), snapshot-update steps, or HTML-save sections unless the user
explicitly asks for them.
Verification Checklist
- [ ] Sa11y Jest run completed with a clear pass/fail signal (exit 0 or 3
for Bazel; exit 0 or 1 for Jest).
- [ ] If snapshots were intentionally updated, the new snapshots are
committed alongside the fix.
Troubleshooting
- Bazel test "not found" — the target path is off. Remember to drop the
.test.js extension in {relativePath}.
- HTML saving fails with EPERM — use the prescribed save path
sfdc-test/unit/javascript/htdocs/sa11y/jest.
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。
它属于哪个仓库
skills/experience-lwc-accessibility-jest-run/SKILL.md同一个仓库里的其他技能
- commerce-b2b-open-code-components-integrate
- commerce-b2b-open-code-components-replace
- dx-devops-conflict-resolve
- dx-devops-pipeline-manage
- dx-devops-test-failures-analyze
- dx-devops-test-pipeline-configure
- dx-devops-test-suite-assignments-configure
- dx-devops-test-suite-run
- dx-devops-work-item-manage
- dx-app-analytics-query
- platform-agentexchange-partner-offers-configure
- automation-sandbox-post-copy-config-generate