Search packages, repositories and app categories

Package detailsv0.1.5

spec_cli

CLI for Spec - a streamlined testing framework for Dart & Flutter.

macOSWindowsLinux
30-day downloads
108
Likes
9
Pub points
100

Install package

flutter pub add spec_cli

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

spec_cli is a command-line interface tool for Spec, a streamlined testing framework designed for Dart and Flutter applications. It simplifies test creation, execution, and management with intuitive commands. Built by invertase.io, the tool supports macOS, Windows, and Linux, enabling developers to run tests efficiently across platforms. With minimal setup via `flutter pub add spec_cli`, it integrates seamlessly into existing workflows. The CLI enhances productivity by reducing boilerplate and offering clear feedback during test runs. Its lightweight design focuses on speed and developer experience.

Use cases

  • Automating test execution in CI/CD pipelines
  • Quickly generating test files
  • Running tests with minimal configuration
  • Integrating with existing Dart/Flutter projects
  • Streamlining test discovery and reporting

Key features

  • Simple CLI commands for test management
  • Cross-platform support (macOS, Windows, Linux)
  • Seamless integration with Flutter and Dart
  • Fast test execution and feedback
  • Built-in test file generation

Suitable for

  • Dart and Flutter developers seeking efficient testing
  • Teams using CI/CD workflows
  • Developers wanting minimal setup for testing
  • Test automation beginners
  • Projects prioritizing developer experience

Considerations

  • Requires Flutter SDK for full functionality
  • Limited to projects using the Spec testing framework
  • May require additional configuration for complex test setups
  • Not suitable for non-Dart/Flutter projects

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

✅ 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.

Categories

Dependencies

Dependency list 14 items

Source repository

Projects using this package

No data available yet.