Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move thallium/assert implementation out of core
- Loading branch information
1 parent
692471b
commit 7412ded
Showing
35 changed files
with
66 additions
and
3,130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
/node_modules | ||
|
||
# Tooling stuff | ||
npm-debug.log | ||
.eslintcache | ||
/npm-debug.log | ||
/.eslintcache | ||
|
||
# Generated stuff | ||
/assert.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,3 @@ | ||
"use strict" | ||
|
||
/** | ||
* Core TDD-style assertions. These are done by a composition of DSLs, since | ||
* there is *so* much repetition. Also, this is split into several namespaces to | ||
* keep the file size manageable. | ||
*/ | ||
|
||
var Util = require("./lib/assert/util") | ||
var Type = require("./lib/assert/type") | ||
var Equal = require("./lib/assert/equal") | ||
var Throws = require("./lib/assert/throws") | ||
var Has = require("./lib/assert/has") | ||
var Includes = require("./lib/assert/includes") | ||
var HasKeys = require("./lib/assert/has-keys") | ||
|
||
exports.AssertionError = Util.AssertionError | ||
exports.assert = Util.assert | ||
exports.fail = Util.fail | ||
exports.format = Util.format | ||
exports.escape = Util.escape | ||
|
||
exports.ok = Type.ok | ||
exports.notOk = Type.notOk | ||
exports.isBoolean = Type.isBoolean | ||
exports.notBoolean = Type.notBoolean | ||
exports.isFunction = Type.isFunction | ||
exports.notFunction = Type.notFunction | ||
exports.isNumber = Type.isNumber | ||
exports.notNumber = Type.notNumber | ||
exports.isObject = Type.isObject | ||
exports.notObject = Type.notObject | ||
exports.isString = Type.isString | ||
exports.notString = Type.notString | ||
exports.isSymbol = Type.isSymbol | ||
exports.notSymbol = Type.notSymbol | ||
exports.exists = Type.exists | ||
exports.notExists = Type.notExists | ||
exports.isArray = Type.isArray | ||
exports.notArray = Type.notArray | ||
exports.is = Type.is | ||
exports.not = Type.not | ||
|
||
exports.equal = Equal.equal | ||
exports.notEqual = Equal.notEqual | ||
exports.equalLoose = Equal.equalLoose | ||
exports.notEqualLoose = Equal.notEqualLoose | ||
exports.deepEqual = Equal.deepEqual | ||
exports.notDeepEqual = Equal.notDeepEqual | ||
exports.match = Equal.match | ||
exports.notMatch = Equal.notMatch | ||
exports.atLeast = Equal.atLeast | ||
exports.atMost = Equal.atMost | ||
exports.above = Equal.above | ||
exports.below = Equal.below | ||
exports.between = Equal.between | ||
exports.closeTo = Equal.closeTo | ||
exports.notCloseTo = Equal.notCloseTo | ||
|
||
exports.throws = Throws.throws | ||
exports.throwsMatch = Throws.throwsMatch | ||
|
||
exports.hasOwn = Has.hasOwn | ||
exports.notHasOwn = Has.notHasOwn | ||
exports.hasOwnLoose = Has.hasOwnLoose | ||
exports.notHasOwnLoose = Has.notHasOwnLoose | ||
exports.hasKey = Has.hasKey | ||
exports.notHasKey = Has.notHasKey | ||
exports.hasKeyLoose = Has.hasKeyLoose | ||
exports.notHasKeyLoose = Has.notHasKeyLoose | ||
exports.has = Has.has | ||
exports.notHas = Has.notHas | ||
exports.hasLoose = Has.hasLoose | ||
exports.notHasLoose = Has.notHasLoose | ||
|
||
/** | ||
* There's 2 sets of 12 permutations here for `includes` and `hasKeys`, instead | ||
* of N sets of 2 (which would fit the `foo`/`notFoo` idiom better), so it's | ||
* easier to just make a couple separate DSLs and use that to define everything. | ||
* | ||
* Here's the top level: | ||
* | ||
* - shallow | ||
* - strict deep | ||
* - structural deep | ||
* | ||
* And the second level: | ||
* | ||
* - includes all/not missing some | ||
* - includes some/not missing all | ||
* - not including all/missing some | ||
* - not including some/missing all | ||
* | ||
* Here's an example using the naming scheme for `hasKeys*` | ||
* | ||
* | shallow | strict deep | structural deep | ||
* --------------|-----------------|---------------------|---------------------- | ||
* includes all | `hasKeys` | `hasKeysDeep` | `hasKeysMatch` | ||
* includes some | `hasKeysAny` | `hasKeysAnyDeep` | `hasKeysAnyMatch` | ||
* missing some | `notHasKeysAll` | `notHasKeysAllDeep` | `notHasKeysAllMatch` | ||
* missing all | `notHasKeys` | `notHasKeysDeep` | `notHasKeysMatch` | ||
* | ||
* Note that the `hasKeys` shallow comparison variants are also overloaded to | ||
* consume either an array (in which it simply checks against a list of keys) or | ||
* an object (where it does a full deep comparison). | ||
*/ | ||
|
||
exports.includes = Includes.includes | ||
exports.includesDeep = Includes.includesDeep | ||
exports.includesMatch = Includes.includesMatch | ||
exports.includesAny = Includes.includesAny | ||
exports.includesAnyDeep = Includes.includesAnyDeep | ||
exports.includesAnyMatch = Includes.includesAnyMatch | ||
exports.notIncludesAll = Includes.notIncludesAll | ||
exports.notIncludesAllDeep = Includes.notIncludesAllDeep | ||
exports.notIncludesAllMatch = Includes.notIncludesAllMatch | ||
exports.notIncludes = Includes.notIncludes | ||
exports.notIncludesDeep = Includes.notIncludesDeep | ||
exports.notIncludesMatch = Includes.notIncludesMatch | ||
|
||
exports.hasKeys = HasKeys.hasKeys | ||
exports.hasKeysDeep = HasKeys.hasKeysDeep | ||
exports.hasKeysMatch = HasKeys.hasKeysMatch | ||
exports.hasKeysAny = HasKeys.hasKeysAny | ||
exports.hasKeysAnyDeep = HasKeys.hasKeysAnyDeep | ||
exports.hasKeysAnyMatch = HasKeys.hasKeysAnyMatch | ||
exports.notHasKeysAll = HasKeys.notHasKeysAll | ||
exports.notHasKeysAllDeep = HasKeys.notHasKeysAllDeep | ||
exports.notHasKeysAllMatch = HasKeys.notHasKeysAllMatch | ||
exports.notHasKeys = HasKeys.notHasKeys | ||
exports.notHasKeysDeep = HasKeys.notHasKeysDeep | ||
exports.notHasKeysMatch = HasKeys.notHasKeysMatch | ||
module.exports = require("clean-assert") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
# Documentation | ||
|
||
This is the Thallium documentation. It's still a work in progress, as there's a | ||
lot left to do in this framework. | ||
This is the Thallium documentation. It's still a work in progress, as there's a lot left to do in this framework. | ||
|
||
- [Getting Started](http://github.com/isiahmeadows/thallium/blob/master/docs/getting-started.md) | ||
- [API](http://github.com/isiahmeadows/thallium/blob/master/docs/api.md) | ||
- [Reporters](http://github.com/isiahmeadows/thallium/blob/master/docs/reporters.md) | ||
- [Core assertions](http://github.com/isiahmeadows/thallium/blob/master/docs/assertions.md) | ||
- [Command Line Runner](http://github.com/isiahmeadows/thallium/blob/master/docs/cli.md) | ||
- [Plugins](http://github.com/isiahmeadows/thallium/blob/master/docs/plugins.md) | ||
- [Examples](http://github.com/isiahmeadows/thallium/tree/master/docs/examples) | ||
- [Getting Started](./getting-started.md) | ||
- [API](./api.md) | ||
- [Reporters](./reporters.md) | ||
- [Command Line Runner](./cli.md) | ||
- [Plugins](./plugins.md) | ||
- [Examples](./examples) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.