Skip to content

Commit

Permalink
pr
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnMorreau committed May 1, 2024
1 parent 4f640c7 commit 584206d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion ark/attest/__tests__/benchTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { bench } from "@arktype/attest"
import { type } from "arktype"
import type { makeComplexType as externalmakeComplexType } from "./utils.js"

const fakeCallOptions = {
Expand Down
1 change: 0 additions & 1 deletion ark/attest/assert/attest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ attestInternal.instantiations = (

const calledFrom = caller()
const ctx = getBenchCtx([calledFrom.file])
ctx.isInlineBench = true
ctx.benchCallPosition = calledFrom
ctx.lastSnapCallPosition = calledFrom
instantiationDataHandler({ ...ctx, kind: "instantiations" }, args, false)
Expand Down
6 changes: 4 additions & 2 deletions ark/attest/assert/chainableAssertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ export class ChainableAssertions implements AssertionRecord {

private get actual() {
if (this.ctx.actual instanceof TypeAssertionMapping) {
const assertionEntry = this.ctx.typeRelationshipAssertionEntries![0][1]
return this.ctx.actual.fn(assertionEntry, this.ctx)!.actual
return this.ctx.actual.fn(
this.ctx.typeRelationshipAssertionEntries![0][1],
this.ctx
)!.actual
}
return this.ctx.actual
}
Expand Down
8 changes: 3 additions & 5 deletions ark/attest/bench/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ export type BenchContext = {
benchCallPosition: SourcePosition
lastSnapCallPosition: SourcePosition | undefined
isAsync: boolean
isInlineBench: boolean
}

export type BenchAssertionContext = BenchContext & {
Expand All @@ -328,11 +327,11 @@ process.on("beforeExit", () => {
process.exit(1)
}
})

export const getBenchCtx = (
qualifiedPath: string[],
isAsync: boolean = false,
options: BenchOptions = {},
isInlineBench = false
options: BenchOptions = {}
): BenchContext => {
return {
qualifiedPath,
Expand All @@ -341,7 +340,6 @@ export const getBenchCtx = (
cfg: getConfig(),
benchCallPosition: caller(),
lastSnapCallPosition: undefined,
isAsync,
isInlineBench
isAsync
} as BenchContext
}

0 comments on commit 584206d

Please sign in to comment.