搜尋套件、儲存庫與 APP 分類

套件詳情v0.1.5

spec_cli

Spec 的 CLI 工具 - 為 Dart 與 Flutter 設計的簡化測試框架。

macOSWindowsLinux
近 30 天下載
108
喜歡數
9
Pub 分數
100

安裝套件

flutter pub add spec_cli

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

spec_cli 是一個命令列介面工具,用於 Spec,這是一個專為 Dart 和 Flutter 應用程式設計的簡化測試框架。它透過直覺的命令簡化測試的建立、執行和管理。由 invertase.io 開發,該工具支援 macOS、Windows 和 Linux,讓開發者能跨平台高效運行測試。透過 `flutter pub add spec_cli` 進行最少設定即可無縫整合到現有工作流程中。CLI 透過減少樣板程式碼並在測試執行期間提供明確回饋來提升生產力。其輕量級設計專注於速度與開發者體驗。

適用情境

  • 在CI/CD流水線中自動化測試執行
  • 快速生成測試檔案
  • 使用最小配置執行測試
  • 與現有的 Dart/Flutter 項目整合
  • 簡化測試發現和報告

主要特色

  • 用於測試管理的簡單 CLI 命令
  • 跨平台支援(macOS、Windows、Linux)
  • 與 Flutter 和 Dart 的無縫整合
  • 快速測試執行與反饋
  • 內建測試檔案產生

適合對象

  • Dart 和 Flutter 開發者尋求高效測試
  • 使用 CI/CD 工作流程的團隊
  • 希望測試時設定最少的開發者
  • 測試自動化初學者
  • 優先考慮開發者體驗的專案

使用建議

  • 需要 Flutter SDK 才能獲得完整功能
  • 僅限使用 Spec 測試框架的專案
  • 可能需要為複雜的測試設置進行額外配置
  • 不適用於非 Dart/Flutter 項目

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

✅ Spec

A streamlined testing framework for Dart & Flutter.

Melos docs.page Chat on Discord

What is it?

Spec builds on-top of existing Dart & Flutter testing tools to provide a streamlined & elegant testing environment. Spec provides both a CLI tool and Dart package.

CLI

The Spec CLI allows you to run the spec command from your CLI environment and run your tests:

  • Intuitive testing output interface, inspired by Jest.
  • Interactive CLI (via spec --watch); automatically re-run tests when source code changes & rerunning of only failed tests.
  • Run both Dart & Flutter tests in parallel with a single command.
  • Run tests from multiple packages at the same time using Melos.

spec

Package

The spec package provides a different take on how to write tests. Designed with type-safety and IDE autocompletion in mind, spec alters the way you write your tests to be more declarative, less error prone and force good habits.

Getting Started

Matchers

Spec CLI works alongside normal Dart test matchers, however also ships with custom matchers, see the API reference docs.

Example of testing using Spec matchers:

import 'package:spec/spec.dart';

void main() {
  test('future example', () async {
    final future = Future.value(42);
    expect(future).toEqual(future);
    await expect(future).completion.toEqual(42);
    await expect(future).throws.isArgumentError();
  });

  test('stream example', () async {
    final stream = Stream.value(42);
    await expect(stream).emits.toEqual(42);
    await expect(stream).emits.isNull();
    await expect(stream).emits.not.isNull();
    await expect(stream).emitsError.isArgumentError();
  });

  test('function example', () {
    void throwsFn() => throw Error();
    expect(throwsFn).returnsNormally();
    expect(throwsFn).throws.isArgumentError();
  });
}
CLI
Installation
dart pub global activate spec_cli
Usage

Run tests:

spec

Run tests in interactive mode:

spec --watch

Interactive mode supports a number of keyboard shortcuts:

Watch Usage:
 › Press f to run only failed tests.
 › Press t to filter by a test name regex pattern.
 › Press q to quit watch mode.
 › Press Enter to trigger a test run.
GitHub Action

If you want to use Spec in your GitHub actions pipeline you can utilize the Spec GitHub action, instructions for how to use it can be found on the the spec-action's marketplace page and in its repository.


LICENSE

Built and maintained by Invertase.

所屬分類

依賴

依賴清單 14 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。