Skip to content

Commit

Permalink
fix: type issues and test script
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 18, 2024
1 parent 176fc6e commit 81c7a9b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { configPkg } from '@adonisjs/eslint-config'
export default configPkg()
export default configPkg({
ignores: ['coverage'],
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"version": "npm run build",
"prepublishOnly": "npm run build",
"release": "release-it",
"quick:test": "node --import=ts-node-maintained/register/esm --enable-source-maps bin/test.ts"
"quick:test": "node --import=ts-node-maintained/register/esm --enable-source-maps --test \"tests/**/*.spec.ts\""
},
"devDependencies": {
"@adonisjs/eslint-config": "^2.0.0-beta.7",
Expand All @@ -56,6 +56,7 @@
"dependencies": {
"@poppinss/macroable": "^1.0.3",
"@types/chai": "^5.0.1",
"assertion-error": "^2.0.1",
"chai": "^5.1.2"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
* file that was distributed with this source code.
*/

import { assert, Assertion } from 'chai'
import Macroable from '@poppinss/macroable'
import { assert, Assertion, AssertionError } from 'chai'
import { AssertionError } from 'assertion-error'

import { subsetCompare } from './utils.js'
import type { AssertContract, ChaiAssert } from './types.js'
Expand Down
9 changes: 5 additions & 4 deletions tests_helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import * as chai from 'chai'
import { ErrorsPrinter } from '@japa/errors-printer'
import { AssertionError } from 'assertion-error'

export async function wrapAssertions(fn: () => void | Promise<void>) {
try {
Expand Down Expand Up @@ -42,10 +43,10 @@ export function expectError(fn: any, val?: any) {
})
}

throw new chai.AssertionError('Invalid val')
throw new AssertionError('Invalid val')
}

throw new chai.AssertionError('Expected an error')
throw new AssertionError('Expected an error')
}

/**
Expand All @@ -71,8 +72,8 @@ export async function expectAsyncError(fn: any, val?: any) {
})
}

throw new chai.AssertionError('Invalid val')
throw new AssertionError('Invalid val')
}

throw new chai.AssertionError('Expected an error')
throw new AssertionError('Expected an error')
}

0 comments on commit 81c7a9b

Please sign in to comment.