From 0f94fbb352c32dc0568bc030e2fa0062d56494db Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:19:37 -0500 Subject: [PATCH 01/15] Rename event_handler -> eventHandler. Function & Mocks --- .../__mocks__/{test_event_handler.js => testEventHandler.js} | 0 packages/jest-circus/src/__mocks__/test_utils.js | 2 +- .../jest-circus/src/{event_handler.js => eventHandler.js} | 4 ++-- packages/jest-circus/src/state.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename packages/jest-circus/src/__mocks__/{test_event_handler.js => testEventHandler.js} (100%) rename packages/jest-circus/src/{event_handler.js => eventHandler.js} (98%) diff --git a/packages/jest-circus/src/__mocks__/test_event_handler.js b/packages/jest-circus/src/__mocks__/testEventHandler.js similarity index 100% rename from packages/jest-circus/src/__mocks__/test_event_handler.js rename to packages/jest-circus/src/__mocks__/testEventHandler.js diff --git a/packages/jest-circus/src/__mocks__/test_utils.js b/packages/jest-circus/src/__mocks__/test_utils.js index 39594b009a2b..4e3ca543dccb 100644 --- a/packages/jest-circus/src/__mocks__/test_utils.js +++ b/packages/jest-circus/src/__mocks__/test_utils.js @@ -20,7 +20,7 @@ import {skipSuiteOnWindows} from '../../../../scripts/ConditionalTest'; const CIRCUS_PATH = require.resolve('../../build/index'); const CIRCUS_RUN_PATH = require.resolve('../../build/run'); const CIRCUS_STATE_PATH = require.resolve('../../build/state'); -const TEST_EVENT_HANDLER_PATH = require.resolve('./test_event_handler'); +const TEST_EVENT_HANDLER_PATH = require.resolve('./testEventHandler'); const BABEL_REGISTER_PATH = require.resolve('babel-register'); skipSuiteOnWindows(); diff --git a/packages/jest-circus/src/event_handler.js b/packages/jest-circus/src/eventHandler.js similarity index 98% rename from packages/jest-circus/src/event_handler.js rename to packages/jest-circus/src/eventHandler.js index fb5af141b802..9cec2209ea19 100644 --- a/packages/jest-circus/src/event_handler.js +++ b/packages/jest-circus/src/eventHandler.js @@ -25,7 +25,7 @@ import { // To pass this value from Runtime object to state we need to use global[sym] const TEST_TIMEOUT_SYMBOL = Symbol.for('TEST_TIMEOUT_SYMBOL'); -const handler: EventHandler = (event, state): void => { +const eventHandler: EventHandler = (event, state): void => { switch (event.name) { case 'include_test_location_in_result': { state.includeTestLocationInResult = true; @@ -183,4 +183,4 @@ const handler: EventHandler = (event, state): void => { } }; -export default handler; +export default eventHandler; diff --git a/packages/jest-circus/src/state.js b/packages/jest-circus/src/state.js index 3187775bcc2f..c1fd95984a7e 100644 --- a/packages/jest-circus/src/state.js +++ b/packages/jest-circus/src/state.js @@ -10,7 +10,7 @@ import type {Event, State, EventHandler} from 'types/Circus'; import {makeDescribe} from './utils'; -import eventHandler from './event_handler'; +import eventHandler from './eventHandler'; import formatNodeAssertErrors from './format_node_assert_errors'; const eventHandlers: Array = [ From 8d46d283a56b5fa789c5000fa1a60935b6560758 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:23:22 -0500 Subject: [PATCH 02/15] Rename error_handlers -> globalErrorHandlers. File & imports --- packages/jest-circus/src/eventHandler.js | 2 +- .../src/{error_handlers.js => globalErrorHandlers.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/jest-circus/src/{error_handlers.js => globalErrorHandlers.js} (100%) diff --git a/packages/jest-circus/src/eventHandler.js b/packages/jest-circus/src/eventHandler.js index 9cec2209ea19..893e61f61410 100644 --- a/packages/jest-circus/src/eventHandler.js +++ b/packages/jest-circus/src/eventHandler.js @@ -20,7 +20,7 @@ import { import { injectGlobalErrorHandlers, restoreGlobalErrorHandlers, -} from './error_handlers'; +} from './globalErrorHandlers'; // To pass this value from Runtime object to state we need to use global[sym] const TEST_TIMEOUT_SYMBOL = Symbol.for('TEST_TIMEOUT_SYMBOL'); diff --git a/packages/jest-circus/src/error_handlers.js b/packages/jest-circus/src/globalErrorHandlers.js similarity index 100% rename from packages/jest-circus/src/error_handlers.js rename to packages/jest-circus/src/globalErrorHandlers.js From cc217c2010e65c63b9506891077305ef7c5b52c4 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:34:11 -0500 Subject: [PATCH 03/15] Rename format_node_assert_errors -> formatNodeAssertErrors - File, Function & Imports renamed - `export default (...` changed to `const formatNodeAssertErrors = (...` with `export default formatNodeAssertErrors` at end of file --- ...format_node_assert_errors.js => formatNodeAssertErrors.js} | 4 +++- packages/jest-circus/src/state.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) rename packages/jest-circus/src/{format_node_assert_errors.js => formatNodeAssertErrors.js} (97%) diff --git a/packages/jest-circus/src/format_node_assert_errors.js b/packages/jest-circus/src/formatNodeAssertErrors.js similarity index 97% rename from packages/jest-circus/src/format_node_assert_errors.js rename to packages/jest-circus/src/formatNodeAssertErrors.js index 9151fa9fe3fa..d6080ce0b168 100644 --- a/packages/jest-circus/src/format_node_assert_errors.js +++ b/packages/jest-circus/src/formatNodeAssertErrors.js @@ -43,7 +43,7 @@ const humanReadableOperators = { strictEqual: 'to strictly be equal', }; -export default (event: Event, state: State) => { +const formatNodeAssertErrors = (event: Event, state: State) => { switch (event.name) { case 'test_done': { event.test.errors = event.test.errors.map(errors => { @@ -167,3 +167,5 @@ function assertionErrorMessage(error: AssertionError, options: DiffOptions) { trimmedStack ); } + +export default formatNodeAssertErrors; diff --git a/packages/jest-circus/src/state.js b/packages/jest-circus/src/state.js index c1fd95984a7e..36d4fa69cf04 100644 --- a/packages/jest-circus/src/state.js +++ b/packages/jest-circus/src/state.js @@ -11,7 +11,7 @@ import type {Event, State, EventHandler} from 'types/Circus'; import {makeDescribe} from './utils'; import eventHandler from './eventHandler'; -import formatNodeAssertErrors from './format_node_assert_errors'; +import formatNodeAssertErrors from './formatNodeAssertErrors'; const eventHandlers: Array = [ eventHandler, From ad5215dab13398bc928375d9c90dd8a33642ae12 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:40:22 -0500 Subject: [PATCH 04/15] Rename test_utils & runTest -> testUtils - Rename file, function, imports, mocks, & tests --- .../src/__mocks__/{test_utils.js => testUtils.js} | 2 +- packages/jest-circus/src/__tests__/after_all.test.js | 8 ++++---- packages/jest-circus/src/__tests__/base_test.test.js | 6 +++--- packages/jest-circus/src/__tests__/hooks.test.js | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) rename packages/jest-circus/src/__mocks__/{test_utils.js => testUtils.js} (98%) diff --git a/packages/jest-circus/src/__mocks__/test_utils.js b/packages/jest-circus/src/__mocks__/testUtils.js similarity index 98% rename from packages/jest-circus/src/__mocks__/test_utils.js rename to packages/jest-circus/src/__mocks__/testUtils.js index 4e3ca543dccb..88c514dba723 100644 --- a/packages/jest-circus/src/__mocks__/test_utils.js +++ b/packages/jest-circus/src/__mocks__/testUtils.js @@ -25,7 +25,7 @@ const BABEL_REGISTER_PATH = require.resolve('babel-register'); skipSuiteOnWindows(); -export const runTest = (source: string) => { +export const testUtils = (source: string) => { const filename = crypto .createHash('md5') .update(source) diff --git a/packages/jest-circus/src/__tests__/after_all.test.js b/packages/jest-circus/src/__tests__/after_all.test.js index 22e424d96f20..4af0465de857 100644 --- a/packages/jest-circus/src/__tests__/after_all.test.js +++ b/packages/jest-circus/src/__tests__/after_all.test.js @@ -10,10 +10,10 @@ 'use strict'; -import {runTest} from '../__mocks__/test_utils'; +import {testUtils} from '../__mocks__/testUtils'; test('tests are not marked done until their parent afterAll runs', () => { - const {stdout} = runTest(` + const {stdout} = testUtils(` describe('describe', () => { afterAll(() => {}); test('one', () => {}); @@ -39,7 +39,7 @@ test('tests are not marked done until their parent afterAll runs', () => { }); test('describe block cannot have hooks and no tests', () => { - const result = runTest(` + const result = testUtils(` describe('describe', () => { afterEach(() => {}); beforeEach(() => {}); @@ -52,7 +52,7 @@ test('describe block cannot have hooks and no tests', () => { }); test('describe block _can_ have hooks if a child describe block has tests', () => { - const result = runTest(` + const result = testUtils(` describe('describe', () => { afterEach(() => console.log('> afterEach')); beforeEach(() => console.log('> beforeEach')); diff --git a/packages/jest-circus/src/__tests__/base_test.test.js b/packages/jest-circus/src/__tests__/base_test.test.js index ec83663ba8db..98dc4d6a53bf 100644 --- a/packages/jest-circus/src/__tests__/base_test.test.js +++ b/packages/jest-circus/src/__tests__/base_test.test.js @@ -10,10 +10,10 @@ 'use strict'; -import {runTest} from '../__mocks__/test_utils'; +import {testUtils} from '../__mocks__/testUtils'; test('simple test', () => { - const {stdout} = runTest(` + const {stdout} = testUtils(` describe('describe', () => { beforeEach(() => {}); afterEach(() => {}); @@ -26,7 +26,7 @@ test('simple test', () => { }); test('failures', () => { - const {stdout} = runTest(` + const {stdout} = testUtils(` describe('describe', () => { beforeEach(() => {}); afterEach(() => { throw new Error('banana')}); diff --git a/packages/jest-circus/src/__tests__/hooks.test.js b/packages/jest-circus/src/__tests__/hooks.test.js index 2486cc3d6e62..da591fb0f22d 100644 --- a/packages/jest-circus/src/__tests__/hooks.test.js +++ b/packages/jest-circus/src/__tests__/hooks.test.js @@ -10,10 +10,10 @@ 'use strict'; -import {runTest} from '../__mocks__/test_utils'; +import {testUtils} from '../__mocks__/testUtils'; test('beforeEach is executed before each test in current/child describe blocks', () => { - const {stdout} = runTest(` + const {stdout} = testUtils(` describe('describe', () => { beforeEach(() => console.log('> describe beforeEach')); test('one', () => {}); @@ -42,7 +42,7 @@ test('beforeEach is executed before each test in current/child describe blocks', }); test('multiple before each hooks in one describe are executed in the right order', () => { - const {stdout} = runTest(` + const {stdout} = testUtils(` describe('describe 1', () => { beforeEach(() => { console.log('before each 1'); @@ -61,7 +61,7 @@ test('multiple before each hooks in one describe are executed in the right order }); test('beforeAll is exectued correctly', () => { - const {stdout} = runTest(` + const {stdout} = testUtils(` describe('describe 1', () => { beforeAll(() => console.log('> beforeAll 1')); test('test 1', () => console.log('> test 1')); From f9bdfa411f25432f038cc75e4b1a05cea5aad0d6 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:42:32 -0500 Subject: [PATCH 05/15] Rename after_all.test.js -> afterAll.test.js - Rename file only --- .../src/__tests__/{after_all.test.js => afterAll.test.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/jest-circus/src/__tests__/{after_all.test.js => afterAll.test.js} (100%) diff --git a/packages/jest-circus/src/__tests__/after_all.test.js b/packages/jest-circus/src/__tests__/afterAll.test.js similarity index 100% rename from packages/jest-circus/src/__tests__/after_all.test.js rename to packages/jest-circus/src/__tests__/afterAll.test.js From ac45b24349ba5c353bcb345434c05cb226d6e1b3 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:47:39 -0500 Subject: [PATCH 06/15] Rename after_all.test.js.snap -> afterAll.test.js.snap - Forgot snapshot when renaming afterAll.test.js - Rename snapshot to match test filename --- .../{after_all.test.js.snap => afterAll.test.js.snap} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/jest-circus/src/__tests__/__snapshots__/{after_all.test.js.snap => afterAll.test.js.snap} (100%) diff --git a/packages/jest-circus/src/__tests__/__snapshots__/after_all.test.js.snap b/packages/jest-circus/src/__tests__/__snapshots__/afterAll.test.js.snap similarity index 100% rename from packages/jest-circus/src/__tests__/__snapshots__/after_all.test.js.snap rename to packages/jest-circus/src/__tests__/__snapshots__/afterAll.test.js.snap From f29df331d1b21ee9dedce4b1a6ac2ef062e306a8 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:49:10 -0500 Subject: [PATCH 07/15] Rename base_test.test.js -> baseTest.test.js - Rename file & snap --- .../{base_test.test.js.snap => baseTest.test.js.snap} | 0 .../src/__tests__/{base_test.test.js => baseTest.test.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename packages/jest-circus/src/__tests__/__snapshots__/{base_test.test.js.snap => baseTest.test.js.snap} (100%) rename packages/jest-circus/src/__tests__/{base_test.test.js => baseTest.test.js} (100%) diff --git a/packages/jest-circus/src/__tests__/__snapshots__/base_test.test.js.snap b/packages/jest-circus/src/__tests__/__snapshots__/baseTest.test.js.snap similarity index 100% rename from packages/jest-circus/src/__tests__/__snapshots__/base_test.test.js.snap rename to packages/jest-circus/src/__tests__/__snapshots__/baseTest.test.js.snap diff --git a/packages/jest-circus/src/__tests__/base_test.test.js b/packages/jest-circus/src/__tests__/baseTest.test.js similarity index 100% rename from packages/jest-circus/src/__tests__/base_test.test.js rename to packages/jest-circus/src/__tests__/baseTest.test.js From 0ca16cd88645f5ec91b55501e6a70fa7c1f6cc2a Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:50:48 -0500 Subject: [PATCH 08/15] Rename circus_it_test_error.test.js -> circusItTestError.test.js --- .../{circus_it_test_error.test.js => circusItTestError.test.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/jest-circus/src/__tests__/{circus_it_test_error.test.js => circusItTestError.test.js} (100%) diff --git a/packages/jest-circus/src/__tests__/circus_it_test_error.test.js b/packages/jest-circus/src/__tests__/circusItTestError.test.js similarity index 100% rename from packages/jest-circus/src/__tests__/circus_it_test_error.test.js rename to packages/jest-circus/src/__tests__/circusItTestError.test.js From 0fd8f8ae74ed8bb2ad4f4239ace9c726a69a22fc Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:53:45 -0500 Subject: [PATCH 09/15] Rename circus_todo_test_error.test.js -> CircusItTodoTestError.test.js - Added "it" to name to match CircusItTestError.test.js - Rename file --- ...rcus_todo_test_error.test.js => circusItTodoTestError.test.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/jest-circus/src/__tests__/{circus_todo_test_error.test.js => circusItTodoTestError.test.js} (100%) diff --git a/packages/jest-circus/src/__tests__/circus_todo_test_error.test.js b/packages/jest-circus/src/__tests__/circusItTodoTestError.test.js similarity index 100% rename from packages/jest-circus/src/__tests__/circus_todo_test_error.test.js rename to packages/jest-circus/src/__tests__/circusItTodoTestError.test.js From 58adc99e5f9d31a30c22680358970241ac22e284 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 11:54:42 -0500 Subject: [PATCH 10/15] Rename hooks_error.test.js -> hooksError.test.js - Rename file --- .../src/__tests__/{hooks_error.test.js => hooksError.test.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/jest-circus/src/__tests__/{hooks_error.test.js => hooksError.test.js} (100%) diff --git a/packages/jest-circus/src/__tests__/hooks_error.test.js b/packages/jest-circus/src/__tests__/hooksError.test.js similarity index 100% rename from packages/jest-circus/src/__tests__/hooks_error.test.js rename to packages/jest-circus/src/__tests__/hooksError.test.js From e823460e075e8207fc216a88ce0f44a2018d6e50 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 13:47:16 -0500 Subject: [PATCH 11/15] Rename legacy_code_todo_rewrite -> legacy-code-todo-rewrite - Directory names should use dashes --- .../jest_adapter.js | 0 .../jest_adapter_init.js | 0 .../jest_expect.js | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename packages/jest-circus/src/{legacy_code_todo_rewrite => legacy-code-todo-rewrite}/jest_adapter.js (100%) rename packages/jest-circus/src/{legacy_code_todo_rewrite => legacy-code-todo-rewrite}/jest_adapter_init.js (100%) rename packages/jest-circus/src/{legacy_code_todo_rewrite => legacy-code-todo-rewrite}/jest_expect.js (100%) diff --git a/packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter.js b/packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter.js similarity index 100% rename from packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter.js rename to packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter.js diff --git a/packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter_init.js b/packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter_init.js similarity index 100% rename from packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter_init.js rename to packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter_init.js diff --git a/packages/jest-circus/src/legacy_code_todo_rewrite/jest_expect.js b/packages/jest-circus/src/legacy-code-todo-rewrite/jest_expect.js similarity index 100% rename from packages/jest-circus/src/legacy_code_todo_rewrite/jest_expect.js rename to packages/jest-circus/src/legacy-code-todo-rewrite/jest_expect.js From 5e4e1cba62cdf5a47a3aff0709c6b14e42786c4f Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 13:58:27 -0500 Subject: [PATCH 12/15] Add CHANGELOG.md entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fef44a6a3939..ea58e37bbcab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ ### Chore & Maintenance +- `[jest-circus]` Standardize file naming in `jest-circus` ([#7301](https://github.com/facebook/jest/pull/7301)) - `[docs]` Add synchronous test.each setup ([#7150](https://github.com/facebook/jest/pull/7150)) - `[docs]` Add `this.extend` to the Custom Matchers API reference ([#7130](https://github.com/facebook/jest/pull/7130)) - `[docs]` Fix default value for `coverageReporters` value in configuration docs ([#7126](https://github.com/facebook/jest/pull/7126)) From 266150a2f324f93eff2be78487906fa17a6872d5 Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 14:01:47 -0500 Subject: [PATCH 13/15] Fix broken link to legacy-code-todo-rewrite/ in jest-circus/runner.js --- packages/jest-circus/runner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jest-circus/runner.js b/packages/jest-circus/runner.js index 214956a9f42a..7a4f106fae68 100644 --- a/packages/jest-circus/runner.js +++ b/packages/jest-circus/runner.js @@ -9,5 +9,5 @@ */ // Allow people to use `jest-circus/runner` as a runner. -const runner = require('./build/legacy_code_todo_rewrite/jest_adapter'); +const runner = require('./build/legacy-code-todo-rewrite/jest_adapter'); module.exports = runner; From 59b6356d45c4df5e061ceea6d2f708375e48b2bb Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 16:45:46 -0500 Subject: [PATCH 14/15] Revert export in testUtils.js to runTest per @thymikee's request --- packages/jest-circus/src/__mocks__/testUtils.js | 2 +- packages/jest-circus/src/__tests__/afterAll.test.js | 8 ++++---- packages/jest-circus/src/__tests__/baseTest.test.js | 6 +++--- packages/jest-circus/src/__tests__/hooks.test.js | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/jest-circus/src/__mocks__/testUtils.js b/packages/jest-circus/src/__mocks__/testUtils.js index 88c514dba723..4e3ca543dccb 100644 --- a/packages/jest-circus/src/__mocks__/testUtils.js +++ b/packages/jest-circus/src/__mocks__/testUtils.js @@ -25,7 +25,7 @@ const BABEL_REGISTER_PATH = require.resolve('babel-register'); skipSuiteOnWindows(); -export const testUtils = (source: string) => { +export const runTest = (source: string) => { const filename = crypto .createHash('md5') .update(source) diff --git a/packages/jest-circus/src/__tests__/afterAll.test.js b/packages/jest-circus/src/__tests__/afterAll.test.js index 4af0465de857..7cccc1f66d49 100644 --- a/packages/jest-circus/src/__tests__/afterAll.test.js +++ b/packages/jest-circus/src/__tests__/afterAll.test.js @@ -10,10 +10,10 @@ 'use strict'; -import {testUtils} from '../__mocks__/testUtils'; +import {runTest} from '../__mocks__/testUtils'; test('tests are not marked done until their parent afterAll runs', () => { - const {stdout} = testUtils(` + const {stdout} = runTest(` describe('describe', () => { afterAll(() => {}); test('one', () => {}); @@ -39,7 +39,7 @@ test('tests are not marked done until their parent afterAll runs', () => { }); test('describe block cannot have hooks and no tests', () => { - const result = testUtils(` + const result = runTest(` describe('describe', () => { afterEach(() => {}); beforeEach(() => {}); @@ -52,7 +52,7 @@ test('describe block cannot have hooks and no tests', () => { }); test('describe block _can_ have hooks if a child describe block has tests', () => { - const result = testUtils(` + const result = runTest(` describe('describe', () => { afterEach(() => console.log('> afterEach')); beforeEach(() => console.log('> beforeEach')); diff --git a/packages/jest-circus/src/__tests__/baseTest.test.js b/packages/jest-circus/src/__tests__/baseTest.test.js index 98dc4d6a53bf..1cc1c2abab94 100644 --- a/packages/jest-circus/src/__tests__/baseTest.test.js +++ b/packages/jest-circus/src/__tests__/baseTest.test.js @@ -10,10 +10,10 @@ 'use strict'; -import {testUtils} from '../__mocks__/testUtils'; +import {runTest} from '../__mocks__/testUtils'; test('simple test', () => { - const {stdout} = testUtils(` + const {stdout} = runTest(` describe('describe', () => { beforeEach(() => {}); afterEach(() => {}); @@ -26,7 +26,7 @@ test('simple test', () => { }); test('failures', () => { - const {stdout} = testUtils(` + const {stdout} = runTest(` describe('describe', () => { beforeEach(() => {}); afterEach(() => { throw new Error('banana')}); diff --git a/packages/jest-circus/src/__tests__/hooks.test.js b/packages/jest-circus/src/__tests__/hooks.test.js index da591fb0f22d..6d9b58bce341 100644 --- a/packages/jest-circus/src/__tests__/hooks.test.js +++ b/packages/jest-circus/src/__tests__/hooks.test.js @@ -10,10 +10,10 @@ 'use strict'; -import {testUtils} from '../__mocks__/testUtils'; +import {runTest} from '../__mocks__/testUtils'; test('beforeEach is executed before each test in current/child describe blocks', () => { - const {stdout} = testUtils(` + const {stdout} = runTest(` describe('describe', () => { beforeEach(() => console.log('> describe beforeEach')); test('one', () => {}); @@ -42,7 +42,7 @@ test('beforeEach is executed before each test in current/child describe blocks', }); test('multiple before each hooks in one describe are executed in the right order', () => { - const {stdout} = testUtils(` + const {stdout} = runTest(` describe('describe 1', () => { beforeEach(() => { console.log('before each 1'); @@ -61,7 +61,7 @@ test('multiple before each hooks in one describe are executed in the right order }); test('beforeAll is exectued correctly', () => { - const {stdout} = testUtils(` + const {stdout} = runTest(` describe('describe 1', () => { beforeAll(() => console.log('> beforeAll 1')); test('test 1', () => console.log('> test 1')); From c826900100dace8741dc48e4a01566748ed29fdb Mon Sep 17 00:00:00 2001 From: Andrew Pyle Date: Tue, 30 Oct 2018 17:13:42 -0500 Subject: [PATCH 15/15] Rename files in legacy-code-todo-rewrite/ - jest_adapter.js -> jestAdapter.js - jest_adapter_init.js -> jestAdapterInit.js - jest_expect.js -> jestExpect.js - Fixed imports within directory and in runner.js --- packages/jest-circus/runner.js | 2 +- .../{jest_adapter.js => jestAdapter.js} | 4 ++-- .../{jest_adapter_init.js => jestAdapterInit.js} | 0 .../{jest_expect.js => jestExpect.js} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename packages/jest-circus/src/legacy-code-todo-rewrite/{jest_adapter.js => jestAdapter.js} (95%) rename packages/jest-circus/src/legacy-code-todo-rewrite/{jest_adapter_init.js => jestAdapterInit.js} (100%) rename packages/jest-circus/src/legacy-code-todo-rewrite/{jest_expect.js => jestExpect.js} (100%) diff --git a/packages/jest-circus/runner.js b/packages/jest-circus/runner.js index 7a4f106fae68..8ed8163ee414 100644 --- a/packages/jest-circus/runner.js +++ b/packages/jest-circus/runner.js @@ -9,5 +9,5 @@ */ // Allow people to use `jest-circus/runner` as a runner. -const runner = require('./build/legacy-code-todo-rewrite/jest_adapter'); +const runner = require('./build/legacy-code-todo-rewrite/jestAdapter'); module.exports = runner; diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter.js b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.js similarity index 95% rename from packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter.js rename to packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.js index bf2d87b9f4bd..af85e4d095b4 100644 --- a/packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter.js +++ b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapter.js @@ -12,7 +12,7 @@ import type {GlobalConfig, ProjectConfig} from 'types/Config'; import type {TestResult} from 'types/TestResult'; import type Runtime from 'jest-runtime'; -const FRAMEWORK_INITIALIZER = require.resolve('./jest_adapter_init'); +const FRAMEWORK_INITIALIZER = require.resolve('./jestAdapterInit'); import path from 'path'; const jestAdapter = async ( @@ -28,7 +28,7 @@ const jestAdapter = async ( } = runtime.requireInternalModule(FRAMEWORK_INITIALIZER); runtime - .requireInternalModule(path.resolve(__dirname, './jest_expect.js')) + .requireInternalModule(path.resolve(__dirname, './jestExpect.js')) .default({ expand: globalConfig.expand, }); diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter_init.js b/packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.js similarity index 100% rename from packages/jest-circus/src/legacy-code-todo-rewrite/jest_adapter_init.js rename to packages/jest-circus/src/legacy-code-todo-rewrite/jestAdapterInit.js diff --git a/packages/jest-circus/src/legacy-code-todo-rewrite/jest_expect.js b/packages/jest-circus/src/legacy-code-todo-rewrite/jestExpect.js similarity index 100% rename from packages/jest-circus/src/legacy-code-todo-rewrite/jest_expect.js rename to packages/jest-circus/src/legacy-code-todo-rewrite/jestExpect.js