From 68d68f5282bb11f93cc24ac41634667469138878 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Sun, 15 Nov 2020 16:56:13 +0100 Subject: [PATCH] chore: skip circus-only tests when using jasmine (#10830) --- e2e/__tests__/circusConcurrentEach.test.ts | 9 +++--- .../toMatchInlineSnapshotWithRetries.test.ts | 31 +++++-------------- .../toMatchSnapshotWithRetries.test.ts | 31 +++++-------------- 3 files changed, 18 insertions(+), 53 deletions(-) diff --git a/e2e/__tests__/circusConcurrentEach.test.ts b/e2e/__tests__/circusConcurrentEach.test.ts index 27ef656e99b9..ca53c2605357 100644 --- a/e2e/__tests__/circusConcurrentEach.test.ts +++ b/e2e/__tests__/circusConcurrentEach.test.ts @@ -4,13 +4,13 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +import {skipSuiteOnJasmine} from '@jest/test-utils'; import {json as runWithJson} from '../runJest'; +skipSuiteOnJasmine(); + it('works with concurrent.each', () => { - const {json} = runWithJson('circus-concurrent', [ - 'concurrent-each.test.js', - '--testRunner=jest-circus/runner', - ]); + const {json} = runWithJson('circus-concurrent', ['concurrent-each.test.js']); expect(json.numTotalTests).toBe(4); expect(json.numPassedTests).toBe(2); expect(json.numFailedTests).toBe(0); @@ -20,7 +20,6 @@ it('works with concurrent.each', () => { it('works with concurrent.only.each', () => { const {json} = runWithJson('circus-concurrent', [ 'concurrent-only-each.test.js', - '--testRunner=jest-circus/runner', ]); expect(json.numTotalTests).toBe(4); expect(json.numPassedTests).toBe(2); diff --git a/e2e/__tests__/toMatchInlineSnapshotWithRetries.test.ts b/e2e/__tests__/toMatchInlineSnapshotWithRetries.test.ts index ed3583e67276..9ec508524f7f 100644 --- a/e2e/__tests__/toMatchInlineSnapshotWithRetries.test.ts +++ b/e2e/__tests__/toMatchInlineSnapshotWithRetries.test.ts @@ -6,6 +6,7 @@ */ import * as path from 'path'; +import {skipSuiteOnJasmine} from '@jest/test-utils'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -15,6 +16,8 @@ const TESTS_DIR = path.resolve(DIR, '__tests__'); beforeEach(() => cleanup(TESTS_DIR)); afterAll(() => cleanup(TESTS_DIR)); +skipSuiteOnJasmine(); + test('works with a single snapshot', () => { const filename = 'basic-support.test.js'; const template = makeTemplate(` @@ -39,12 +42,7 @@ test('works with a single snapshot', () => { writeFiles(TESTS_DIR, { [filename]: template(['index', '2' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Received: 2'); expect(stderr).toMatch('1 snapshot failed from 1 test suite.'); expect(exitCode).toBe(1); @@ -54,12 +52,7 @@ test('works with a single snapshot', () => { writeFiles(TESTS_DIR, { [filename]: template(['index', '4' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Snapshots: 1 passed, 1 total'); expect(exitCode).toBe(0); } @@ -113,12 +106,7 @@ test('works when multiple tests have snapshots but only one of them failed multi writeFiles(TESTS_DIR, { [filename]: template(['index', '2' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Snapshot name: `with retries snapshots 1`'); expect(stderr).toMatch('Received: 2'); expect(stderr).toMatch('1 snapshot failed from 1 test suite.'); @@ -129,12 +117,7 @@ test('works when multiple tests have snapshots but only one of them failed multi writeFiles(TESTS_DIR, { [filename]: template(['index', '4' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Snapshots: 1 passed, 1 total'); expect(exitCode).toBe(0); } diff --git a/e2e/__tests__/toMatchSnapshotWithRetries.test.ts b/e2e/__tests__/toMatchSnapshotWithRetries.test.ts index ef20f9a854c6..977ab9018251 100644 --- a/e2e/__tests__/toMatchSnapshotWithRetries.test.ts +++ b/e2e/__tests__/toMatchSnapshotWithRetries.test.ts @@ -6,6 +6,7 @@ */ import * as path from 'path'; +import {skipSuiteOnJasmine} from '@jest/test-utils'; import {cleanup, makeTemplate, writeFiles} from '../Utils'; import runJest from '../runJest'; @@ -15,6 +16,8 @@ const TESTS_DIR = path.resolve(DIR, '__tests__'); beforeEach(() => cleanup(TESTS_DIR)); afterAll(() => cleanup(TESTS_DIR)); +skipSuiteOnJasmine(); + test('works with a single snapshot', () => { const filename = 'basic-support.test.js'; const template = makeTemplate(` @@ -39,12 +42,7 @@ test('works with a single snapshot', () => { writeFiles(TESTS_DIR, { [filename]: template(['index', '2' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Received: 2'); expect(stderr).toMatch('1 snapshot failed from 1 test suite.'); expect(exitCode).toBe(1); @@ -54,12 +52,7 @@ test('works with a single snapshot', () => { writeFiles(TESTS_DIR, { [filename]: template(['index', '4' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Snapshots: 1 passed, 1 total'); expect(exitCode).toBe(0); } @@ -92,12 +85,7 @@ test('works when multiple tests have snapshots but only one of them failed multi writeFiles(TESTS_DIR, { [filename]: template(['index', '2' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Received: 2'); expect(stderr).toMatch('1 snapshot failed from 1 test suite.'); expect(exitCode).toBe(1); @@ -107,12 +95,7 @@ test('works when multiple tests have snapshots but only one of them failed multi writeFiles(TESTS_DIR, { [filename]: template(['index', '4' /* retries */]), }); - const {stderr, exitCode} = runJest(DIR, [ - '-w=1', - '--ci=false', - '--testRunner=jest-circus/runner', - filename, - ]); + const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]); expect(stderr).toMatch('Snapshots: 1 passed, 1 total'); expect(exitCode).toBe(0); }