PHPackages                             hhvm/hacktest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. hhvm/hacktest

AbandonedArchivedLibrary

hhvm/hacktest
=============

The Hack Test Library

v2.4.0(3y ago)31614.4k↓42.2%13[9 issues](https://github.com/hhvm/hacktest/issues)[1 PRs](https://github.com/hhvm/hacktest/pulls)20MITHack

Since Jul 18Pushed 2y ago14 watchersCompare

[ Source](https://github.com/hhvm/hacktest)[ Packagist](https://packagist.org/packages/hhvm/hacktest)[ RSS](/packages/hhvm-hacktest/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (28)Used By (20)

HackTest
========

[](#hacktest)

[![Build Status](https://camo.githubusercontent.com/b7b35670ea85412c92d61e92307c2c3fdfde9e9005dbb06c344aeab2b66a01f6/68747470733a2f2f7472617669732d63692e6f72672f6868766d2f6861636b746573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hhvm/hacktest)

HackTest is a unit test runner and base class. Assertions are provided by separate libraries, such [fbexpect](https://github.com/hhvm/fbexpect).

Installation
------------

[](#installation)

```
php /path/to/composer.phar require --dev hhvm/hacktest facebook/fbexpect

```

Usage
-----

[](#usage)

To run tests:

```
vendor/bin/hacktest [OPTIONS] tests/

```

Tests are methods in classes, where:

- the class name matches the file name
- the class name ends with 'Test'
- the method is public
- the method name begins with 'test'

Test methods can be async, and will automatically be awaited.

Additionally, classes can implement several special methods:

- `public static function beforeFirstTestAsync(): Awaitable`
- `public static function afterLastTestAsync(): Awaitable`
- `public function beforeEachTestAsync(): Awaitable`
- `public function afterEachTestAsync(): Awaitable`

Finally, for data-driven tests, the `` attribute can be used:

```
public function provideFoos(): vec {
  return vec[
    tuple('foo', 123),
    tuple('bar', 456),
  ];
}

>
public function testFoos(string $a, int $b): void {
  ....
}
```

Examples
--------

[](#examples)

### "I want to test all files in a directory"

[](#i-want-to-test-all-files-in-a-directory)

```
$ vendor/bin/hacktest tests/clean/exit/

...

Summary: 3 test(s), 3 passed, 0 failed, 0 skipped, 0 error(s).

```

### "I want to run all tests in a specific file"

[](#i-want-to-run-all-tests-in-a-specific-file)

```
$ vendor/bin/hacktest tests/dirty/DirtyAsyncTest.php

FFF

1) DirtyAsyncTest::testWithNonNullableTypesAsync
Failed asserting that Array &0 (
    0 => 1
    1 => 'foo'
) is not identical to Array &0 (
    0 => 1
    1 => 'foo'
).

/fakepath/hacktest/tests/dirty/DirtyAsyncTest.php(22): Facebook\FBExpect\ExpectObj->toNotBeSame()
/fakepath/hacktest/src/Framework/HackTestCase.php(43): DirtyAsyncTest->testWithNonNullableTypesAsync()

2)...

Summary: 3 test(s), 0 passed, 3 failed, 0 skipped, 0 error(s).

```

For an example in verbose mode, see [example.txt](example.txt)

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md).

License
-------

[](#license)

The HackTest framework is MIT-licensed.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community43

Growing community involvement

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Recently: every ~136 days

Total

27

Last Release

1442d ago

Major Versions

v0.2 → v1.02018-09-19

v1.6.3 → v2.0.02019-10-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8306375?v=4)[HHVM Community Bot](/maintainers/hhvm-bot)[@hhvm-bot](https://github.com/hhvm-bot)

![](https://avatars.githubusercontent.com/u/601530?v=4)[Yang, Bo](/maintainers/Atry)[@Atry](https://github.com/Atry)

![](https://avatars.githubusercontent.com/u/727402?v=4)[Alexey Toptygin](/maintainers/alexeyt)[@alexeyt](https://github.com/alexeyt)

---

Top Contributors

[![fredemmott](https://avatars.githubusercontent.com/u/360927?v=4)](https://github.com/fredemmott "fredemmott (156 commits)")[![kmeht](https://avatars.githubusercontent.com/u/1120478?v=4)](https://github.com/kmeht "kmeht (77 commits)")[![wlin53](https://avatars.githubusercontent.com/u/26862692?v=4)](https://github.com/wlin53 "wlin53 (40 commits)")[![lexidor](https://avatars.githubusercontent.com/u/31805625?v=4)](https://github.com/lexidor "lexidor (18 commits)")[![jjergus](https://avatars.githubusercontent.com/u/2483917?v=4)](https://github.com/jjergus "jjergus (11 commits)")[![Atry](https://avatars.githubusercontent.com/u/601530?v=4)](https://github.com/Atry "Atry (7 commits)")[![DavidSnider](https://avatars.githubusercontent.com/u/10112104?v=4)](https://github.com/DavidSnider "DavidSnider (6 commits)")[![periodic1236](https://avatars.githubusercontent.com/u/1748071?v=4)](https://github.com/periodic1236 "periodic1236 (4 commits)")[![hgoldstein](https://avatars.githubusercontent.com/u/5455867?v=4)](https://github.com/hgoldstein "hgoldstein (3 commits)")[![viratyosin](https://avatars.githubusercontent.com/u/6019010?v=4)](https://github.com/viratyosin "viratyosin (3 commits)")[![KendallHopkins](https://avatars.githubusercontent.com/u/72923?v=4)](https://github.com/KendallHopkins "KendallHopkins (3 commits)")[![jwatzman](https://avatars.githubusercontent.com/u/575697?v=4)](https://github.com/jwatzman "jwatzman (2 commits)")[![alexeyt](https://avatars.githubusercontent.com/u/727402?v=4)](https://github.com/alexeyt "alexeyt (2 commits)")[![facebook-github-bot](https://avatars.githubusercontent.com/u/6422482?v=4)](https://github.com/facebook-github-bot "facebook-github-bot (1 commits)")[![rodmk](https://avatars.githubusercontent.com/u/2280164?v=4)](https://github.com/rodmk "rodmk (1 commits)")[![simonwelsh](https://avatars.githubusercontent.com/u/125915?v=4)](https://github.com/simonwelsh "simonwelsh (1 commits)")[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (1 commits)")[![WizKid](https://avatars.githubusercontent.com/u/59419?v=4)](https://github.com/WizKid "WizKid (1 commits)")[![aloiret-ed](https://avatars.githubusercontent.com/u/92757732?v=4)](https://github.com/aloiret-ed "aloiret-ed (1 commits)")

### Embed Badge

![Health badge](/badges/hhvm-hacktest/health.svg)

```
[![Health](https://phpackages.com/badges/hhvm-hacktest/health.svg)](https://phpackages.com/packages/hhvm-hacktest)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
