Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleMessage = data => {
switch (data.type) {
case 'console': {
const message = Decode(data.log);
const { method, data: args } = message;
switch (method) {
case 'clear': {
// If the event was done by the packager
const hideMessage = args && args[0] === '__internal__';
this.clearConsole(hideMessage);
break;
}
default: {
this.addMessage(method, args);
break;
}
}
break;
handleMessage = data => {
switch (data.type) {
case 'console': {
const message = Decode(data.log);
const { method, data: args } = message;
switch (method) {
case 'clear': {
// If the event was done by the packager
const hideMessage = args && args[0] === '__internal__';
this.clearConsole(hideMessage);
break;
}
default: {
this.addMessage(method, args);
break;
}
}
break;
handleMessage = data => {
switch (data.type) {
case 'console': {
const message = Decode(data.log);
const {method, data: args} = message;
switch (method) {
case 'clear': {
// If the event was done by the packager
const hideMessage = args && args[0] === '__internal__';
this.clearConsole(hideMessage);
break;
}
default: {
this.addMessage(method, args);
break;
}
}
break;
setLogs(logs => ([Decode(log), ...logs]))
})
case 'eval-result': {
const { result, error } = data;
const decoded = Decode(result);
if (!error) {
this.addMessage('result', [decoded]);
} else {
this.addMessage('error', [decoded]);
}
break;
}
case 'test-result': {
const { result, error } = data;
const aggregatedResults = Decode(result);
if (!error) {
if (aggregatedResults) {
const { summaryMessage, failedMessages } = aggregatedResults;
this.addMessage('log', [summaryMessage]);
failedMessages.forEach(t => {
this.addMessage('warn', [t]);
});
} else {
this.addMessage('warn', [undefined]);
}
} else {
this.addMessage('error', [error]);
}
break;
}
case 'search-log': {
case 'eval-result': {
const {result, error} = data;
const decoded = Decode(result);
if (!error) {
this.addMessage('result', [decoded]);
} else {
this.addMessage('error', [decoded]);
}
break;
}
case 'test-result': {
const {result, error} = data;
const aggregatedResults = Decode(result);
if (!error) {
if (aggregatedResults) {
const {summaryMessage, failedMessages} = aggregatedResults;
this.addMessage('log', [summaryMessage]);
failedMessages.forEach(t => {
this.addMessage('warn', [t]);
});
} else {
this.addMessage('warn', [undefined]);
}
} else {
this.addMessage('error', [error]);
}
break;
}
default: {
break;
}
case 'clear-console': {
if (this.state.initialClear) {
this.setState({
initialClear: false,
});
} else {
this.clearConsole();
}
break;
}
case 'eval-result': {
const { result, error } = data;
const decoded = Decode(result);
if (!error) {
this.addMessage('result', [decoded]);
} else {
this.addMessage('error', [decoded]);
}
break;
}
case 'test-result': {
const { result, error } = data;
const aggregatedResults = Decode(result);
if (!error) {
if (aggregatedResults) {
const { summaryMessage, failedMessages } = aggregatedResults;
this.addMessage('log', [summaryMessage]);
this.setState((state) => {
var logz = state.logs.slice()
logz.push(Decode(log))
return {
logs: logz
}
})
break;
}
case 'clear-console': {
if (this.state.initialClear) {
this.setState({
initialClear: false,
});
} else {
this.clearConsole();
}
break;
}
case 'eval-result': {
const {result, error} = data;
const decoded = Decode(result);
if (!error) {
this.addMessage('result', [decoded]);
} else {
this.addMessage('error', [decoded]);
}
break;
}
case 'test-result': {
const {result, error} = data;
const aggregatedResults = Decode(result);
if (!error) {
if (aggregatedResults) {
const {summaryMessage, failedMessages} = aggregatedResults;
this.addMessage('log', [summaryMessage]);
break;
}
case 'clear-console': {
if (this.state.initialClear) {
this.setState({
initialClear: false,
});
} else {
this.clearConsole();
}
break;
}
case 'eval-result': {
const { result, error } = data;
const decoded = Decode(result);
if (!error) {
this.addMessage('result', [decoded]);
} else {
this.addMessage('error', [decoded]);
}
break;
}
case 'test-result': {
const { result, error } = data;
const aggregatedResults = Decode(result);
if (!error) {
if (aggregatedResults) {
const { summaryMessage, failedMessages } = aggregatedResults;
this.addMessage('log', [summaryMessage]);