Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
connection.onMessage(message => {
try {
const {messageType, data} = parseMessage(message);
switch (messageType) {
case MESSAGE_TYPES.RUN_TEST: {
const testData = parseJSON(data);
runTest(
testData.path,
testData.globalConfig,
testData.config,
getResolver(testData.config, testData.rawModuleMap),
)
.catch(error => {
const testResult = buildFailureTestResult(
testData.path,
error,
testData.config,
testData.globalConfig,
);
return testResult;
})
.then(result => {
const msg = makeMessage({