Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for "beforeEach" in "test" behavior #6098

Merged
merged 1 commit into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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

"
`;
18 changes: 18 additions & 0 deletions integration-tests/__tests__/before-each-queue.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
Original file line number Diff line number Diff line change
@@ -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');
});
});
});
1 change: 1 addition & 0 deletions integration-tests/before-each-queue/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}