diff --git a/integration-tests/__tests__/__snapshots__/before-each-queue.js.snap b/integration-tests/__tests__/__snapshots__/before-each-queue.js.snap new file mode 100644 index 000000000000..030491cd1f2d --- /dev/null +++ b/integration-tests/__tests__/__snapshots__/before-each-queue.js.snap @@ -0,0 +1,20 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Correct beforeEach order ensures the correct order for beforeEach 1`] = ` +" console.log __tests__/before-each-queue.test.js:3 + BeforeEach + + console.log __tests__/before-each-queue.test.js:7 + It Foo + + console.log __tests__/before-each-queue.test.js:10 + BeforeEach Inline Foo + + console.log __tests__/before-each-queue.test.js:3 + BeforeEach + + console.log __tests__/before-each-queue.test.js:15 + It Bar + +" +`; diff --git a/integration-tests/__tests__/before-each-queue.js b/integration-tests/__tests__/before-each-queue.js new file mode 100644 index 000000000000..ad352b0f269a --- /dev/null +++ b/integration-tests/__tests__/before-each-queue.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. 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. + * + * @flow + */ +'use strict'; + +const runJest = require('../runJest'); + +describe('Correct beforeEach order', () => { + it('ensures the correct order for beforeEach', () => { + const result = runJest('before-each-queue'); + expect(result.stdout).toMatchSnapshot(); + }); +}); diff --git a/integration-tests/before-each-queue/__tests__/before-each-queue.test.js b/integration-tests/before-each-queue/__tests__/before-each-queue.test.js new file mode 100644 index 000000000000..8f49fe124c27 --- /dev/null +++ b/integration-tests/before-each-queue/__tests__/before-each-queue.test.js @@ -0,0 +1,21 @@ +describe('test', () => { + beforeEach(() => { + console.log('BeforeEach'); + }); + + it('foo', () => { + console.log('It Foo'); + + beforeEach(() => { + console.log('BeforeEach Inline Foo'); + }); + }); + + it('bar', () => { + console.log('It Bar'); + + beforeEach(() => { + console.log('BeforeEach Inline Bar'); + }); + }); +}); diff --git a/integration-tests/before-each-queue/package.json b/integration-tests/before-each-queue/package.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/integration-tests/before-each-queue/package.json @@ -0,0 +1 @@ +{}