-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for compileFunction
allowing us to avoid the module wrapper
#9252
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,11 @@ export declare class JestEnvironment { | |
fakeTimersLolex: LolexFakeTimers | null; | ||
moduleMocker: jestMock.ModuleMocker | null; | ||
runScript<T = unknown>(script: Script): T | null; | ||
compileFunction?<T = unknown>( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've made it optional so we're not blocked by jsdom having support. It'll silently use it if it's ever implemented |
||
code: string, | ||
params: Array<string>, | ||
filename: string, | ||
): T | null; | ||
setup(): Promise<void>; | ||
teardown(): Promise<void>; | ||
handleTestEvent?(event: Circus.Event, state: Circus.State): void; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,8 @@ export default function handlePotentialSyntaxError( | |
} | ||
|
||
if ( | ||
e instanceof SyntaxError && | ||
// `instanceof` might come from the wrong context | ||
e.name === 'SyntaxError' && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the |
||
(e.message.includes('Unexpected token') || | ||
e.message.includes('Cannot use import')) && | ||
!e.message.includes(' expected') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it returns
Function