Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 58 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/test",
"version": "5.4.0",
"version": "5.5.0",
"description": "The Athenna test runner. Built on top of Japa.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down Expand Up @@ -57,6 +57,7 @@
},
"dependencies": {
"@japa/assert": "^4.1.1",
"@japa/expect-type": "^2.0.3",
"@japa/runner": "^3.1.4",
"@types/sinon": "^10.0.20",
"c8": "^10.1.3",
Expand Down
20 changes: 19 additions & 1 deletion src/helpers/Runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
*/

import type { Config, PluginFn } from '#src'
import { Importer, run, assert, configure, processCLIArgs } from '#src'
import {
Importer,
run,
assert,
configure,
processCLIArgs,
expectTypeOf
} from '#src'

export class Runner {
public static files: string[] = []
Expand Down Expand Up @@ -80,6 +87,17 @@ export class Runner {
return this.addPlugin(assert())
}

/**
* Add the `expectTypeOf()` plugin.
*
* @example ```ts
* Runner.addExpectTypeOfPlugin()
* ```
*/
public static addExpectTypeOfPlugin(): typeof Runner {
return this.addPlugin(expectTypeOf())
}

/**
* Set the global timeout of all tests.
*
Expand Down
12 changes: 11 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@

import { assert, Assert } from '@japa/assert'
import { spec } from '@japa/runner/reporters'
import { expectTypeOf } from '@japa/expect-type'
import { run, test, configure, processCLIArgs } from '@japa/runner'

export { Assert, run, spec, test, assert, configure, processCLIArgs }
export {
Assert,
run,
spec,
test,
assert,
expectTypeOf,
configure,
processCLIArgs
}

export * from '#src/types'

Expand Down
10 changes: 5 additions & 5 deletions src/mocks/MockBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export class MockBuilder {
* mock.called // false
* ```
*/
public value(value: any) {
public value(value?: any) {
this.stub = this.stub.value(value)

return this
Expand All @@ -489,7 +489,7 @@ export class MockBuilder {
* mock.called // false
* ```
*/
public return(value: any) {
public return(value?: any) {
this.stub = this.stub.returns(value)

return this
Expand All @@ -507,7 +507,7 @@ export class MockBuilder {
* mock.called // false
* ```
*/
public throw(value: string | Error | Exception): MockBuilder {
public throw(value?: string | Error | Exception): MockBuilder {
this.stub = this.stub.throws(value)

return this
Expand All @@ -525,7 +525,7 @@ export class MockBuilder {
* mock.called // false
* ```
*/
public resolve(value: any) {
public resolve(value?: any) {
this.stub = this.stub.resolves(value)

return this
Expand All @@ -543,7 +543,7 @@ export class MockBuilder {
* mock.called // false
* ```
*/
public reject<T = any>(value: T): MockBuilder {
public reject<T = any>(value?: T): MockBuilder {
this.stub = this.stub.rejects(value)

return this
Expand Down
Loading