From 5ca5189043f7ab1f0189e593266f4e4f18d32b67 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 24 Feb 2020 14:02:54 +0100 Subject: [PATCH 1/4] fix: added missing typings declaration (#52) --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9d0e4f75..cd66626b 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "bin": { "jest-playwright": "./lib/bin/index.js" }, + "types": "./types/global.d.ts", "repository": { "url": "https://github.com/mmarkelov/jest-playwright.git", "type": "git" From e039fbd523bb325f509334c4ff7fe6b77faaa700 Mon Sep 17 00:00:00 2001 From: Maksim Markelov Date: Wed, 26 Feb 2020 13:16:02 +0300 Subject: [PATCH 2/4] Add messages for browser test processes (#53) * Add messages for browser test processes * Exclude tests from build --- src/bin/testProcess.ts | 15 +++++++++++---- src/bin/utils.test.ts | 16 +++++++++++++++- src/bin/utils.ts | 4 ++++ tsconfig.json | 10 +++++++--- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/bin/testProcess.ts b/src/bin/testProcess.ts index 6e67926c..45ffc8dd 100644 --- a/src/bin/testProcess.ts +++ b/src/bin/testProcess.ts @@ -1,6 +1,6 @@ import { spawn, spawnSync, SpawnSyncOptions } from 'child_process' import { readConfig } from '../utils' -import { checkBrowsers } from './utils' +import { checkBrowsers, getResultByStatus } from './utils' import { PARALLEL, BrowserType } from '../constants' const getSpawnOptions = (browser: BrowserType): SpawnSyncOptions => ({ @@ -21,12 +21,19 @@ const exec = ({ browser: BrowserType params: string[] }): void => { - // TODO Add messages for browser process const options = getSpawnOptions(browser) if (sequence === PARALLEL) { - spawn('node', [`node_modules/.bin/jest ${params}`], options) + const process = spawn('node', [`node_modules/.bin/jest ${params}`], options) + process.on('close', status => { + console.log(`${getResultByStatus(status)} tests for ${browser}\n\n`) + }) } else { - spawnSync('node', [`node_modules/.bin/jest ${params}`], options) + const { status } = spawnSync( + 'node', + [`node_modules/.bin/jest ${params}`], + options, + ) + console.log(`${getResultByStatus(status)} tests for ${browser}`) } } diff --git a/src/bin/utils.test.ts b/src/bin/utils.test.ts index fb2198be..cc4a957e 100644 --- a/src/bin/utils.test.ts +++ b/src/bin/utils.test.ts @@ -1,4 +1,4 @@ -import { checkBrowsers } from './utils' +import { checkBrowsers, getResultByStatus } from './utils' import { BrowserType } from '../constants' describe('checkBrowsers', () => { @@ -18,3 +18,17 @@ describe('checkBrowsers', () => { ).toThrow() }) }) + +describe('getResultByStatus', () => { + it('should return "Failed" if passed null', () => { + expect(getResultByStatus(null)).toBe('Failed') + }) + + it('should return "Failed" if passed code 1', () => { + expect(getResultByStatus(1)).toBe('Failed') + }) + + it('should return "Passed" if passed code 0', () => { + expect(getResultByStatus(0)).toBe('Passed') + }) +}) diff --git a/src/bin/utils.ts b/src/bin/utils.ts index cd2fe0c2..50aa3620 100644 --- a/src/bin/utils.ts +++ b/src/bin/utils.ts @@ -9,3 +9,7 @@ export const checkBrowsers = (browsers?: BrowserType[]): void => { } browsers.forEach(checkBrowserEnv) } + +export const getResultByStatus = (status: number | null): string => { + return status !== 0 ? 'Failed' : 'Passed' +} diff --git a/tsconfig.json b/tsconfig.json index b697cfbc..ac14022c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,9 +8,13 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "types/global.d.ts", + "types/global.d.ts" ], "include": [ - "src/**/*", + "src/**/*" ], -} \ No newline at end of file + "exclude": [ + "node_modules", + "**/*.test.ts" + ] +} From 44f07ff7c3372d679bd594c2d4dc195ffaf3fed3 Mon Sep 17 00:00:00 2001 From: mmarkelov Date: Wed, 26 Feb 2020 13:17:33 +0300 Subject: [PATCH 3/4] v0.0.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd66626b..b4468c2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jest-playwright-preset", - "version": "0.0.10", + "version": "0.0.12", "main": "index.js", "description": "Running tests using Jest & Playwright.", "license": "MIT", From 9c3fa21948df1621df716b18c699c3d6622fc62a Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Sat, 29 Feb 2020 08:14:42 +0100 Subject: [PATCH 4/4] fix: parallel script for windows (#56) --- src/bin/testProcess.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/testProcess.ts b/src/bin/testProcess.ts index 45ffc8dd..f72dd1f9 100644 --- a/src/bin/testProcess.ts +++ b/src/bin/testProcess.ts @@ -23,14 +23,18 @@ const exec = ({ }): void => { const options = getSpawnOptions(browser) if (sequence === PARALLEL) { - const process = spawn('node', [`node_modules/.bin/jest ${params}`], options) + const process = spawn( + 'node', + [`node_modules/jest/bin/jest.js ${params}`], + options, + ) process.on('close', status => { console.log(`${getResultByStatus(status)} tests for ${browser}\n\n`) }) } else { const { status } = spawnSync( 'node', - [`node_modules/.bin/jest ${params}`], + [`node_modules/jest/bin/jest.js ${params}`], options, ) console.log(`${getResultByStatus(status)} tests for ${browser}`)