Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('with error in the code, should return correct line number in error', () => {
code = '// Prepend\n error';
state = generateDefaultState(workspaceLocation, { editorPrepend: '// Prepend' });
runInContext(code, context, { scheduler: 'preemptive', originalMaxExecTime: 1000 }).then(
result => (context = (result as Finished).context)
);
const errors = context.errors.map((error: SourceError) => {
const newError = cloneDeep(error);
newError.location.start.line = newError.location.start.line - 1;
newError.location.end.line = newError.location.end.line - 1;
return newError;
});
return expectSaga(evalCode, code, context, execTime, workspaceLocation, actionType)
.withState(state)
.call(runInContext, code, context, {
scheduler: 'preemptive',
originalMaxExecTime: execTime
})