Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should stop executing code cells on an error', async () => {
let cell = widget.model.contentFactory.createCodeCell({});
cell.value.text = ERROR_INPUT;
widget.model.cells.insert(2, cell);
widget.select(widget.widgets[2]);
cell = widget.model.contentFactory.createCodeCell({});
widget.model.cells.push(cell);
widget.select(widget.widgets[widget.widgets.length - 1]);
const result = await NotebookActions.run(widget, ipySession);
expect(result).to.equal(false);
expect(cell.executionCount).to.be.null;
await ipySession.kernel.restart();
}).timeout(30000); // Allow for slower CI
it('should stop executing code cells on an error', async () => {
let cell = widget.model.contentFactory.createCodeCell({});
cell.value.text = ERROR_INPUT;
widget.model.cells.insert(2, cell);
widget.select(widget.widgets[2]);
cell = widget.model.contentFactory.createCodeCell({});
widget.model.cells.push(cell);
widget.select(widget.widgets[widget.widgets.length - 1]);
const result = await NotebookActions.run(widget, ipySession);
expect(result).to.equal(false);
expect(cell.executionCount).to.be.null;
await ipySession.kernel.restart();
}).timeout(30000); // Allow for slower CI
it('should delete deletedCells metadata when cell run', () => {
let cell = widget.activeCell as CodeCell;
cell.model.outputs.clear();
return NotebookActions.run(widget, session).then(result => {
expect(result).to.equal(true);
expect(widget.model.deletedCells.length).to.equal(0);
});
});
it('should change to command mode', async () => {
widget.mode = 'edit';
const result = await NotebookActions.run(widget, session);
expect(result).to.equal(true);
expect(widget.mode).to.equal('command');
});
it('should handle no session', async () => {
const result = await NotebookActions.run(widget, null);
expect(result).to.equal(true);
const cell = widget.activeCell as CodeCell;
expect(cell.model.executionCount).to.be.null;
});
execute: args => {
const current = getCurrent(args);
if (current) {
const { context, notebook } = current;
return NotebookActions.run(notebook, context.session);
}
},
isEnabled
execute: args => {
const current = getCurrent(args);
if (current) {
const { context, content } = current;
return NotebookActions.run(content, context.session);
}
},
isEnabled
execute: () => {
return NotebookActions.run(
nbWidget.content,
nbWidget.context.session
);
}
});
execute: args => {
const current = getCurrent(args);
if (current) {
const { context, notebook } = current;
return NotebookActions.run(notebook, context.session);
}
},
isEnabled
execute: args => {
const current = getCurrent(args);
if (current) {
const { context, content } = current;
NotebookActions.run(content, context.session);
current.content.mode = 'edit';
}
},
isEnabled