From 2c65b214e30212ef928159289be6bdcc097a431d Mon Sep 17 00:00:00 2001 From: Mark1626 Date: Sun, 19 Jul 2020 23:03:50 +0530 Subject: [PATCH] test: Add e2e for jest-circus --- e2e/__tests__/circusConcurrentEach.test.ts | 29 +++++++++++++++++++ .../__tests__/concurrent-each.test.js | 20 +++++++++++++ .../__tests__/concurrent-only-each.test.js | 22 ++++++++++++++ e2e/circus-concurrent/package.json | 5 ++++ 4 files changed, 76 insertions(+) create mode 100644 e2e/__tests__/circusConcurrentEach.test.ts create mode 100644 e2e/circus-concurrent/__tests__/concurrent-each.test.js create mode 100644 e2e/circus-concurrent/__tests__/concurrent-only-each.test.js create mode 100644 e2e/circus-concurrent/package.json diff --git a/e2e/__tests__/circusConcurrentEach.test.ts b/e2e/__tests__/circusConcurrentEach.test.ts new file mode 100644 index 000000000000..27ef656e99b9 --- /dev/null +++ b/e2e/__tests__/circusConcurrentEach.test.ts @@ -0,0 +1,29 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import {json as runWithJson} from '../runJest'; + +it('works with concurrent.each', () => { + const {json} = runWithJson('circus-concurrent', [ + 'concurrent-each.test.js', + '--testRunner=jest-circus/runner', + ]); + expect(json.numTotalTests).toBe(4); + expect(json.numPassedTests).toBe(2); + expect(json.numFailedTests).toBe(0); + expect(json.numPendingTests).toBe(2); +}); + +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); + expect(json.numFailedTests).toBe(0); + expect(json.numPendingTests).toBe(2); +}); diff --git a/e2e/circus-concurrent/__tests__/concurrent-each.test.js b/e2e/circus-concurrent/__tests__/concurrent-each.test.js new file mode 100644 index 000000000000..1e358d9db85c --- /dev/null +++ b/e2e/circus-concurrent/__tests__/concurrent-each.test.js @@ -0,0 +1,20 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +it.concurrent.each([ + [1, 2], + [2, 3], +])('adds one to number', async (a, b) => { + expect(a + 1).toBe(b); +}); + +it.concurrent.skip.each([ + [1, 2], + [2, 3], +])('should skip this test', Promise.resolve()); diff --git a/e2e/circus-concurrent/__tests__/concurrent-only-each.test.js b/e2e/circus-concurrent/__tests__/concurrent-only-each.test.js new file mode 100644 index 000000000000..c818e1de3d53 --- /dev/null +++ b/e2e/circus-concurrent/__tests__/concurrent-only-each.test.js @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +'use strict'; + +it.concurrent.only.each([ + [1, 2], + [2, 3], +])('adds one to number', async (a, b) => { + expect(a + 1).toBe(b); +}); + +it.concurrent.each([ + [1, 2], + [2, 3], +])('adds one to number', async (a, b) => { + expect(a + 1).toBe(b); +}); diff --git a/e2e/circus-concurrent/package.json b/e2e/circus-concurrent/package.json new file mode 100644 index 000000000000..148788b25446 --- /dev/null +++ b/e2e/circus-concurrent/package.json @@ -0,0 +1,5 @@ +{ + "jest": { + "testEnvironment": "node" + } +}