testing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Testing

测试

The Boring JavaScript Stack uses a layered testing strategy: unit tests for helpers and business logic, integration tests for Inertia action responses, and end-to-end tests for full browser flows. Each layer uses purpose-built tooling that requires zero external test frameworks.
The Boring JavaScript Stack 采用分层测试策略:针对工具函数和业务逻辑的单元测试、针对 Inertia 动作响应的集成测试,以及针对完整浏览器流程的端到端测试。每一层都使用专门构建的工具,无需依赖任何外部测试框架。

When to Use

适用场景

Use this skill when:
  • Writing unit tests for Sails.js helpers using Node.js built-in test runner (
    node:test
    )
  • Writing end-to-end tests with Playwright for page flows and user interactions
  • Writing integration tests using
    inertia-sails/test
    assertion library
  • Configuring the test environment (
    config/env/test.js
    , database strategy, email mocking)
  • Setting up Playwright configuration (
    playwright.config.js
    )
  • Setting up CI/CD pipelines with GitHub Actions for automated testing
  • Understanding the
    getSails()
    singleton pattern for test initialization
在以下场景中使用本技能:
  • 使用 Node.js 内置测试运行器(
    node:test
    )为 Sails.js 工具函数编写单元测试
  • 使用 Playwright 编写针对页面流程和用户交互的端到端测试
  • 使用
    inertia-sails/test
    断言库编写集成测试
  • 配置测试环境(
    config/env/test.js
    、数据库策略、邮件模拟)
  • 配置 Playwright 环境(
    playwright.config.js
  • 使用 GitHub Actions 设置 CI/CD 流水线以实现自动化测试
  • 理解用于测试初始化的
    getSails()
    单例模式

Rules

规则说明

Read individual rule files for detailed explanations and code examples:
  • rules/getting-started.md - Testing philosophy, project structure, npm scripts, prerequisites
  • rules/unit-testing.md - Node.js built-in test runner, getSails() pattern, helper testing, assertions
  • rules/e2e-testing.md - Playwright setup, configuration, page testing, selectors, traces, CI
  • rules/integration-testing.md - inertia-sails/test API, all assertion methods, partial requests
  • rules/test-configuration.md - Test environment config, database strategy, email mocking, GitHub Actions CI
阅读各个规则文件以获取详细说明和代码示例:
  • rules/getting-started.md - 测试理念、项目结构、npm 脚本、前置要求
  • rules/unit-testing.md - Node.js 内置测试运行器、getSails() 模式、工具函数测试、断言
  • rules/e2e-testing.md - Playwright 安装配置、页面测试、选择器、追踪、CI 集成
  • rules/integration-testing.md - inertia-sails/test API、所有断言方法、部分请求测试
  • rules/test-configuration.md - 测试环境配置、数据库策略、邮件模拟、GitHub Actions CI 集成