const messages = [];

page.on('console', async msg => {
    const args = await Promise.all(msg.args().map(arg => arg.jsonValue()));
    messages.push({
        type: msg._type,
        args
    });
});

exports.toHaveLogs = function(received) {
    expect(page).toEqual(received);
    return {
        pass: messages.length !== 0,
        message: () => {
            if (messages.length === 0) {
                return `There were no messages logged.`;
            }
            const formattedMessages = messages.map(
                ({ type, args }) => `${type}: ${args.join(',')}`
            );
            return `The following messages were logged - \n${formattedMessages.join(
                '\n'
            )}`;
        }
    };
};

@@ -3,24 +3,110 @@
 nst 
-messages = %5B%5D;%0A%0A
+%7B inspect %7D = require('util');%0A%0Aconst messages = %5B%5D;%0A%0AbeforeEach(() =%3E %7B%0A    messages.length = 0;%0A    
 page
@@ -131,24 +131,28 @@
 nc msg =%3E %7B%0A
+    
     const ar
@@ -215,24 +215,28 @@
 ue()));%0A    
+   
+ 
 messages.pus
@@ -247,16 +247,20 @@
         
+    
 type: ms
@@ -265,27 +265,74 @@
 msg.
-_
 type
-,%0A        args
+(),%0A            text: msg.text(),%0A            args%0A        %7D);
 %0A   
@@ -682,16 +682,22 @@
 (%7B type,
+ text,
  args %7D)
@@ -716,21 +716,28 @@
 : $%7B
-args.join(','
+text%7D $%7Binspect(args
 )%7D%60%0A

fix toHaveLogs message