mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 18:48:33 -05:00
First draft of outputProcessor tests (#11368)
* First draft of outputProcessor tests * add return type for a function * pr feedback * comments and Spellings, getRandom ==> getRandomElement * pr feedback * pr feedback
This commit is contained in:
@@ -41,10 +41,10 @@ export function getData(output: nb.ICellOutput): JSONObject {
|
||||
} else if (nbformat.isError(output)) {
|
||||
let traceback = output.traceback ? output.traceback.join('\n') : undefined;
|
||||
bundle['application/vnd.jupyter.stderr'] = undefined;
|
||||
if (traceback && traceback !== '') {
|
||||
if (traceback) {
|
||||
bundle['application/vnd.jupyter.stderr'] = traceback;
|
||||
} else if (output.evalue) {
|
||||
bundle['application/vnd.jupyter.stderr'] = output.ename && output.ename !== '' ? `${output.ename}: ${output.evalue}` : `${output.evalue}`;
|
||||
bundle['application/vnd.jupyter.stderr'] = output.ename ? `${output.ename}: ${output.evalue}` : `${output.evalue}`;
|
||||
}
|
||||
}
|
||||
return convertBundle(bundle);
|
||||
@@ -78,7 +78,7 @@ export function getBundleOptions(options: IOutputModelOptions): MimeModel.IOptio
|
||||
*/
|
||||
export function extract(value: JSONObject, key: string): {} {
|
||||
let item = value[key];
|
||||
if (isPrimitive(item)) {
|
||||
if (item === undefined || item === null || isPrimitive(item)) {
|
||||
return item;
|
||||
}
|
||||
return JSON.parse(JSON.stringify(item));
|
||||
|
||||
Reference in New Issue
Block a user