( globalConfig: Config.GlobalConfig, config: Config.ProjectConfig, environment: JestEnvironment, runtime: Runtime, testPath: string, )
| 103 | }; |
| 104 | |
| 105 | export default async function jasmine2( |
| 106 | globalConfig: Config.GlobalConfig, |
| 107 | config: Config.ProjectConfig, |
| 108 | environment: JestEnvironment, |
| 109 | runtime: Runtime, |
| 110 | testPath: string, |
| 111 | ): Promise<TestResult> { |
| 112 | const reporter = new JasmineReporter(globalConfig, config, testPath); |
| 113 | const jasmineFactory = |
| 114 | runtime.requireInternalModule<typeof import('./jasmine/jasmineLight')>( |
| 115 | JASMINE, |
| 116 | ); |
| 117 | const jasmine = jasmineFactory.create({ |
| 118 | process, |
| 119 | testPath, |
| 120 | testTimeout: globalConfig.testTimeout, |
| 121 | }); |
| 122 | |
| 123 | const env = jasmine.getEnv(); |
| 124 | const jasmineInterface = jasmineFactory._interface(jasmine, env); |
| 125 | Object.assign(environment.global, jasmineInterface); |
| 126 | env.addReporter(jasmineInterface.jsApiReporter); |
| 127 | |
| 128 | // TODO: Remove config option if V8 exposes some way of getting location of caller |
| 129 | // in a future version |
| 130 | if (config.testLocationInResults === true) { |
| 131 | function wrapIt<T extends Global.ItBase>(original: T): T { |
| 132 | const wrapped = ( |
| 133 | testName: Global.TestName, |
| 134 | fn: Global.TestFn, |
| 135 | timeout?: number, |
| 136 | ) => { |
| 137 | const sourcemaps = runtime.getSourceMaps(); |
| 138 | let stack = getCallsite(1, sourcemaps); |
| 139 | const it = original(testName, fn, timeout); |
| 140 | |
| 141 | if (stack.getFileName()?.startsWith(jestEachBuildDir)) { |
| 142 | stack = getCallsite(2, sourcemaps); |
| 143 | } |
| 144 | // @ts-expect-error: `it` is `void` for some reason |
| 145 | it.result.__callsite = stack; |
| 146 | |
| 147 | return it; |
| 148 | }; |
| 149 | return wrapped as any as T; |
| 150 | } |
| 151 | |
| 152 | environment.global.it = wrapIt(environment.global.it); |
| 153 | environment.global.xit = wrapIt(environment.global.xit); |
| 154 | environment.global.fit = wrapIt(environment.global.fit); |
| 155 | } |
| 156 | |
| 157 | jasmineAsyncInstall(globalConfig, environment.global); |
| 158 | |
| 159 | installEach(environment); |
| 160 | |
| 161 | const failing = () => { |
| 162 | throw new ErrorWithStack( |
nothing calls this directly
no test coverage detected