Skip to content

Commit

Permalink
Merge pull request #76 from AthennaIO/develop
Browse files Browse the repository at this point in the history
fix(types): export some defaults japa types
  • Loading branch information
jlenon7 committed Mar 9, 2023
2 parents bafd8b4 + 5a05657 commit d9d844c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 32 deletions.
31 changes: 0 additions & 31 deletions bin/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,6 @@ import { assert } from '@japa/assert'
import { specReporter } from '@japa/spec-reporter'
import { configure, processCliArgs, run } from '@japa/runner'

/*
|--------------------------------------------------------------------------
| Japa types
|--------------------------------------------------------------------------
|
| Declare customized japa types.
*/

declare module '@japa/assert' {
export interface Assert {
throws(fn: () => any, errType: any, message?: string): void
doesNotThrows(fn: () => any, errType: any, message?: string): void
rejects(
fn: () => any | Promise<any>,
errType: any,
message?: string,
): Promise<any>
doesNotRejects(
fn: () => any | Promise<any>,
errType: any,
message?: string,
): Promise<any>
}
}

declare module '@japa/runner' {
interface TestContext {
assert: import('@japa/assert').Assert
}
}

/*
|--------------------------------------------------------------------------
| Set IS_TS env.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/test",
"version": "3.1.0",
"version": "3.1.1",
"description": "The Athenna test runner. Built on top of Japa.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down
23 changes: 23 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@
* file that was distributed with this source code.
*/

declare module '@japa/assert' {
export interface Assert {
throws(fn: () => any, errType: any, message?: string): void
doesNotThrows(fn: () => any, errType: any, message?: string): void
rejects(
fn: () => any | Promise<any>,
errType: any,
message?: string,
): Promise<any>
doesNotRejects(
fn: () => any | Promise<any>,
errType: any,
message?: string,
): Promise<any>
}
}

declare module '@japa/runner' {
interface TestContext {
assert: import('@japa/assert').Assert
}
}

export * from './Helpers/Importer.js'
export * from './Decorators/AfterAll.js'
export * from './Decorators/AfterEach.js'
Expand Down

0 comments on commit d9d844c

Please sign in to comment.