Skip to content
A Hack library for writing unit tests expressively
Branch: master
Clone or download
fredemmott Update requirement to HHVM 4.1
- 4.0 is unsupported
- 4.1 is the oldest supported release
- test 4.1-latest, latest, and nightlies
Latest commit 166f5c8 May 20, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src linty fresh May 20, 2019
tests Allow toAlmostEqual with nulls Feb 14, 2019
.LICENSE_HEADER.hh.txt License header linter Feb 14, 2019
.gitattributes Don't install tests/ or .hhconfig Sep 21, 2018
.gitignore Ignore composer.lock Apr 22, 2019
.hhconfig Support typed user attributes Oct 18, 2018 Ignore composer.lock Apr 22, 2019
.travis.yml Update requirement to HHVM 4.1 May 20, 2019 Add Feb 14, 2019 Add and Jul 3, 2017
LICENSE Relicense to MIT Apr 12, 2018 update readme Sep 25, 2018
composer.json Update requirement to HHVM 4.1 May 20, 2019
hhast-lint.json More linters, and strict everything Feb 14, 2019

Build Status


FBExpect is a standalone unit testing utility based on the notion of assertions from PHPUnit. Starting with 2.x, FBExpect no longer uses PHPUnit as a dependency, and instead implements the assertions directly, and is intentended for use with HackTest.



It is linguistically clear which value is the expected value and which is the actual value:

use function Facebook\FBExpect\expect;

// PHPUnit
$this->assertSame($a, $b);

// FBExpect

Type Refinement

use function Facebook\FBExpect\expect;

// PHPUnit
$this->assertNotNull($x); // Actual test
assert($x !== null); // Tell the typechecker what's going on
$this->assertInstanceOf(Foo::class, $y);
assert($y instanceof Foo);

// FBExpect
$x = expect($x)->toNotBeNull();
$y = expect($y)->toBeInstanceOf(Foo::class);


FBExpect is installed via composer:

hhvm ~/composer require facebook/fbexpect


FBExpect is MIT-licensed.

You can’t perform that action at this time.