@mands/nx-playwright
Advanced tools
Comparing version 0.1.29 to 0.1.30
{ | ||
"name": "@mands/nx-playwright", | ||
"version": "0.1.29", | ||
"version": "0.1.30", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -49,3 +49,9 @@ "use strict"; | ||
.catch((error) => { | ||
console.error('Unexpected error', error); | ||
const message = error.stdout || error.stderr; | ||
if (message) { | ||
console.error(`Playwright errors ${message}`); | ||
} | ||
else { | ||
console.error('Unexpected error', error); | ||
} | ||
return false; | ||
@@ -52,0 +58,0 @@ }); |
@@ -119,3 +119,31 @@ import utilModule from 'util'; | ||
it('fails gracefully when command fails', async () => { | ||
it('logs error when command fails with stdout', async () => { | ||
const error = new Error('fake error') as Error & { stdout: string }; | ||
error.stdout = '\nRunning 3 tests using 1 worker\n...'; | ||
promisify.mockReturnValueOnce(jest.fn().mockRejectedValueOnce(error)); | ||
const { success } = await executor(options, context); | ||
expect(success).toBe(false); | ||
expect(console.error).toHaveBeenCalledTimes(1); | ||
expect(console.error).toHaveBeenCalledWith( | ||
`Playwright errors \nRunning 3 tests using 1 worker\n...`, | ||
); | ||
}); | ||
it('logs error when command fails with stderr', async () => { | ||
const error = new Error('fake error') as Error & { stderr: string }; | ||
error.stderr = '\nFailure message'; | ||
promisify.mockReturnValueOnce(jest.fn().mockRejectedValueOnce(error)); | ||
const { success } = await executor(options, context); | ||
expect(success).toBe(false); | ||
expect(console.error).toHaveBeenCalledTimes(1); | ||
expect(console.error).toHaveBeenCalledWith(`Playwright errors \nFailure message`); | ||
}); | ||
it('fails gracefully when command fails without stdout or stderr', async () => { | ||
const error = new Error('fake error'); | ||
@@ -122,0 +150,0 @@ promisify.mockReturnValueOnce(jest.fn().mockRejectedValueOnce(error)); |
Sorry, the diff of this file is not supported yet
50715
934