Skip to content

Commit

Permalink
Add test for "beforeEach" in "test" behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Jimenez Esun committed Apr 30, 2018
1 parent 4c75933 commit 9cee675
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
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 @@
{}

0 comments on commit 9cee675

Please sign in to comment.