globals, not global functions
This commit is contained in:
parent
20e2dd3b31
commit
7a4affd01e
|
|
@ -33,7 +33,7 @@ declare module 'bun:test' {
|
|||
toMatchTree(expected: string): T
|
||||
toMatchExpression(expected: string): T
|
||||
toFailParse(): T
|
||||
toEvaluateTo(expected: unknown, nativeFunctions?: Record<string, Function>): Promise<T>
|
||||
toEvaluateTo(expected: unknown, globals?: Record<string, any>): Promise<T>
|
||||
toFailEvaluation(): Promise<T>
|
||||
}
|
||||
}
|
||||
|
|
@ -96,13 +96,13 @@ expect.extend({
|
|||
async toEvaluateTo(
|
||||
received: unknown,
|
||||
expected: unknown,
|
||||
nativeFunctions: Record<string, Function> = {}
|
||||
globals: Record<string, any> = {}
|
||||
) {
|
||||
assert(typeof received === 'string', 'toEvaluateTo can only be used with string values')
|
||||
|
||||
try {
|
||||
const compiler = new Compiler(received)
|
||||
const result = await run(compiler.bytecode, nativeFunctions)
|
||||
const result = await run(compiler.bytecode, globals)
|
||||
let value = VMResultToValue(result)
|
||||
|
||||
// Just treat regex as strings for comparison purposes
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user