From 3add14666eda46eb565391a3729ab2a53cdac332 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 24 Jul 2019 11:44:56 +0200 Subject: [PATCH 01/34] chore: rely on browser field for browser tests (#8742) --- e2e/browser-support/browserTest.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/browser-support/browserTest.js b/e2e/browser-support/browserTest.js index 54dcf5577d33..2fbeae3d08c0 100644 --- a/e2e/browser-support/browserTest.js +++ b/e2e/browser-support/browserTest.js @@ -6,9 +6,9 @@ */ /* eslint-disable */ -var expect = require('../../packages/expect/build-es5/index.js'); -var mock = require('../../packages/jest-mock/build-es5/index.js'); -var prettyFormat = require('../../packages/pretty-format/build-es5/index.js'); +var expect = require('expect'); +var mock = require('jest-mock'); +var prettyFormat = require('pretty-format'); describe('es5 builds in browser', function() { it('runs assertions', function() { From a1e30075ca60fb720ae1ba9a66ba1e4837c67428 Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Wed, 24 Jul 2019 09:25:59 -0400 Subject: [PATCH 02/34] expect: Improve report when mock-spy matcher fails, part 4 (#8710) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * expect: Improve report when mock-spy matcher fails, part 4 * Update CHANGELOG.md * Update code and snapshots after review by MichaƂ * Replace label with Number of returns/calls * Add function call as explicit subject * Delete value from Expected and Received labels * Update snapshots --- CHANGELOG.md | 1 + .../__snapshots__/spyMatchers.test.js.snap | 1074 +++++++++-------- packages/expect/src/spyMatchers.ts | 439 ++++--- 3 files changed, 875 insertions(+), 639 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d13a1c27a04..aa34e1685ea9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - `[expect]` Improve report when mock-spy matcher fails, part 1 ([#8640](https://github.com/facebook/jest/pull/8640)) - `[expect]` Improve report when mock-spy matcher fails, part 2 ([#8649](https://github.com/facebook/jest/pull/8649)) - `[expect]` Improve report when mock-spy matcher fails, part 3 ([#8697](https://github.com/facebook/jest/pull/8697)) +- `[expect]` Improve report when mock-spy matcher fails, part 4 ([#8710](https://github.com/facebook/jest/pull/8710)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) - `[*]` Manage the global timeout with `--testTimeout` command line argument. ([#8456](https://github.com/facebook/jest/pull/8456)) diff --git a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap index 8b42aa51913b..bf6a4cf1042d 100644 --- a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap @@ -127,44 +127,54 @@ Expected mock function to have been last called with: `; exports[`lastReturnedWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).lastReturnedWith(expected) +"expect(jest.fn()).lastReturnedWith(expected) -Expected mock function to have last returned: - undefined -But the last call threw an error" +Expected: undefined +Received: function call threw an error + +Number of returns: 0 +Number of calls: 1" `; exports[`lastReturnedWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).lastReturnedWith(expected) +"expect(jest.fn()).lastReturnedWith(expected) + +Expected: undefined +Received: function call threw an error -Expected mock function to have last returned: - undefined -But the last call threw an error" +Number of returns: 0 +Number of calls: 1" `; exports[`lastReturnedWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).lastReturnedWith(expected) +"expect(named-mock).lastReturnedWith(expected) -Expected mock function \\"named-mock\\" to have last returned: - \\"foo\\" -But it was not called" +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`lastReturnedWith lastReturnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).lastReturnedWith(expected) +"expect(jest.fn()).lastReturnedWith(expected) + +Expected: 0 +Received + 3: function call has not returned yet +-> 4: function call has not returned yet -Expected mock function to have last returned: - 0 -But the last call has not returned yet" +Number of returns: 0 +Number of calls: 4" `; exports[`lastReturnedWith lastReturnedWith works with three calls 1`] = ` -"expect(jest.fn()).not.lastReturnedWith(expected) +"expect(jest.fn()).not.lastReturnedWith(expected) -Expected mock function to not have last returned: - \\"foo3\\" -But it last returned exactly: - \\"foo3\\"" +Expected: not \\"foo3\\" +Received + 2: \\"foo2\\" +-> 3: \\"foo3\\" + +Number of returns: 3" `; exports[`lastReturnedWith works only on spies or jest.fn 1`] = ` @@ -177,92 +187,86 @@ Received has value: [Function fn]" `; exports[`lastReturnedWith works when not called 1`] = ` -"expect(jest.fn()).lastReturnedWith(expected) +"expect(jest.fn()).lastReturnedWith(expected) -Expected mock function to have last returned: - \\"foo\\" -But it was not called" +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`lastReturnedWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.lastReturnedWith(expected) +"expect(jest.fn()).not.lastReturnedWith(expected) -Expected mock function to not have last returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it last returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} + +Number of returns: 1" `; exports[`lastReturnedWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.lastReturnedWith(expected) +"expect(jest.fn()).not.lastReturnedWith(expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function to not have last returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it last returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`lastReturnedWith works with Map 1`] = ` -"expect(jest.fn()).not.lastReturnedWith(expected) +"expect(jest.fn()).not.lastReturnedWith(expected) -Expected mock function to not have last returned: - Map {1 => 2, 2 => 1} -But it last returned exactly: - Map {1 => 2, 2 => 1}" +Expected: not Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`lastReturnedWith works with Map 2`] = ` -"expect(jest.fn()).lastReturnedWith(expected) +"expect(jest.fn()).lastReturnedWith(expected) -Expected mock function to have last returned: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -But the last call returned: - Map {1 => 2, 2 => 1}" +Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} +Received: Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`lastReturnedWith works with Set 1`] = ` -"expect(jest.fn()).not.lastReturnedWith(expected) +"expect(jest.fn()).not.lastReturnedWith(expected) -Expected mock function to not have last returned: - Set {1, 2} -But it last returned exactly: - Set {1, 2}" +Expected: not Set {1, 2} + +Number of returns: 1" `; exports[`lastReturnedWith works with Set 2`] = ` -"expect(jest.fn()).lastReturnedWith(expected) +"expect(jest.fn()).lastReturnedWith(expected) -Expected mock function to have last returned: - Set {3, 4} -But the last call returned: - Set {1, 2}" +Expected: Set {3, 4} +Received: Set {1, 2} + +Number of returns: 1" `; exports[`lastReturnedWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.lastReturnedWith(expected) +"expect(jest.fn()).not.lastReturnedWith(expected) -Expected mock function to not have last returned: - \\"foo\\" -But it last returned exactly: - \\"foo\\"" +Expected: not \\"foo\\" + +Number of returns: 1" `; exports[`lastReturnedWith works with argument that does not match 1`] = ` -"expect(jest.fn()).lastReturnedWith(expected) +"expect(jest.fn()).lastReturnedWith(expected) -Expected mock function to have last returned: - \\"bar\\" -But the last call returned: - \\"foo\\"" +Expected: \\"bar\\" +Received: \\"foo\\" + +Number of returns: 1" `; exports[`lastReturnedWith works with undefined 1`] = ` -"expect(jest.fn()).not.lastReturnedWith(expected) +"expect(jest.fn()).not.lastReturnedWith(expected) + +Expected: not undefined -Expected mock function to not have last returned: - undefined -But it last returned exactly: - undefined" +Number of returns: 1" `; exports[`nthCalledWith includes the custom mock name in the error message 1`] = ` @@ -426,61 +430,88 @@ Expected mock function first call to have been called with: `; exports[`nthReturnedWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) + +n: 1 +Expected: undefined +Received: function call threw an error -Expected mock function first call to have returned with: - undefined -But the first call threw an error" +Number of returns: 0 +Number of calls: 1" `; exports[`nthReturnedWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function first call to have returned with: - undefined -But the first call threw an error" +n: 1 +Expected: undefined +Received: function call threw an error + +Number of returns: 0 +Number of calls: 1" `; exports[`nthReturnedWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).nthReturnedWith(expected) +"expect(named-mock).nthReturnedWith(n, expected) -Expected mock function \\"named-mock\\" first call to have returned with: - \\"foo\\" -But it was not called" +n: 1 +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) + +n: 1 +Expected: 6 +Received +-> 1: function call has not returned yet + 2: function call has not returned yet -Expected mock function first call to have returned with: - 6 -But the first call has not returned yet" +Number of returns: 2 +Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 2`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function second call to have returned with: - 3 -But the second call has not returned yet" +n: 2 +Expected: 3 +Received + 1: function call has not returned yet +-> 2: function call has not returned yet + 3: 1 + +Number of returns: 2 +Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 3`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) + +n: 3 +Expected: not 1 +Received + 2: function call has not returned yet +-> 3: 1 + 4: 0 -Expected mock function third call to not have returned with: - 1 -But the third call returned exactly: - 1" +Number of returns: 2 +Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 4`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) -Expected mock function 4th call to not have returned with: - 0 -But the 4th call returned exactly: - 0" +n: 4 +Expected: not 0 +Received + 3: 1 +-> 4: 0 + +Number of returns: 2 +Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith negative throw matcher error for n that is not number 1`] = ` @@ -510,38 +541,50 @@ n has value: 0" `; exports[`nthReturnedWith nthReturnedWith should reject nth value greater than number of calls 1`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function 4th call to have returned with: - \\"foo\\" -But it was only called 3 times" +n: 4 +Expected: \\"foo\\" +Received + 3: \\"foo\\" + +Number of returns: 3" `; exports[`nthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 1`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function first call to have returned with: - \\"bar1\\" -But the first call returned with: - \\"foo1\\"" +n: 1 +Expected: \\"bar1\\" +Received +-> 1: \\"foo1\\" + 2: \\"foo2\\" + +Number of returns: 3" `; exports[`nthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 2`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) + +n: 1 +Expected: not \\"foo1\\" +Received +-> 1: \\"foo1\\" + 2: \\"foo2\\" -Expected mock function first call to not have returned with: - \\"foo1\\" -But the first call returned exactly: - \\"foo1\\"" +Number of returns: 3" `; exports[`nthReturnedWith nthReturnedWith works with three calls 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) -Expected mock function first call to not have returned with: - \\"foo1\\" -But the first call returned exactly: - \\"foo1\\"" +n: 1 +Expected: not \\"foo1\\" +Received +-> 1: \\"foo1\\" + 2: \\"foo2\\" + +Number of returns: 3" `; exports[`nthReturnedWith works only on spies or jest.fn 1`] = ` @@ -554,92 +597,96 @@ Received has value: [Function fn]" `; exports[`nthReturnedWith works when not called 1`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function first call to have returned with: - \\"foo\\" -But it was not called" +n: 1 +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`nthReturnedWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) + +n: 1 +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function first call to not have returned with: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But the first call returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`nthReturnedWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) -Expected mock function first call to not have returned with: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But the first call returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +n: 1 +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} + +Number of returns: 1" `; exports[`nthReturnedWith works with Map 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) + +n: 1 +Expected: not Map {1 => 2, 2 => 1} -Expected mock function first call to not have returned with: - Map {1 => 2, 2 => 1} -But the first call returned exactly: - Map {1 => 2, 2 => 1}" +Number of returns: 1" `; exports[`nthReturnedWith works with Map 2`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function first call to have returned with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -But the first call returned with: - Map {1 => 2, 2 => 1}" +n: 1 +Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} +Received: Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`nthReturnedWith works with Set 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) + +n: 1 +Expected: not Set {1, 2} -Expected mock function first call to not have returned with: - Set {1, 2} -But the first call returned exactly: - Set {1, 2}" +Number of returns: 1" `; exports[`nthReturnedWith works with Set 2`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function first call to have returned with: - Set {3, 4} -But the first call returned with: - Set {1, 2}" +n: 1 +Expected: Set {3, 4} +Received: Set {1, 2} + +Number of returns: 1" `; exports[`nthReturnedWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) -Expected mock function first call to not have returned with: - \\"foo\\" -But the first call returned exactly: - \\"foo\\"" +n: 1 +Expected: not \\"foo\\" + +Number of returns: 1" `; exports[`nthReturnedWith works with argument that does not match 1`] = ` -"expect(jest.fn()).nthReturnedWith(expected) +"expect(jest.fn()).nthReturnedWith(n, expected) -Expected mock function first call to have returned with: - \\"bar\\" -But the first call returned with: - \\"foo\\"" +n: 1 +Expected: \\"bar\\" +Received: \\"foo\\" + +Number of returns: 1" `; exports[`nthReturnedWith works with undefined 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) + +n: 1 +Expected: not undefined -Expected mock function first call to not have returned with: - undefined -But the first call returned exactly: - undefined" +Number of returns: 1" `; exports[`toBeCalled .not fails with any argument passed 1`] = ` @@ -1589,44 +1636,54 @@ Expected mock function first call to have been called with: `; exports[`toHaveLastReturnedWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveLastReturnedWith(expected) +"expect(jest.fn()).toHaveLastReturnedWith(expected) + +Expected: undefined +Received: function call threw an error -Expected mock function to have last returned: - undefined -But the last call threw an error" +Number of returns: 0 +Number of calls: 1" `; exports[`toHaveLastReturnedWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveLastReturnedWith(expected) +"expect(jest.fn()).toHaveLastReturnedWith(expected) -Expected mock function to have last returned: - undefined -But the last call threw an error" +Expected: undefined +Received: function call threw an error + +Number of returns: 0 +Number of calls: 1" `; exports[`toHaveLastReturnedWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).toHaveLastReturnedWith(expected) +"expect(named-mock).toHaveLastReturnedWith(expected) -Expected mock function \\"named-mock\\" to have last returned: - \\"foo\\" -But it was not called" +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toHaveLastReturnedWith lastReturnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).toHaveLastReturnedWith(expected) +"expect(jest.fn()).toHaveLastReturnedWith(expected) + +Expected: 0 +Received + 3: function call has not returned yet +-> 4: function call has not returned yet -Expected mock function to have last returned: - 0 -But the last call has not returned yet" +Number of returns: 0 +Number of calls: 4" `; exports[`toHaveLastReturnedWith lastReturnedWith works with three calls 1`] = ` -"expect(jest.fn()).not.toHaveLastReturnedWith(expected) +"expect(jest.fn()).not.toHaveLastReturnedWith(expected) -Expected mock function to not have last returned: - \\"foo3\\" -But it last returned exactly: - \\"foo3\\"" +Expected: not \\"foo3\\" +Received + 2: \\"foo2\\" +-> 3: \\"foo3\\" + +Number of returns: 3" `; exports[`toHaveLastReturnedWith works only on spies or jest.fn 1`] = ` @@ -1639,150 +1696,171 @@ Received has value: [Function fn]" `; exports[`toHaveLastReturnedWith works when not called 1`] = ` -"expect(jest.fn()).toHaveLastReturnedWith(expected) +"expect(jest.fn()).toHaveLastReturnedWith(expected) -Expected mock function to have last returned: - \\"foo\\" -But it was not called" +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toHaveLastReturnedWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.toHaveLastReturnedWith(expected) +"expect(jest.fn()).not.toHaveLastReturnedWith(expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function to not have last returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it last returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.toHaveLastReturnedWith(expected) +"expect(jest.fn()).not.toHaveLastReturnedWith(expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function to not have last returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it last returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveLastReturnedWith(expected) +"expect(jest.fn()).not.toHaveLastReturnedWith(expected) -Expected mock function to not have last returned: - Map {1 => 2, 2 => 1} -But it last returned exactly: - Map {1 => 2, 2 => 1}" +Expected: not Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with Map 2`] = ` -"expect(jest.fn()).toHaveLastReturnedWith(expected) +"expect(jest.fn()).toHaveLastReturnedWith(expected) -Expected mock function to have last returned: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -But the last call returned: - Map {1 => 2, 2 => 1}" +Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} +Received: Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveLastReturnedWith(expected) +"expect(jest.fn()).not.toHaveLastReturnedWith(expected) + +Expected: not Set {1, 2} -Expected mock function to not have last returned: - Set {1, 2} -But it last returned exactly: - Set {1, 2}" +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with Set 2`] = ` -"expect(jest.fn()).toHaveLastReturnedWith(expected) +"expect(jest.fn()).toHaveLastReturnedWith(expected) -Expected mock function to have last returned: - Set {3, 4} -But the last call returned: - Set {1, 2}" +Expected: Set {3, 4} +Received: Set {1, 2} + +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.toHaveLastReturnedWith(expected) +"expect(jest.fn()).not.toHaveLastReturnedWith(expected) -Expected mock function to not have last returned: - \\"foo\\" -But it last returned exactly: - \\"foo\\"" +Expected: not \\"foo\\" + +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with argument that does not match 1`] = ` -"expect(jest.fn()).toHaveLastReturnedWith(expected) +"expect(jest.fn()).toHaveLastReturnedWith(expected) -Expected mock function to have last returned: - \\"bar\\" -But the last call returned: - \\"foo\\"" +Expected: \\"bar\\" +Received: \\"foo\\" + +Number of returns: 1" `; exports[`toHaveLastReturnedWith works with undefined 1`] = ` -"expect(jest.fn()).not.toHaveLastReturnedWith(expected) +"expect(jest.fn()).not.toHaveLastReturnedWith(expected) + +Expected: not undefined -Expected mock function to not have last returned: - undefined -But it last returned exactly: - undefined" +Number of returns: 1" `; exports[`toHaveNthReturnedWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) -Expected mock function first call to have returned with: - undefined -But the first call threw an error" +n: 1 +Expected: undefined +Received: function call threw an error + +Number of returns: 0 +Number of calls: 1" `; exports[`toHaveNthReturnedWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) + +n: 1 +Expected: undefined +Received: function call threw an error -Expected mock function first call to have returned with: - undefined -But the first call threw an error" +Number of returns: 0 +Number of calls: 1" `; exports[`toHaveNthReturnedWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).toHaveNthReturnedWith(expected) +"expect(named-mock).toHaveNthReturnedWith(n, expected) -Expected mock function \\"named-mock\\" first call to have returned with: - \\"foo\\" -But it was not called" +n: 1 +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) -Expected mock function first call to have returned with: - 6 -But the first call has not returned yet" +n: 1 +Expected: 6 +Received +-> 1: function call has not returned yet + 2: function call has not returned yet + +Number of returns: 2 +Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 2`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) + +n: 2 +Expected: 3 +Received + 1: function call has not returned yet +-> 2: function call has not returned yet + 3: 1 -Expected mock function second call to have returned with: - 3 -But the second call has not returned yet" +Number of returns: 2 +Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 3`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) + +n: 3 +Expected: not 1 +Received + 2: function call has not returned yet +-> 3: 1 + 4: 0 -Expected mock function third call to not have returned with: - 1 -But the third call returned exactly: - 1" +Number of returns: 2 +Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 4`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) -Expected mock function 4th call to not have returned with: - 0 -But the 4th call returned exactly: - 0" +n: 4 +Expected: not 0 +Received + 3: 1 +-> 4: 0 + +Number of returns: 2 +Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith negative throw matcher error for n that is not number 1`] = ` @@ -1812,38 +1890,50 @@ n has value: 0" `; exports[`toHaveNthReturnedWith nthReturnedWith should reject nth value greater than number of calls 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) -Expected mock function 4th call to have returned with: - \\"foo\\" -But it was only called 3 times" +n: 4 +Expected: \\"foo\\" +Received + 3: \\"foo\\" + +Number of returns: 3" `; exports[`toHaveNthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) + +n: 1 +Expected: \\"bar1\\" +Received +-> 1: \\"foo1\\" + 2: \\"foo2\\" -Expected mock function first call to have returned with: - \\"bar1\\" -But the first call returned with: - \\"foo1\\"" +Number of returns: 3" `; exports[`toHaveNthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 2`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) + +n: 1 +Expected: not \\"foo1\\" +Received +-> 1: \\"foo1\\" + 2: \\"foo2\\" -Expected mock function first call to not have returned with: - \\"foo1\\" -But the first call returned exactly: - \\"foo1\\"" +Number of returns: 3" `; exports[`toHaveNthReturnedWith nthReturnedWith works with three calls 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) -Expected mock function first call to not have returned with: - \\"foo1\\" -But the first call returned exactly: - \\"foo1\\"" +n: 1 +Expected: not \\"foo1\\" +Received +-> 1: \\"foo1\\" + 2: \\"foo2\\" + +Number of returns: 3" `; exports[`toHaveNthReturnedWith works only on spies or jest.fn 1`] = ` @@ -1856,92 +1946,96 @@ Received has value: [Function fn]" `; exports[`toHaveNthReturnedWith works when not called 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) -Expected mock function first call to have returned with: - \\"foo\\" -But it was not called" +n: 1 +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toHaveNthReturnedWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) + +n: 1 +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function first call to not have returned with: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But the first call returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) + +n: 1 +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function first call to not have returned with: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But the first call returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) -Expected mock function first call to not have returned with: - Map {1 => 2, 2 => 1} -But the first call returned exactly: - Map {1 => 2, 2 => 1}" +n: 1 +Expected: not Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Map 2`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) -Expected mock function first call to have returned with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -But the first call returned with: - Map {1 => 2, 2 => 1}" +n: 1 +Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} +Received: Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) + +n: 1 +Expected: not Set {1, 2} -Expected mock function first call to not have returned with: - Set {1, 2} -But the first call returned exactly: - Set {1, 2}" +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Set 2`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) -Expected mock function first call to have returned with: - Set {3, 4} -But the first call returned with: - Set {1, 2}" +n: 1 +Expected: Set {3, 4} +Received: Set {1, 2} + +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) -Expected mock function first call to not have returned with: - \\"foo\\" -But the first call returned exactly: - \\"foo\\"" +n: 1 +Expected: not \\"foo\\" + +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with argument that does not match 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) -Expected mock function first call to have returned with: - \\"bar\\" -But the first call returned with: - \\"foo\\"" +n: 1 +Expected: \\"bar\\" +Received: \\"foo\\" + +Number of returns: 1" `; exports[`toHaveNthReturnedWith works with undefined 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) + +n: 1 +Expected: not undefined -Expected mock function first call to not have returned with: - undefined -But the first call returned exactly: - undefined" +Number of returns: 1" `; exports[`toHaveReturned .not fails with any argument passed 1`] = ` @@ -2216,54 +2310,56 @@ Received has value: [Function fn]" `; exports[`toHaveReturnedWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) +"expect(jest.fn()).toHaveReturnedWith(expected) -Expected mock function to have returned: - undefined -But it did not return." +Expected: undefined +Received: function call threw an error + +Number of returns: 0 +Number of calls: 1" `; exports[`toHaveReturnedWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) +"expect(jest.fn()).toHaveReturnedWith(expected) + +Expected: undefined +Received: function call threw an error -Expected mock function to have returned: - undefined -But it did not return." +Number of returns: 0 +Number of calls: 1" `; exports[`toHaveReturnedWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).toHaveReturnedWith(expected) +"expect(named-mock).toHaveReturnedWith(expected) -Expected mock function \\"named-mock\\" to have returned: - \\"foo\\" -But it did not return." +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toHaveReturnedWith returnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) +"expect(jest.fn()).toHaveReturnedWith(expected) -Expected mock function to have returned: - undefined -But it did not return." +Expected: undefined +Received + 1: function call has not returned yet + 2: function call has not returned yet + 3: function call has not returned yet + +Number of returns: 0 +Number of calls: 4" `; exports[`toHaveReturnedWith returnedWith works with more calls than the limit 1`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) - -Expected mock function to have returned: - \\"bar\\" -But it returned: - \\"foo1\\" - - \\"foo2\\" - - \\"foo3\\" +"expect(jest.fn()).toHaveReturnedWith(expected) - \\"foo4\\" +Expected: \\"bar\\" +Received + 1: \\"foo1\\" + 2: \\"foo2\\" + 3: \\"foo3\\" - \\"foo5\\" - - ...and 1 more" +Number of returns: 6" `; exports[`toHaveReturnedWith works only on spies or jest.fn 1`] = ` @@ -2276,92 +2372,86 @@ Received has value: [Function fn]" `; exports[`toHaveReturnedWith works when not called 1`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) +"expect(jest.fn()).toHaveReturnedWith(expected) -Expected mock function to have returned: - \\"foo\\" -But it did not return." +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toHaveReturnedWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.toHaveReturnedWith(expected) +"expect(jest.fn()).not.toHaveReturnedWith(expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function not to have returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`toHaveReturnedWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.toHaveReturnedWith(expected) +"expect(jest.fn()).not.toHaveReturnedWith(expected) -Expected mock function not to have returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} + +Number of returns: 1" `; exports[`toHaveReturnedWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveReturnedWith(expected) +"expect(jest.fn()).not.toHaveReturnedWith(expected) + +Expected: not Map {1 => 2, 2 => 1} -Expected mock function not to have returned: - Map {1 => 2, 2 => 1} -But it returned exactly: - Map {1 => 2, 2 => 1}" +Number of returns: 1" `; exports[`toHaveReturnedWith works with Map 2`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) +"expect(jest.fn()).toHaveReturnedWith(expected) -Expected mock function to have returned: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -But it returned: - Map {1 => 2, 2 => 1}" +Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} +Received: Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`toHaveReturnedWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveReturnedWith(expected) +"expect(jest.fn()).not.toHaveReturnedWith(expected) + +Expected: not Set {1, 2} -Expected mock function not to have returned: - Set {1, 2} -But it returned exactly: - Set {1, 2}" +Number of returns: 1" `; exports[`toHaveReturnedWith works with Set 2`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) +"expect(jest.fn()).toHaveReturnedWith(expected) -Expected mock function to have returned: - Set {3, 4} -But it returned: - Set {1, 2}" +Expected: Set {3, 4} +Received: Set {1, 2} + +Number of returns: 1" `; exports[`toHaveReturnedWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.toHaveReturnedWith(expected) +"expect(jest.fn()).not.toHaveReturnedWith(expected) -Expected mock function not to have returned: - \\"foo\\" -But it returned exactly: - \\"foo\\"" +Expected: not \\"foo\\" + +Number of returns: 1" `; exports[`toHaveReturnedWith works with argument that does not match 1`] = ` -"expect(jest.fn()).toHaveReturnedWith(expected) +"expect(jest.fn()).toHaveReturnedWith(expected) -Expected mock function to have returned: - \\"bar\\" -But it returned: - \\"foo\\"" +Expected: \\"bar\\" +Received: \\"foo\\" + +Number of returns: 1" `; exports[`toHaveReturnedWith works with undefined 1`] = ` -"expect(jest.fn()).not.toHaveReturnedWith(expected) +"expect(jest.fn()).not.toHaveReturnedWith(expected) + +Expected: not undefined -Expected mock function not to have returned: - undefined -But it returned exactly: - undefined" +Number of returns: 1" `; exports[`toReturn .not fails with any argument passed 1`] = ` @@ -2636,54 +2726,56 @@ Received has value: [Function fn]" `; exports[`toReturnWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).toReturnWith(expected) +"expect(jest.fn()).toReturnWith(expected) + +Expected: undefined +Received: function call threw an error -Expected mock function to have returned: - undefined -But it did not return." +Number of returns: 0 +Number of calls: 1" `; exports[`toReturnWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).toReturnWith(expected) +"expect(jest.fn()).toReturnWith(expected) -Expected mock function to have returned: - undefined -But it did not return." +Expected: undefined +Received: function call threw an error + +Number of returns: 0 +Number of calls: 1" `; exports[`toReturnWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).toReturnWith(expected) +"expect(named-mock).toReturnWith(expected) -Expected mock function \\"named-mock\\" to have returned: - \\"foo\\" -But it did not return." +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toReturnWith returnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).toReturnWith(expected) +"expect(jest.fn()).toReturnWith(expected) + +Expected: undefined +Received + 1: function call has not returned yet + 2: function call has not returned yet + 3: function call has not returned yet -Expected mock function to have returned: - undefined -But it did not return." +Number of returns: 0 +Number of calls: 4" `; exports[`toReturnWith returnedWith works with more calls than the limit 1`] = ` -"expect(jest.fn()).toReturnWith(expected) - -Expected mock function to have returned: - \\"bar\\" -But it returned: - \\"foo1\\" +"expect(jest.fn()).toReturnWith(expected) - \\"foo2\\" +Expected: \\"bar\\" +Received + 1: \\"foo1\\" + 2: \\"foo2\\" + 3: \\"foo3\\" - \\"foo3\\" - - \\"foo4\\" - - \\"foo5\\" - - ...and 1 more" +Number of returns: 6" `; exports[`toReturnWith works only on spies or jest.fn 1`] = ` @@ -2696,90 +2788,84 @@ Received has value: [Function fn]" `; exports[`toReturnWith works when not called 1`] = ` -"expect(jest.fn()).toReturnWith(expected) +"expect(jest.fn()).toReturnWith(expected) -Expected mock function to have returned: - \\"foo\\" -But it did not return." +Expected: \\"foo\\" + +Number of returns: 0" `; exports[`toReturnWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.toReturnWith(expected) +"expect(jest.fn()).not.toReturnWith(expected) -Expected mock function not to have returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} + +Number of returns: 1" `; exports[`toReturnWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.toReturnWith(expected) +"expect(jest.fn()).not.toReturnWith(expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function not to have returned: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -But it returned exactly: - Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}" +Number of returns: 1" `; exports[`toReturnWith works with Map 1`] = ` -"expect(jest.fn()).not.toReturnWith(expected) +"expect(jest.fn()).not.toReturnWith(expected) -Expected mock function not to have returned: - Map {1 => 2, 2 => 1} -But it returned exactly: - Map {1 => 2, 2 => 1}" +Expected: not Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`toReturnWith works with Map 2`] = ` -"expect(jest.fn()).toReturnWith(expected) +"expect(jest.fn()).toReturnWith(expected) -Expected mock function to have returned: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -But it returned: - Map {1 => 2, 2 => 1}" +Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} +Received: Map {1 => 2, 2 => 1} + +Number of returns: 1" `; exports[`toReturnWith works with Set 1`] = ` -"expect(jest.fn()).not.toReturnWith(expected) +"expect(jest.fn()).not.toReturnWith(expected) + +Expected: not Set {1, 2} -Expected mock function not to have returned: - Set {1, 2} -But it returned exactly: - Set {1, 2}" +Number of returns: 1" `; exports[`toReturnWith works with Set 2`] = ` -"expect(jest.fn()).toReturnWith(expected) +"expect(jest.fn()).toReturnWith(expected) -Expected mock function to have returned: - Set {3, 4} -But it returned: - Set {1, 2}" +Expected: Set {3, 4} +Received: Set {1, 2} + +Number of returns: 1" `; exports[`toReturnWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.toReturnWith(expected) +"expect(jest.fn()).not.toReturnWith(expected) -Expected mock function not to have returned: - \\"foo\\" -But it returned exactly: - \\"foo\\"" +Expected: not \\"foo\\" + +Number of returns: 1" `; exports[`toReturnWith works with argument that does not match 1`] = ` -"expect(jest.fn()).toReturnWith(expected) +"expect(jest.fn()).toReturnWith(expected) -Expected mock function to have returned: - \\"bar\\" -But it returned: - \\"foo\\"" +Expected: \\"bar\\" +Received: \\"foo\\" + +Number of returns: 1" `; exports[`toReturnWith works with undefined 1`] = ` -"expect(jest.fn()).not.toReturnWith(expected) +"expect(jest.fn()).not.toReturnWith(expected) + +Expected: not undefined -Expected mock function not to have returned: - undefined -But it returned exactly: - undefined" +Number of returns: 1" `; diff --git a/packages/expect/src/spyMatchers.ts b/packages/expect/src/spyMatchers.ts index f55e4e2be21b..94079de8a117 100644 --- a/packages/expect/src/spyMatchers.ts +++ b/packages/expect/src/spyMatchers.ts @@ -17,6 +17,7 @@ import { printReceived, printWithType, RECEIVED_COLOR, + stringify, } from 'jest-matcher-utils'; import {MatchersObject, MatcherState, SyncExpectationResult} from './types'; import {equals} from './jasmineUtils'; @@ -24,7 +25,6 @@ import {iterableEquality, partition, isOneline} from './utils'; const PRINT_LIMIT = 3; const CALL_PRINT_LIMIT = 3; -const RETURN_PRINT_LIMIT = 5; const LAST_CALL_PRINT_LIMIT = 1; const printReceivedArgs = (args: Array): string => @@ -32,6 +32,83 @@ const printReceivedArgs = (args: Array): string => ? 'called with no arguments' : args.map(arg => printReceived(arg)).join(', '); +const isEqualReturn = (expected: unknown, result: any): boolean => + result.type === 'return' && + equals(expected, result.value, [iterableEquality]); + +const countReturns = (results: Array): number => + results.reduce( + (n: number, result: any) => (result.type === 'return' ? n + 1 : n), + 0, + ); + +const printNumberOfReturns = ( + countReturns: number, + countCalls: number, +): string => + `\nNumber of returns: ${printReceived(countReturns)}` + + (countCalls !== countReturns + ? `\nNumber of calls: ${printReceived(countCalls)}` + : ''); + +type PrintLabel = (string: string, isExpectedCall: boolean) => string; + +// Given a label, return a function which given a string, +// right-aligns it preceding the colon in the label. +const getRightAlignedPrinter = (label: string): PrintLabel => { + // Assume that the label contains a colon. + const index = label.indexOf(':'); + const suffix = label.slice(index); + + return (string: string, isExpectedCall: boolean) => + (isExpectedCall + ? '->' + ' '.repeat(Math.max(0, index - 2 - string.length)) + : ' '.repeat(Math.max(index - string.length))) + + string + + suffix; +}; + +const printResult = (result: any) => + result.type === 'throw' + ? 'function call threw an error' + : result.type === 'incomplete' + ? 'function call has not returned yet' + : printReceived(result.value); + +type IndexedResult = [number, any]; + +// Return either empty string or one line per indexed result, +// so additional empty line can separate from `Number of returns` which follows. +const printReceivedResults = ( + label: string, + indexedResults: Array, + isOnlyCall: boolean, + iExpectedCall?: number, +) => { + if (indexedResults.length === 0) { + return ''; + } + + if (isOnlyCall) { + return label + printResult(indexedResults[0][1]) + '\n'; + } + + const printAligned = getRightAlignedPrinter(label); + + return ( + label.replace(':', '').trim() + + '\n' + + indexedResults.reduce( + (printed: string, [i, result]: IndexedResult) => + printed + + printAligned(String(i + 1), i === iExpectedCall) + + printResult(result) + + '\n', + '', + ) + ); +}; + const createToBeCalledMatcher = (matcherName: string) => function( this: MatcherState, @@ -277,41 +354,62 @@ const createToReturnWithMatcher = (matcherName: string) => isNot: this.isNot, promise: this.promise, }; - ensureMock(received, matcherName.slice(1), expectedArgument, options); + ensureMock(received, matcherName, expectedArgument, options); const receivedName = received.getMockName(); - const identifier = - receivedName === 'jest.fn()' - ? 'mock function' - : `mock function "${receivedName}"`; - - // List of return values that correspond only to calls that returned - const returnValues = received.mock.results - .filter((result: any) => result.type === 'return') - .map((result: any) => result.value); + const {calls, results} = received.mock; - const [match] = partition(returnValues, value => - equals(expected, value, [iterableEquality]), - ); - const pass = match.length > 0; + const pass = results.some((result: any) => isEqualReturn(expected, result)); const message = pass - ? () => - matcherHint('.not' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} not to have returned:\n` + - ` ${printExpected(expected)}\n` + - `But it returned exactly:\n` + - ` ${printReceived(expected)}` - : () => - matcherHint(matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} to have returned:\n` + - formatMismatchedReturnValues( - returnValues, - expected, - RETURN_PRINT_LIMIT, + ? () => { + // Some examples of results that are equal to expected value. + const indexedResults: Array = []; + let i = 0; + while (i < results.length && indexedResults.length < PRINT_LIMIT) { + if (isEqualReturn(expected, results[i])) { + indexedResults.push([i, results[i]]); + } + i += 1; + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `Expected: not ${printExpected(expected)}\n` + + (results.length === 1 && + results[0].type === 'return' && + stringify(results[0].value) === stringify(expected) + ? '' + : printReceivedResults( + 'Received: ', + indexedResults, + results.length === 1, + )) + + printNumberOfReturns(countReturns(results), calls.length) ); + } + : () => { + // Some examples of results that are not equal to expected value. + const indexedResults: Array = []; + let i = 0; + while (i < results.length && indexedResults.length < PRINT_LIMIT) { + indexedResults.push([i, results[i]]); + i += 1; + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `Expected: ${printExpected(expected)}\n` + + printReceivedResults( + 'Received: ', + indexedResults, + results.length === 1, + ) + + printNumberOfReturns(countReturns(results), calls.length) + ); + }; return {message, pass}; }; @@ -367,43 +465,73 @@ const createLastReturnedMatcher = (matcherName: string) => isNot: this.isNot, promise: this.promise, }; - ensureMock(received, matcherName.slice(1), expectedArgument, options); + ensureMock(received, matcherName, expectedArgument, options); const receivedName = received.getMockName(); - const identifier = - receivedName === 'jest.fn()' - ? 'mock function' - : `mock function "${receivedName}"`; - const results = received.mock.results; - const lastResult = results[results.length - 1]; - const pass = - !!lastResult && - lastResult.type === 'return' && - equals(lastResult.value, expected, [iterableEquality]); + const {calls, results} = received.mock; + const iLast = results.length - 1; + + const pass = iLast >= 0 && isEqualReturn(expected, results[iLast]); const message = pass - ? () => - matcherHint('.not' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} to not have last returned:\n` + - ` ${printExpected(expected)}\n` + - `But it last returned exactly:\n` + - ` ${printReceived(lastResult.value)}` - : () => - matcherHint(matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} to have last returned:\n` + - ` ${printExpected(expected)}\n` + - (!lastResult - ? `But it was ${RECEIVED_COLOR('not called')}` - : lastResult.type === 'incomplete' - ? `But the last call ${RECEIVED_COLOR('has not returned yet')}` - : lastResult.type === 'throw' - ? `But the last call ${RECEIVED_COLOR('threw an error')}` - : `But the last call returned:\n ${printReceived( - lastResult.value, - )}`); + ? () => { + const indexedResults: Array = []; + if (iLast > 0) { + // Display preceding result as context. + indexedResults.push([iLast - 1, results[iLast - 1]]); + } + indexedResults.push([iLast, results[iLast]]); + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `Expected: not ${printExpected(expected)}\n` + + (results.length === 1 && + results[0].type === 'return' && + stringify(results[0].value) === stringify(expected) + ? '' + : printReceivedResults( + 'Received: ', + indexedResults, + results.length === 1, + iLast, + )) + + printNumberOfReturns(countReturns(results), calls.length) + ); + } + : () => { + const indexedResults: Array = []; + if (iLast >= 0) { + if (iLast > 0) { + let i = iLast - 1; + // Is there a preceding result that is equal to expected value? + while (i >= 0 && !isEqualReturn(expected, results[i])) { + i -= 1; + } + if (i < 0) { + i = iLast - 1; // otherwise, preceding result + } + + indexedResults.push([i, results[i]]); + } + + indexedResults.push([iLast, results[iLast]]); + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `Expected: ${printExpected(expected)}\n` + + printReceivedResults( + 'Received: ', + indexedResults, + results.length === 1, + iLast, + ) + + printNumberOfReturns(countReturns(results), calls.length) + ); + }; return {message, pass}; }; @@ -487,17 +615,12 @@ const createNthReturnedWithMatcher = (matcherName: string) => promise: this.promise, secondArgument: 'expected', }; - ensureMock(received, matcherName.slice(1), expectedArgument, options); + ensureMock(received, matcherName, expectedArgument, options); if (!Number.isSafeInteger(nth) || nth < 1) { throw new Error( matcherErrorMessage( - matcherHint( - matcherName.slice(1), - undefined, - expectedArgument, - options, - ), + matcherHint(matcherName, undefined, expectedArgument, options), `${EXPECTED_COLOR(expectedArgument)} must be a positive integer`, printWithType(expectedArgument, nth, printExpected), ), @@ -505,53 +628,112 @@ const createNthReturnedWithMatcher = (matcherName: string) => } const receivedName = received.getMockName(); - const identifier = - receivedName === 'jest.fn()' - ? 'mock function' - : `mock function "${receivedName}"`; - - const results = received.mock.results; - const nthResult = results[nth - 1]; - const pass = - !!nthResult && - nthResult.type === 'return' && - equals(nthResult.value, expected, [iterableEquality]); - const nthString = nthToString(nth); + const {calls, results} = received.mock; + const length = results.length; + const iNth = nth - 1; + + const pass = iNth < length && isEqualReturn(expected, results[iNth]); + const message = pass - ? () => - matcherHint('.not' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} ${nthString} call to not have returned with:\n` + - ` ${printExpected(expected)}\n` + - `But the ${nthString} call returned exactly:\n` + - ` ${printReceived(nthResult.value)}` - : () => - matcherHint(matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} ${nthString} call to have returned with:\n` + - ` ${printExpected(expected)}\n` + - (results.length === 0 - ? `But it was ${RECEIVED_COLOR('not called')}` - : nth > results.length - ? `But it was only called ${printReceived(results.length)} times` - : nthResult.type === 'incomplete' - ? `But the ${nthString} call ${RECEIVED_COLOR( - 'has not returned yet', - )}` - : nthResult.type === 'throw' - ? `But the ${nthString} call ${RECEIVED_COLOR('threw an error')}` - : `But the ${nthString} call returned with:\n ${printReceived( - nthResult.value, - )}`); + ? () => { + // Display preceding and following results, + // in case assertions fails because index is off by one. + const indexedResults: Array = []; + if (iNth - 1 >= 0) { + indexedResults.push([iNth - 1, results[iNth - 1]]); + } + indexedResults.push([iNth, results[iNth]]); + if (iNth + 1 < length) { + indexedResults.push([iNth + 1, results[iNth + 1]]); + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `n: ${nth}\n` + + `Expected: not ${printExpected(expected)}\n` + + (results.length === 1 && + results[0].type === 'return' && + stringify(results[0].value) === stringify(expected) + ? '' + : printReceivedResults( + 'Received: ', + indexedResults, + results.length === 1, + iNth, + )) + + printNumberOfReturns(countReturns(results), calls.length) + ); + } + : () => { + // Display preceding and following results: + // * nearest result that is equal to expected value + // * otherwise, adjacent result + // in case assertions fails because of index, especially off by one. + const indexedResults: Array = []; + if (iNth < length) { + if (iNth - 1 >= 0) { + let i = iNth - 1; + // Is there a preceding result that is equal to expected value? + while (i >= 0 && !isEqualReturn(expected, results[i])) { + i -= 1; + } + if (i < 0) { + i = iNth - 1; // otherwise, adjacent result + } + + indexedResults.push([i, results[i]]); + } + indexedResults.push([iNth, results[iNth]]); + if (iNth + 1 < length) { + let i = iNth + 1; + // Is there a following result that is equal to expected value? + while (i < length && !isEqualReturn(expected, results[i])) { + i += 1; + } + if (i >= length) { + i = iNth + 1; // otherwise, adjacent result + } + + indexedResults.push([i, results[i]]); + } + } else if (length > 0) { + // The number of received calls is fewer than the expected number. + let i = length - 1; + // Is there a result that is equal to expected value? + while (i >= 0 && !isEqualReturn(expected, results[i])) { + i -= 1; + } + if (i < 0) { + i = length - 1; // otherwise, last result + } + + indexedResults.push([i, results[i]]); + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `n: ${nth}\n` + + `Expected: ${printExpected(expected)}\n` + + printReceivedResults( + 'Received: ', + indexedResults, + results.length === 1, + iNth, + ) + + printNumberOfReturns(countReturns(results), calls.length) + ); + }; return {message, pass}; }; const spyMatchers: MatchersObject = { lastCalledWith: createLastCalledWithMatcher('.lastCalledWith'), - lastReturnedWith: createLastReturnedMatcher('.lastReturnedWith'), + lastReturnedWith: createLastReturnedMatcher('lastReturnedWith'), nthCalledWith: createNthCalledWithMatcher('.nthCalledWith'), - nthReturnedWith: createNthReturnedWithMatcher('.nthReturnedWith'), + nthReturnedWith: createNthReturnedWithMatcher('nthReturnedWith'), toBeCalled: createToBeCalledMatcher('toBeCalled'), toBeCalledTimes: createToBeCalledTimesMatcher('toBeCalledTimes'), toBeCalledWith: createToBeCalledWithMatcher('.toBeCalledWith'), @@ -564,14 +746,14 @@ const spyMatchers: MatchersObject = { toHaveBeenNthCalledWith: createNthCalledWithMatcher( '.toHaveBeenNthCalledWith', ), - toHaveLastReturnedWith: createLastReturnedMatcher('.toHaveLastReturnedWith'), - toHaveNthReturnedWith: createNthReturnedWithMatcher('.toHaveNthReturnedWith'), + toHaveLastReturnedWith: createLastReturnedMatcher('toHaveLastReturnedWith'), + toHaveNthReturnedWith: createNthReturnedWithMatcher('toHaveNthReturnedWith'), toHaveReturned: createToReturnMatcher('toHaveReturned'), toHaveReturnedTimes: createToReturnTimesMatcher('toHaveReturnedTimes'), - toHaveReturnedWith: createToReturnWithMatcher('.toHaveReturnedWith'), + toHaveReturnedWith: createToReturnWithMatcher('toHaveReturnedWith'), toReturn: createToReturnMatcher('toReturn'), toReturnTimes: createToReturnTimesMatcher('toReturnTimes'), - toReturnWith: createToReturnWithMatcher('.toReturnWith'), + toReturnWith: createToReturnWithMatcher('toReturnWith'), }; const isSpy = (spy: any) => spy.calls && typeof spy.calls.count === 'function'; @@ -613,20 +795,6 @@ const getPrintedCalls = ( return result.join(sep); }; -const getPrintedReturnValues = (calls: Array, limit: number): string => { - const result = []; - - for (let i = 0; i < calls.length && i < limit; i += 1) { - result.push(printReceived(calls[i])); - } - - if (calls.length > limit) { - result.push(`...and ${printReceived(calls.length - limit)} more`); - } - - return result.join('\n\n '); -}; - const formatMismatchedCalls = ( calls: Array, expected: any, @@ -647,25 +815,6 @@ const formatMismatchedCalls = ( } }; -const formatMismatchedReturnValues = ( - returnValues: Array, - expected: any, - limit: number, -): string => { - if (returnValues.length) { - return ( - ` ${printExpected(expected)}\n` + - `But it returned:\n` + - ` ${getPrintedReturnValues(returnValues, limit)}` - ); - } else { - return ( - ` ${printExpected(expected)}\n` + - `But it did ${RECEIVED_COLOR('not return')}.` - ); - } -}; - const formatMismatchedArgs = (expected: any, received: any): string => { const length = Math.max(expected.length, received.length); From cb322d19ade00134d5a16c3be7db0db41766a855 Mon Sep 17 00:00:00 2001 From: Ethan Marsh Date: Thu, 25 Jul 2019 03:21:12 -0700 Subject: [PATCH 03/34] chore(config.md): correct links to testRegex (#8749) --- docs/Configuration.md | 4 ++-- website/versioned_docs/version-24.0/Configuration.md | 4 ++-- website/versioned_docs/version-24.1/Configuration.md | 4 ++-- website/versioned_docs/version-24.6/Configuration.md | 4 ++-- website/versioned_docs/version-24.8/Configuration.md | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 766ca3cf2b0e..f0c4f232f8a3 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -937,7 +937,7 @@ The glob patterns Jest uses to detect test files. By default it looks for `.js`, See the [micromatch](https://github.com/jonschlinkert/micromatch) package for details of the patterns you can specify. -See also [`testRegex` [string | Array]](#testregex-string), but note that you cannot specify both options. +See also [`testRegex` [string | array]](#testregex-string-array-string), but note that you cannot specify both options. ### `testPathIgnorePatterns` [array] @@ -947,7 +947,7 @@ An array of regexp pattern strings that are matched against all test paths befor These pattern strings match against the full path. Use the `` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["/build/", "/node_modules/"]`. -### `testRegex` [string | Array] +### `testRegex` [string | array] Default: `(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$` diff --git a/website/versioned_docs/version-24.0/Configuration.md b/website/versioned_docs/version-24.0/Configuration.md index d89d8f989db5..a3df699a3913 100644 --- a/website/versioned_docs/version-24.0/Configuration.md +++ b/website/versioned_docs/version-24.0/Configuration.md @@ -894,7 +894,7 @@ The glob patterns Jest uses to detect test files. By default it looks for `.js`, See the [micromatch](https://github.com/jonschlinkert/micromatch) package for details of the patterns you can specify. -See also [`testRegex` [string | Array]](#testregex-string), but note that you cannot specify both options. +See also [`testRegex` [string | array]](#testregex-string-array-string), but note that you cannot specify both options. ### `testPathIgnorePatterns` [array] @@ -904,7 +904,7 @@ An array of regexp pattern strings that are matched against all test paths befor These pattern strings match against the full path. Use the `` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["/build/", "/node_modules/"]`. -### `testRegex` [string | Array] +### `testRegex` [string | array] Default: `(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$` diff --git a/website/versioned_docs/version-24.1/Configuration.md b/website/versioned_docs/version-24.1/Configuration.md index 461818340a3f..cd0ea80e292f 100644 --- a/website/versioned_docs/version-24.1/Configuration.md +++ b/website/versioned_docs/version-24.1/Configuration.md @@ -903,7 +903,7 @@ The glob patterns Jest uses to detect test files. By default it looks for `.js`, See the [micromatch](https://github.com/jonschlinkert/micromatch) package for details of the patterns you can specify. -See also [`testRegex` [string | Array]](#testregex-string), but note that you cannot specify both options. +See also [`testRegex` [string | array]](#testregex-string-array-string), but note that you cannot specify both options. ### `testPathIgnorePatterns` [array] @@ -913,7 +913,7 @@ An array of regexp pattern strings that are matched against all test paths befor These pattern strings match against the full path. Use the `` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["/build/", "/node_modules/"]`. -### `testRegex` [string | Array] +### `testRegex` [string | array] Default: `(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$` diff --git a/website/versioned_docs/version-24.6/Configuration.md b/website/versioned_docs/version-24.6/Configuration.md index 45544f1ef797..b05a851a46bb 100644 --- a/website/versioned_docs/version-24.6/Configuration.md +++ b/website/versioned_docs/version-24.6/Configuration.md @@ -922,7 +922,7 @@ The glob patterns Jest uses to detect test files. By default it looks for `.js`, See the [micromatch](https://github.com/jonschlinkert/micromatch) package for details of the patterns you can specify. -See also [`testRegex` [string | Array]](#testregex-string), but note that you cannot specify both options. +See also [`testRegex` [string | array]](#testregex-string-array-string), but note that you cannot specify both options. ### `testPathIgnorePatterns` [array] @@ -932,7 +932,7 @@ An array of regexp pattern strings that are matched against all test paths befor These pattern strings match against the full path. Use the `` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["/build/", "/node_modules/"]`. -### `testRegex` [string | Array] +### `testRegex` [string | array] Default: `(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$` diff --git a/website/versioned_docs/version-24.8/Configuration.md b/website/versioned_docs/version-24.8/Configuration.md index 1cd21b44fc3b..41d2fac95014 100644 --- a/website/versioned_docs/version-24.8/Configuration.md +++ b/website/versioned_docs/version-24.8/Configuration.md @@ -938,7 +938,7 @@ The glob patterns Jest uses to detect test files. By default it looks for `.js`, See the [micromatch](https://github.com/jonschlinkert/micromatch) package for details of the patterns you can specify. -See also [`testRegex` [string | Array]](#testregex-string), but note that you cannot specify both options. +See also [`testRegex` [string | array]](#testregex-string-array-string), but note that you cannot specify both options. ### `testPathIgnorePatterns` [array] @@ -948,7 +948,7 @@ An array of regexp pattern strings that are matched against all test paths befor These pattern strings match against the full path. Use the `` string token to include the path to your project's root directory to prevent it from accidentally ignoring all of your files in different environments that may have different root directories. Example: `["/build/", "/node_modules/"]`. -### `testRegex` [string | Array] +### `testRegex` [string | array] Default: `(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$` From f857d309646154f6ae587ec744195453030d1f7e Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Thu, 25 Jul 2019 18:01:34 -0400 Subject: [PATCH 04/34] expect: Throw matcher error when received cannot be jasmine spy (#8747) * expect: Improve report when mock-spy matcher fails, part 5 * Update CHANGELOG.md * Edit CHANGELOG.md --- CHANGELOG.md | 1 + .../__snapshots__/spyMatchers.test.js.snap | 58 ++++++++++++------- .../expect/src/__tests__/spyMatchers.test.js | 49 ++++++++++++++-- packages/expect/src/spyMatchers.ts | 44 ++++++++++---- 4 files changed, 115 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa34e1685ea9..208b90faf636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - `[expect]` Improve report when mock-spy matcher fails, part 2 ([#8649](https://github.com/facebook/jest/pull/8649)) - `[expect]` Improve report when mock-spy matcher fails, part 3 ([#8697](https://github.com/facebook/jest/pull/8697)) - `[expect]` Improve report when mock-spy matcher fails, part 4 ([#8710](https://github.com/facebook/jest/pull/8710)) +- `[expect]` Throw matcher error when received cannot be jasmine spy ([#8747](https://github.com/facebook/jest/pull/8747)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) - `[*]` Manage the global timeout with `--testTimeout` command line argument. ([#8456](https://github.com/facebook/jest/pull/8456)) diff --git a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap index bf6a4cf1042d..c25156a340cd 100644 --- a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap @@ -180,7 +180,7 @@ Number of returns: 3" exports[`lastReturnedWith works only on spies or jest.fn 1`] = ` "expect(received).lastReturnedWith(expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" @@ -590,7 +590,7 @@ Number of returns: 3" exports[`nthReturnedWith works only on spies or jest.fn 1`] = ` "expect(received).nthReturnedWith(n, expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" @@ -699,7 +699,7 @@ Expected has value: 555" `; exports[`toBeCalled .not passes when called 1`] = ` -"expect(jest.fn()).toBeCalled() +"expect(spy).toBeCalled() Expected number of calls: >= 1 Received number of calls: 0" @@ -880,7 +880,7 @@ Expected has value: [Function anonymous]" `; exports[`toBeCalledTimes passes if function called equal to expected times 1`] = ` -"expect(jest.fn()).not.toBeCalledTimes(expected) +"expect(spy).not.toBeCalledTimes(expected) Expected number of calls: not 2" `; @@ -1029,7 +1029,7 @@ Expected has value: 555" `; exports[`toHaveBeenCalled .not passes when called 1`] = ` -"expect(jest.fn()).toHaveBeenCalled() +"expect(spy).toHaveBeenCalled() Expected number of calls: >= 1 Received number of calls: 0" @@ -1210,7 +1210,7 @@ Expected has value: [Function anonymous]" `; exports[`toHaveBeenCalledTimes passes if function called equal to expected times 1`] = ` -"expect(jest.fn()).not.toHaveBeenCalledTimes(expected) +"expect(spy).not.toHaveBeenCalledTimes(expected) Expected number of calls: not 2" `; @@ -1689,7 +1689,7 @@ Number of returns: 3" exports[`toHaveLastReturnedWith works only on spies or jest.fn 1`] = ` "expect(received).toHaveLastReturnedWith(expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" @@ -1939,7 +1939,7 @@ Number of returns: 3" exports[`toHaveNthReturnedWith works only on spies or jest.fn 1`] = ` "expect(received).toHaveNthReturnedWith(n, expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" @@ -2073,7 +2073,7 @@ Received number of returns: 0" exports[`toHaveReturned .not works only on jest.fn 1`] = ` "expect(received).not.toHaveReturned() -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" @@ -2135,6 +2135,15 @@ Received number of returns: 1 1: undefined" `; +exports[`toHaveReturned throw matcher error if received is spy 1`] = ` +"expect(received).toHaveReturned() + +Matcher error: received value must be a mock function + +Received has type: function +Received has value: [Function spy]" +`; + exports[`toHaveReturnedTimes .not only accepts a number argument 1`] = ` "expect(received).not.toHaveReturnedTimes(expected) @@ -2300,13 +2309,13 @@ exports[`toHaveReturnedTimes passes if function returned equal to expected times Expected number of returns: not 2" `; -exports[`toHaveReturnedTimes works only on spies or jest.fn 1`] = ` -"expect(received).toHaveReturnedTimes(expected) +exports[`toHaveReturnedTimes throw matcher error if received is spy 1`] = ` +"expect(received).not.toHaveReturnedTimes(expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function -Received has value: [Function fn]" +Received has value: [Function spy]" `; exports[`toHaveReturnedWith a call that throws is not considered to have returned 1`] = ` @@ -2365,7 +2374,7 @@ Number of returns: 6" exports[`toHaveReturnedWith works only on spies or jest.fn 1`] = ` "expect(received).toHaveReturnedWith(expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" @@ -2489,7 +2498,7 @@ Received number of returns: 0" exports[`toReturn .not works only on jest.fn 1`] = ` "expect(received).not.toReturn() -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" @@ -2551,6 +2560,15 @@ Received number of returns: 1 1: undefined" `; +exports[`toReturn throw matcher error if received is spy 1`] = ` +"expect(received).toReturn() + +Matcher error: received value must be a mock function + +Received has type: function +Received has value: [Function spy]" +`; + exports[`toReturnTimes .not only accepts a number argument 1`] = ` "expect(received).not.toReturnTimes(expected) @@ -2716,13 +2734,13 @@ exports[`toReturnTimes passes if function returned equal to expected times 1`] = Expected number of returns: not 2" `; -exports[`toReturnTimes works only on spies or jest.fn 1`] = ` -"expect(received).toReturnTimes(expected) +exports[`toReturnTimes throw matcher error if received is spy 1`] = ` +"expect(received).not.toReturnTimes(expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function -Received has value: [Function fn]" +Received has value: [Function spy]" `; exports[`toReturnWith a call that throws is not considered to have returned 1`] = ` @@ -2781,7 +2799,7 @@ Number of returns: 6" exports[`toReturnWith works only on spies or jest.fn 1`] = ` "expect(received).toReturnWith(expected) -Matcher error: received value must be a mock or spy function +Matcher error: received value must be a mock function Received has type: function Received has value: [Function fn]" diff --git a/packages/expect/src/__tests__/spyMatchers.test.js b/packages/expect/src/__tests__/spyMatchers.test.js index 1939557259f5..c6ce6366a124 100644 --- a/packages/expect/src/__tests__/spyMatchers.test.js +++ b/packages/expect/src/__tests__/spyMatchers.test.js @@ -8,6 +8,22 @@ const Immutable = require('immutable'); const jestExpect = require('../'); +// Given a Jest mock function, return a minimal mock of a Jasmine spy. +const createSpy = fn => { + const spy = function() {}; + + spy.calls = { + all() { + return fn.mock.calls.map(args => ({args})); + }, + count() { + return fn.mock.calls.length; + }, + }; + + return spy; +}; + ['toBeCalled', 'toHaveBeenCalled'].forEach(called => { describe(`${called}`, () => { test(`works only on spies or jest.fn`, () => { @@ -19,15 +35,18 @@ const jestExpect = require('../'); test(`passes when called`, () => { const fn = jest.fn(); fn('arg0', 'arg1', 'arg2'); + jestExpect(createSpy(fn))[called](); jestExpect(fn)[called](); expect(() => jestExpect(fn).not[called]()).toThrowErrorMatchingSnapshot(); }); test(`.not passes when called`, () => { const fn = jest.fn(); + const spy = createSpy(fn); + jestExpect(spy).not[called](); jestExpect(fn).not[called](); - expect(() => jestExpect(fn)[called]()).toThrowErrorMatchingSnapshot(); + expect(() => jestExpect(spy)[called]()).toThrowErrorMatchingSnapshot(); }); test(`fails with any argument passed`, () => { @@ -93,10 +112,12 @@ const jestExpect = require('../'); fn(); fn(); + const spy = createSpy(fn); + jestExpect(spy)[calledTimes](2); jestExpect(fn)[calledTimes](2); expect(() => - jestExpect(fn).not[calledTimes](2), + jestExpect(spy).not[calledTimes](2), ).toThrowErrorMatchingSnapshot(); }); @@ -106,6 +127,10 @@ const jestExpect = require('../'); fn(); fn(); + const spy = createSpy(fn); + jestExpect(spy)[calledTimes](3); + jestExpect(spy).not[calledTimes](2); + jestExpect(fn)[calledTimes](3); jestExpect(fn).not[calledTimes](2); @@ -118,6 +143,10 @@ const jestExpect = require('../'); const fn = jest.fn(); fn(); + const spy = createSpy(fn); + jestExpect(spy)[calledTimes](1); + jestExpect(spy).not[calledTimes](2); + jestExpect(fn)[calledTimes](1); jestExpect(fn).not[calledTimes](2); @@ -164,6 +193,7 @@ const jestExpect = require('../'); test(`works when not called`, () => { const fn = jest.fn(); + caller(jestExpect(createSpy(fn)).not[calledWith], 'foo', 'bar'); caller(jestExpect(fn).not[calledWith], 'foo', 'bar'); expect(() => @@ -174,6 +204,7 @@ const jestExpect = require('../'); test(`works with no arguments`, () => { const fn = jest.fn(); fn(); + caller(jestExpect(createSpy(fn))[calledWith]); caller(jestExpect(fn)[calledWith]); }); @@ -181,6 +212,7 @@ const jestExpect = require('../'); const fn = jest.fn(); fn('foo', 'bar1'); + caller(jestExpect(createSpy(fn)).not[calledWith], 'foo', 'bar'); caller(jestExpect(fn).not[calledWith], 'foo', 'bar'); expect(() => @@ -192,6 +224,7 @@ const jestExpect = require('../'); const fn = jest.fn(); fn('foo', 'bar'); + caller(jestExpect(createSpy(fn))[calledWith], 'foo', 'bar'); caller(jestExpect(fn)[calledWith], 'foo', 'bar'); expect(() => @@ -389,6 +422,12 @@ const jestExpect = require('../'); ).toThrowErrorMatchingSnapshot(); }); + test(`throw matcher error if received is spy`, () => { + const spy = createSpy(jest.fn()); + + expect(() => jestExpect(spy)[returned]()).toThrowErrorMatchingSnapshot(); + }); + test(`passes when returned`, () => { const fn = jest.fn(() => 42); fn(); @@ -525,11 +564,11 @@ const jestExpect = require('../'); ['toReturnTimes', 'toHaveReturnedTimes'].forEach(returnedTimes => { describe(`${returnedTimes}`, () => { - test('works only on spies or jest.fn', () => { - const fn = function fn() {}; + test('throw matcher error if received is spy', () => { + const spy = createSpy(jest.fn()); expect(() => - jestExpect(fn)[returnedTimes](2), + jestExpect(spy).not[returnedTimes](2), ).toThrowErrorMatchingSnapshot(); }); diff --git a/packages/expect/src/spyMatchers.ts b/packages/expect/src/spyMatchers.ts index 94079de8a117..3e6360332173 100644 --- a/packages/expect/src/spyMatchers.ts +++ b/packages/expect/src/spyMatchers.ts @@ -121,7 +121,7 @@ const createToBeCalledMatcher = (matcherName: string) => promise: this.promise, }; ensureNoExpected(expected, matcherName, options); - ensureMock(received, matcherName, expectedArgument, options); + ensureMockOrSpy(received, matcherName, expectedArgument, options); const receivedIsSpy = isSpy(received); const receivedName = receivedIsSpy ? 'spy' : received.getMockName(); @@ -226,7 +226,7 @@ const createToBeCalledTimesMatcher = (matcherName: string) => promise: this.promise, }; ensureExpectedIsNumber(expected, matcherName, options); - ensureMock(received, matcherName, expectedArgument, options); + ensureMockOrSpy(received, matcherName, expectedArgument, options); const receivedIsSpy = isSpy(received); const receivedName = receivedIsSpy ? 'spy' : received.getMockName(); @@ -309,7 +309,7 @@ const createToBeCalledWithMatcher = (matcherName: string) => isNot: this.isNot, promise: this.promise, }; - ensureMock(received, matcherName.slice(1), expectedArgument, options); + ensureMockOrSpy(received, matcherName.slice(1), expectedArgument, options); const receivedIsSpy = isSpy(received); const type = receivedIsSpy ? 'spy' : 'mock function'; @@ -425,7 +425,7 @@ const createLastCalledWithMatcher = (matcherName: string) => isNot: this.isNot, promise: this.promise, }; - ensureMock(received, matcherName.slice(1), expectedArgument, options); + ensureMockOrSpy(received, matcherName.slice(1), expectedArgument, options); const receivedIsSpy = isSpy(received); const type = receivedIsSpy ? 'spy' : 'mock function'; @@ -549,7 +549,7 @@ const createNthCalledWithMatcher = (matcherName: string) => promise: this.promise, secondArgument: '...expected', }; - ensureMock(received, matcherName.slice(1), expectedArgument, options); + ensureMockOrSpy(received, matcherName.slice(1), expectedArgument, options); if (!Number.isSafeInteger(nth) || nth < 1) { throw new Error( @@ -756,19 +756,22 @@ const spyMatchers: MatchersObject = { toReturnWith: createToReturnWithMatcher('toReturnWith'), }; -const isSpy = (spy: any) => spy.calls && typeof spy.calls.count === 'function'; +const isMock = (received: any) => + received != null && received._isMockFunction === true; -const ensureMock = ( +const isSpy = (received: any) => + received != null && + received.calls != null && + typeof received.calls.all === 'function' && + typeof received.calls.count === 'function'; + +const ensureMockOrSpy = ( received: any, matcherName: string, expectedArgument: string, options: MatcherHintOptions, ) => { - if ( - !received || - ((received.calls === undefined || received.calls.all === undefined) && - received._isMockFunction !== true) - ) { + if (!isMock(received) && !isSpy(received)) { throw new Error( matcherErrorMessage( matcherHint(matcherName, undefined, expectedArgument, options), @@ -779,6 +782,23 @@ const ensureMock = ( } }; +const ensureMock = ( + received: any, + matcherName: string, + expectedArgument: string, + options: MatcherHintOptions, +) => { + if (!isMock(received)) { + throw new Error( + matcherErrorMessage( + matcherHint(matcherName, undefined, expectedArgument, options), + `${RECEIVED_COLOR('received')} value must be a mock function`, + printWithType('Received', received, printReceived), + ), + ); + } +}; + const getPrintedCalls = ( calls: Array, limit: number, From 5177236f31c705f1084822a9bb7b7da976a420f6 Mon Sep 17 00:00:00 2001 From: Endi Date: Fri, 26 Jul 2019 20:20:59 +0700 Subject: [PATCH 05/34] chore: download only enabled languages translation files (#8752) Closes #8707 --- .circleci/website.sh | 6 +- website/package.json | 2 +- yarn.lock | 1055 +++++++++++++++++++++++++++++++----------- 3 files changed, 794 insertions(+), 269 deletions(-) diff --git a/.circleci/website.sh b/.circleci/website.sh index 2c3e5a3c7b75..e964e431e670 100755 --- a/.circleci/website.sh +++ b/.circleci/website.sh @@ -21,7 +21,11 @@ else sudo dpkg -i crowdin.deb # translations upload/download yarn crowdin-upload - yarn crowdin-download + # download only enabled languages + for lang in ja es-ES ro zh-CN pt-BR ru uk + do + yarn crowdin-download -l $lang + done # build and publish website GIT_USER=docusaurus-bot USE_SSH=false yarn publish-gh-pages else diff --git a/website/package.json b/website/package.json index 64cff32a5b01..d83c6347b735 100644 --- a/website/package.json +++ b/website/package.json @@ -16,7 +16,7 @@ "rename-version": "docusaurus-rename-version" }, "dependencies": { - "docusaurus": "^1.10.0" + "docusaurus": "^1.12.0" }, "devDependencies": { "crowdin-cli": "^0.3.0", diff --git a/yarn.lock b/yarn.lock index 44b7d35d16d8..0423551f06b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,13 +2,20 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0": +"@babel/code-frame@7.0.0", "@babel/code-frame@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== dependencies: "@babel/highlight" "^7.0.0" +"@babel/code-frame@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" + integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== + dependencies: + "@babel/highlight" "^7.0.0" + "@babel/core@*", "@babel/core@^7.0.0", "@babel/core@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.3.4.tgz#921a5a13746c21e32445bf0798680e9d11a6530b" @@ -49,6 +56,26 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/core@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" + integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.5.5" + "@babel/helpers" "^7.5.5" + "@babel/parser" "^7.5.5" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/generator@^7.0.0", "@babel/generator@^7.3.3", "@babel/generator@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.3.4.tgz#9aa48c1989257877a9d971296e5b73bfe72e446e" @@ -60,6 +87,17 @@ source-map "^0.5.0" trim-right "^1.0.1" +"@babel/generator@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" + integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== + dependencies: + "@babel/types" "^7.5.5" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + trim-right "^1.0.1" + "@babel/helper-annotate-as-pure@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" @@ -92,6 +130,15 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" +"@babel/helper-call-delegate@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" + integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" + "@babel/helper-create-class-features-plugin@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.3.4.tgz#092711a7a3ad8ea34de3e541644c2ce6af1f6f0c" @@ -104,6 +151,18 @@ "@babel/helper-replace-supers" "^7.3.4" "@babel/helper-split-export-declaration" "^7.0.0" +"@babel/helper-create-class-features-plugin@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.5.5.tgz#401f302c8ddbc0edd36f7c6b2887d8fa1122e5a4" + integrity sha512-ZsxkyYiRA7Bg+ZTRpPvB6AbOFKTFFK4LrvTet8lInm0V468MWCaSYJE+I7v2z2r8KNLtYiV+K5kTCnR7dvyZjg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-member-expression-to-functions" "^7.5.5" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/helper-define-map@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz#3b74caec329b3c80c116290887c0dd9ae468c20c" @@ -113,6 +172,15 @@ "@babel/types" "^7.0.0" lodash "^4.17.10" +"@babel/helper-define-map@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz#3dec32c2046f37e09b28c93eb0b103fd2a25d369" + integrity sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/types" "^7.5.5" + lodash "^4.17.13" + "@babel/helper-explode-assignable-expression@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" @@ -144,6 +212,13 @@ dependencies: "@babel/types" "^7.0.0" +"@babel/helper-hoist-variables@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" + integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== + dependencies: + "@babel/types" "^7.4.4" + "@babel/helper-member-expression-to-functions@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz#8cd14b0a0df7ff00f009e7d7a436945f47c7a16f" @@ -151,6 +226,13 @@ dependencies: "@babel/types" "^7.0.0" +"@babel/helper-member-expression-to-functions@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" + integrity sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA== + dependencies: + "@babel/types" "^7.5.5" + "@babel/helper-module-imports@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" @@ -170,6 +252,18 @@ "@babel/types" "^7.2.2" lodash "^4.17.10" +"@babel/helper-module-transforms@^7.4.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.5.5.tgz#f84ff8a09038dcbca1fd4355661a500937165b4a" + integrity sha512-jBeCvETKuJqeiaCdyaheF40aXnnU1+wkSiUs/IQg3tB85up1LyL8x77ClY8qJpuRJUcXQo+ZtdNESmZl4j56Pw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/template" "^7.4.4" + "@babel/types" "^7.5.5" + lodash "^4.17.13" + "@babel/helper-optimise-call-expression@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" @@ -189,6 +283,13 @@ dependencies: lodash "^4.17.10" +"@babel/helper-regex@^7.4.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" + integrity sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw== + dependencies: + lodash "^4.17.13" + "@babel/helper-remap-async-to-generator@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" @@ -210,6 +311,16 @@ "@babel/traverse" "^7.3.4" "@babel/types" "^7.3.4" +"@babel/helper-replace-supers@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz#f84ce43df031222d2bad068d2626cb5799c34bc2" + integrity sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.5.5" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + "@babel/helper-simple-access@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" @@ -225,6 +336,13 @@ dependencies: "@babel/types" "^7.0.0" +"@babel/helper-split-export-declaration@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" + integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== + dependencies: + "@babel/types" "^7.4.4" + "@babel/helper-wrap-function@^7.1.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" @@ -244,6 +362,15 @@ "@babel/traverse" "^7.1.5" "@babel/types" "^7.3.0" +"@babel/helpers@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.5.tgz#63908d2a73942229d1e6685bc2a0e730dde3b75e" + integrity sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g== + dependencies: + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + "@babel/highlight@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" @@ -263,6 +390,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.3.tgz#092d450db02bdb6ccb1ca8ffd47d8774a91aef87" integrity sha512-xsH1CJoln2r74hR+y7cg2B5JCPaTh+Hd+EbBRk9nWGSNspuo6krjhX0Om6RnRQuIvFq8wVXCLKH3kwKDYhanSg== +"@babel/parser@^7.4.4", "@babel/parser@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" + integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== + "@babel/plugin-external-helpers@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-external-helpers/-/plugin-external-helpers-7.2.0.tgz#7f4cb7dee651cd380d2034847d914288467a6be4" @@ -287,6 +419,22 @@ "@babel/helper-create-class-features-plugin" "^7.3.4" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-proposal-class-properties@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4" + integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.5.5" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-proposal-dynamic-import@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz#e532202db4838723691b10a67b8ce509e397c506" + integrity sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-proposal-export-default-from@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-default-from/-/plugin-proposal-export-default-from-7.2.0.tgz#737b0da44b9254b6152fe29bb99c64e5691f6f68" @@ -319,6 +467,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" +"@babel/plugin-proposal-object-rest-spread@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" + integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-proposal-optional-catch-binding@^7.0.0", "@babel/plugin-proposal-optional-catch-binding@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" @@ -344,6 +500,15 @@ "@babel/helper-regex" "^7.0.0" regexpu-core "^4.2.0" +"@babel/plugin-proposal-unicode-property-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78" + integrity sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" + "@babel/plugin-syntax-async-generators@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" @@ -358,7 +523,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-dynamic-import@^7.0.0": +"@babel/plugin-syntax-dynamic-import@^7.0.0", "@babel/plugin-syntax-dynamic-import@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== @@ -444,6 +609,15 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-remap-async-to-generator" "^7.1.0" +"@babel/plugin-transform-async-to-generator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" + integrity sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/plugin-transform-block-scoped-functions@^7.0.0", "@babel/plugin-transform-block-scoped-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" @@ -459,6 +633,14 @@ "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.11" +"@babel/plugin-transform-block-scoping@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.5.5.tgz#a35f395e5402822f10d2119f6f8e045e3639a2ce" + integrity sha512-82A3CLRRdYubkG85lKwhZB0WZoHxLGsJdux/cOVaJCJpvYFl1LVzAIFyRsa7CvXqW8rBM4Zf3Bfn8PHt5DP0Sg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.13" + "@babel/plugin-transform-classes@^7.0.0", "@babel/plugin-transform-classes@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.3.4.tgz#dc173cb999c6c5297e0b5f2277fdaaec3739d0cc" @@ -473,6 +655,20 @@ "@babel/helper-split-export-declaration" "^7.0.0" globals "^11.1.0" +"@babel/plugin-transform-classes@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.5.5.tgz#d094299d9bd680a14a2a0edae38305ad60fb4de9" + integrity sha512-U2htCNK/6e9K7jGyJ++1p5XRU+LJjrwtoiVn9SzRlDT2KubcZ11OOwy3s24TjHxPgxNwonCYP7U2K51uVYCMDg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-define-map" "^7.5.5" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-split-export-declaration" "^7.4.4" + globals "^11.1.0" + "@babel/plugin-transform-computed-properties@^7.0.0", "@babel/plugin-transform-computed-properties@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" @@ -487,6 +683,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-destructuring@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" + integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-dotall-regex@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.2.0.tgz#f0aabb93d120a8ac61e925ea0ba440812dbe0e49" @@ -496,6 +699,15 @@ "@babel/helper-regex" "^7.0.0" regexpu-core "^4.1.3" +"@babel/plugin-transform-dotall-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3" + integrity sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" + "@babel/plugin-transform-duplicate-keys@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.2.0.tgz#d952c4930f312a4dbfff18f0b2914e60c35530b3" @@ -503,6 +715,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-duplicate-keys@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" + integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-exponentiation-operator@^7.0.0", "@babel/plugin-transform-exponentiation-operator@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" @@ -526,6 +745,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-for-of@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" + integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-function-name@^7.0.0", "@babel/plugin-transform-function-name@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.2.0.tgz#f7930362829ff99a3174c39f0afcc024ef59731a" @@ -534,6 +760,14 @@ "@babel/helper-function-name" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-function-name@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad" + integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-literals@^7.0.0", "@babel/plugin-transform-literals@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" @@ -541,7 +775,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-member-expression-literals@^7.0.0": +"@babel/plugin-transform-member-expression-literals@^7.0.0", "@babel/plugin-transform-member-expression-literals@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== @@ -556,6 +790,15 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-modules-amd@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" + integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-commonjs@^7.0.0", "@babel/plugin-transform-modules-commonjs@^7.1.0", "@babel/plugin-transform-modules-commonjs@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz#c4f1933f5991d5145e9cfad1dfd848ea1727f404" @@ -565,6 +808,16 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-simple-access" "^7.1.0" +"@babel/plugin-transform-modules-commonjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz#425127e6045231360858eeaa47a71d75eded7a74" + integrity sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ== + dependencies: + "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-systemjs@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.3.4.tgz#813b34cd9acb6ba70a84939f3680be0eb2e58861" @@ -573,6 +826,15 @@ "@babel/helper-hoist-variables" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-modules-systemjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz#e75266a13ef94202db2a0620977756f51d52d249" + integrity sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + "@babel/plugin-transform-modules-umd@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" @@ -588,6 +850,13 @@ dependencies: regexp-tree "^0.1.0" +"@babel/plugin-transform-named-capturing-groups-regex@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106" + integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg== + dependencies: + regexp-tree "^0.1.6" + "@babel/plugin-transform-new-target@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz#ae8fbd89517fa7892d20e6564e641e8770c3aa4a" @@ -595,6 +864,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-new-target@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" + integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-object-assign@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.2.0.tgz#6fdeea42be17040f119e38e23ea0f49f31968bde" @@ -610,6 +886,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.1.0" +"@babel/plugin-transform-object-super@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz#c70021df834073c65eb613b8679cc4a381d1a9f9" + integrity sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/plugin-transform-parameters@^7.0.0", "@babel/plugin-transform-parameters@^7.2.0": version "7.3.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.3.3.tgz#3a873e07114e1a5bee17d04815662c8317f10e30" @@ -619,7 +903,16 @@ "@babel/helper-get-function-arity" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-property-literals@^7.0.0": +"@babel/plugin-transform-parameters@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" + integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== + dependencies: + "@babel/helper-call-delegate" "^7.4.4" + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== @@ -665,6 +958,20 @@ dependencies: regenerator-transform "^0.13.4" +"@babel/plugin-transform-regenerator@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f" + integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA== + dependencies: + regenerator-transform "^0.14.0" + +"@babel/plugin-transform-reserved-words@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" + integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-runtime@^7.0.0": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.3.4.tgz#57805ac8c1798d102ecd75c03b024a5b3ea9b431" @@ -712,6 +1019,14 @@ "@babel/helper-annotate-as-pure" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-template-literals@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" + integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-typeof-symbol@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" @@ -736,15 +1051,24 @@ "@babel/helper-regex" "^7.0.0" regexpu-core "^4.1.3" -"@babel/polyfill@^7.0.0": - version "7.2.5" - resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.2.5.tgz#6c54b964f71ad27edddc567d065e57e87ed7fa7d" - integrity sha512-8Y/t3MWThtMLYr0YNC/Q76tqN1w30+b0uQMeFUYauG2UGTR19zyUtFrAzT23zNtBxPp+LbE5E/nwV/q/r3y6ug== +"@babel/plugin-transform-unicode-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f" + integrity sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA== dependencies: - core-js "^2.5.7" - regenerator-runtime "^0.12.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" + +"@babel/polyfill@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.4.4.tgz#78801cf3dbe657844eeabf31c1cae3828051e893" + integrity sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg== + dependencies: + core-js "^2.6.5" + regenerator-runtime "^0.13.2" -"@babel/preset-env@*", "@babel/preset-env@^7.0.0", "@babel/preset-env@^7.1.0": +"@babel/preset-env@*", "@babel/preset-env@^7.1.0": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.3.4.tgz#887cf38b6d23c82f19b5135298bdb160062e33e1" integrity sha512-2mwqfYMK8weA0g0uBKOt4FE3iEodiHy9/CW0b+nWXcbL+pGzLx8ESYc+j9IIxr6LTDHWKgPm71i9smo02bw+gA== @@ -793,6 +1117,62 @@ js-levenshtein "^1.1.3" semver "^5.3.0" +"@babel/preset-env@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.5.tgz#bc470b53acaa48df4b8db24a570d6da1fef53c9a" + integrity sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.5.5" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.5.5" + "@babel/plugin-transform-classes" "^7.5.5" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.5.0" + "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-duplicate-keys" "^7.5.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.4.4" + "@babel/plugin-transform-function-name" "^7.4.4" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-member-expression-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.5.0" + "@babel/plugin-transform-modules-commonjs" "^7.5.0" + "@babel/plugin-transform-modules-systemjs" "^7.5.0" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" + "@babel/plugin-transform-new-target" "^7.4.4" + "@babel/plugin-transform-object-super" "^7.5.5" + "@babel/plugin-transform-parameters" "^7.4.4" + "@babel/plugin-transform-property-literals" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-reserved-words" "^7.2.0" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.4.4" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.4.4" + "@babel/types" "^7.5.5" + browserslist "^4.6.0" + core-js-compat "^3.1.1" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.5.0" + "@babel/preset-react@*", "@babel/preset-react@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0" @@ -825,6 +1205,18 @@ pirates "^4.0.0" source-map-support "^0.5.9" +"@babel/register@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.5.5.tgz#40fe0d474c8c8587b28d6ae18a03eddad3dac3c1" + integrity sha512-pdd5nNR+g2qDkXZlW1yRCWFlNrAn2PPdnZUB72zjX4l1Vv4fMRRLwyf+n/idFCLI1UgVGboUU8oVziwTBiyNKQ== + dependencies: + core-js "^3.0.0" + find-cache-dir "^2.0.0" + lodash "^4.17.13" + mkdirp "^0.5.1" + pirates "^4.0.0" + source-map-support "^0.5.9" + "@babel/runtime@^7.0.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.3", "@babel/runtime@^7.4.5": version "7.5.4" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.4.tgz#cb7d1ad7c6d65676e66b47186577930465b5271b" @@ -841,6 +1233,15 @@ "@babel/parser" "^7.2.2" "@babel/types" "^7.2.2" +"@babel/template@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" + integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.4.4" + "@babel/types" "^7.4.4" + "@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.1.5", "@babel/traverse@^7.2.2", "@babel/traverse@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.3.4.tgz#1330aab72234f8dea091b08c4f8b9d05c7119e06" @@ -856,7 +1257,22 @@ globals "^11.1.0" lodash "^4.17.11" -"@babel/types@^7.0.0", "@babel/types@^7.1.2", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.3.4": +"@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" + integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.5.5" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.5.5" + "@babel/types" "^7.5.5" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.3.4": version "7.3.4" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.3.4.tgz#bf482eaeaffb367a28abbf9357a94963235d90ed" integrity sha512-WEkp8MsLftM7O/ty580wAmZzN1nDmCACc5+jFzUt+GUFNNIi3LdRlueYz0YIlmJhlZx1QYDMZL5vdWCL0fNjFQ== @@ -865,6 +1281,15 @@ lodash "^4.17.11" to-fast-properties "^2.0.0" +"@babel/types@^7.4.4", "@babel/types@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" + integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + "@cnakazawa/watch@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" @@ -2887,7 +3312,7 @@ axobject-query@^2.0.2: dependencies: ast-types-flow "0.0.7" -babel-code-frame@6.26.0: +babel-code-frame@^6.22.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= @@ -2918,6 +3343,13 @@ babel-loader@^8.0.5: mkdirp "^0.5.1" pify "^4.0.1" +babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== + dependencies: + object.assign "^4.1.0" + babel-plugin-istanbul@^5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.1.tgz#7981590f1956d75d67630ba46f0c22493588c893" @@ -2987,7 +3419,7 @@ babel-runtime@^6.22.0: core-js "^2.4.0" regenerator-runtime "^0.11.0" -babylon@^6.17.4: +babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== @@ -3217,7 +3649,7 @@ bplist-parser@0.1.1: dependencies: big-integer "^1.6.7" -brace-expansion@^1.0.0, brace-expansion@^1.1.7: +brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== @@ -3338,7 +3770,16 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@^4.0.0, browserslist@^4.3.4, browserslist@^4.6.3: +browserslist@4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.5.4.tgz#166c4ecef3b51737a42436ea8002aeea466ea2c7" + integrity sha512-rAjx494LMjqKnMPhFkuLmLp8JWEX0o8ADTGeAbOqaF+XCvYLreZrG5uVjnPBlAQ8REZK4pzXGvp0bWgrFtKaag== + dependencies: + caniuse-lite "^1.0.30000955" + electron-to-chromium "^1.3.122" + node-releases "^1.1.13" + +browserslist@^4.0.0, browserslist@^4.3.4, browserslist@^4.6.0, browserslist@^4.6.2, browserslist@^4.6.3: version "4.6.6" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.6.tgz#6e4bf467cde520bc9dbdf3747dafa03531cec453" integrity sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA== @@ -3573,6 +4014,11 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000984: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000984.tgz#dc96c3c469e9bcfc6ad5bdd24c77ec918ea76fe0" integrity sha512-n5tKOjMaZ1fksIpQbjERuqCyfgec/m9pferkFQbLmWtqLUdmt12hNhjSwsmPdqeiG2NkITOQhr1VYIwWSAceiA== +caniuse-lite@^1.0.30000955: + version "1.0.30000985" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000985.tgz#0eb40f6c8a8c219155cbe43c4975c0efb4a0f77f" + integrity sha512-1ngiwkgqAYPG0JSSUp3PUDGPKKY59EK7NrGGX+VOxaKCNzRbNc7uXMny+c3VJfZxtoK3wSImTvG9T9sXiTw2+w== + capture-exit@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" @@ -3613,7 +4059,7 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: +chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -3681,7 +4127,7 @@ cheerio@^1.0.0-rc.2: lodash "^4.15.0" parse5 "^3.0.1" -chokidar@^2.0.2: +chokidar@^2.0.2, chokidar@^2.0.4: version "2.1.6" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.6.tgz#b6cad653a929e244ce8a834244164d241fa954c5" integrity sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g== @@ -3700,7 +4146,7 @@ chokidar@^2.0.2: optionalDependencies: fsevents "^1.2.7" -chokidar@^3.0.0, chokidar@^3.0.1: +chokidar@^3.0.0, chokidar@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.0.2.tgz#0d1cd6d04eb2df0327446188cd13736a3367d681" integrity sha512-c4PR2egjNjI1um6bamCQ6bUNPDiyofNQruHvKgHQ4gDUP/ITSVSzNsiI5OWtHOsX323i5ha/kk4YmOZ1Ktg7KA== @@ -4221,17 +4667,31 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +core-js-compat@^3.1.1: + version "3.1.4" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.1.4.tgz#e4d0c40fbd01e65b1d457980fe4112d4358a7408" + integrity sha512-Z5zbO9f1d0YrJdoaQhphVAnKPimX92D6z8lCGphH89MNRxlL1prI9ExJPqVwP0/kgkQCv8c4GJGT8X16yUncOg== + dependencies: + browserslist "^4.6.2" + core-js-pure "3.1.4" + semver "^6.1.1" + +core-js-pure@3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.4.tgz#5fa17dc77002a169a3566cc48dc774d2e13e3769" + integrity sha512-uJ4Z7iPNwiu1foygbcZYJsJs1jiXrTTCvxfLDXNhI/I+NHbSIEyr548y4fcsCEyWY0XgfAG/qqaunJ1SThHenA== + core-js@^1.0.0: version "1.2.7" resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= -core-js@^2.2.2, core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.7: +core-js@^2.2.2, core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.7, core-js@^2.6.5: version "2.6.9" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== -core-js@^3.1.3: +core-js@^3.0.0, core-js@^3.1.3: version "3.1.4" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.1.4.tgz#3a2837fc48e582e1ae25907afcd6cf03b0cc7a07" integrity sha512-YNZN8lt82XIMLnLirj9MhKDFZHalwzzrL9YLt6eb0T5D0EDl4IQ90IGkua8mHbnxNrkj1d8hbdizMc0Qmg1WnQ== @@ -4291,16 +4751,7 @@ create-react-class@^15.6.3: loose-envify "^1.3.1" object-assign "^4.1.1" -cross-spawn@5.1.0, cross-spawn@^5.0.1, cross-spawn@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - -cross-spawn@^6.0.0, cross-spawn@^6.0.5: +cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -4311,6 +4762,15 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^5.0.1, cross-spawn@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + crowdin-cli@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/crowdin-cli/-/crowdin-cli-0.3.0.tgz#eac9989a6fe7feaaf33090397afc187c67b46191" @@ -4558,12 +5018,7 @@ dateformat@^3.0.0: resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@0.7.4: - version "0.7.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-0.7.4.tgz#06e1ea8082c2cb14e39806e22e2f6f757f92af39" - integrity sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk= - -debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9: +debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== @@ -4577,13 +5032,20 @@ debug@3.1.0, debug@~3.1.0: dependencies: ms "2.0.0" -debug@3.2.6, debug@^3.1.0, debug@^3.2.6: +debug@3.2.6, debug@^3.1.0, debug@^3.2.5, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" +debug@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87" + integrity sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg== + dependencies: + ms "^2.1.1" + debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" @@ -4684,12 +5146,7 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-is@0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.2.tgz#9ced65ea0bc0b09f42a6d79c1b1903f9d913cc18" - integrity sha1-nO1l6gvAsJ9CptecGxkD+dkTzBg= - -deep-is@~0.1.3: +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= @@ -4878,56 +5335,56 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -docusaurus@^1.10.0: - version "1.11.1" - resolved "https://registry.yarnpkg.com/docusaurus/-/docusaurus-1.11.1.tgz#786bae93946bc21ab7ef457c5672e2e2bd930b25" - integrity sha512-oIdftD4E8dnzXcNohTdE6MICsiJIR1pAmKa/sRHDiG3T3v8f2eiq9nt88CidSIPpyEw50TbCr3bOoExHS90UGg== - dependencies: - "@babel/core" "^7.0.0" - "@babel/plugin-proposal-class-properties" "^7.0.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/polyfill" "^7.0.0" - "@babel/preset-env" "^7.0.0" +docusaurus@^1.12.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/docusaurus/-/docusaurus-1.12.0.tgz#c2b626b95e8b8e5a39b597801c260746ca32fb16" + integrity sha512-C8HUDctWn72JOxqwnP6/+fUUQFADIjNw9Tvgw9CBlXLVN6CUhuTrk3YShM5EjZILjIrcmReoHcy6lCDkCa2X8Q== + dependencies: + "@babel/core" "^7.5.5" + "@babel/plugin-proposal-class-properties" "^7.5.5" + "@babel/plugin-proposal-object-rest-spread" "^7.5.5" + "@babel/polyfill" "^7.4.4" + "@babel/preset-env" "^7.5.5" "@babel/preset-react" "^7.0.0" - "@babel/register" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.1.2" + "@babel/register" "^7.5.5" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" autoprefixer "^9.6.0" - babylon "^6.17.4" + babylon "^6.18.0" chalk "^2.4.2" - chokidar "^3.0.1" + chokidar "^3.0.2" classnames "^2.2.6" color "^2.0.1" commander "^2.20.0" cross-spawn "^6.0.5" crowdin-cli "^0.3.0" cssnano "^4.1.0" - escape-string-regexp "^1.0.5" + escape-string-regexp "^2.0.0" express "^4.17.1" feed "^1.1.0" - fs-extra "^5.0.0" - gaze "^1.1.2" + fs-extra "^8.1.0" + gaze "^1.1.3" glob "^7.1.3" - highlight.js "^9.12.0" + highlight.js "^9.15.8" imagemin "^6.0.0" imagemin-gifsicle "^6.0.1" imagemin-jpegtran "^6.0.0" imagemin-optipng "^6.0.0" imagemin-svgo "^7.0.0" - lodash "^4.17.11" + lodash "^4.17.14" markdown-toc "^1.2.0" mkdirp "^0.5.1" - portfinder "^1.0.17" - postcss "^7.0.1" - prismjs "^1.15.0" - react "^16.5.0" - react-dev-utils "^5.0.2" - react-dom "^16.5.0" + portfinder "^1.0.21" + postcss "^7.0.17" + prismjs "^1.16.0" + react "^16.8.4" + react-dev-utils "^9.0.1" + react-dom "^16.8.4" remarkable "^1.7.1" - request "^2.87.0" + request "^2.88.0" shelljs "^0.8.3" - sitemap "^1.13.0" - tcp-port-used "^0.1.2" + sitemap "^3.2.2" + tcp-port-used "^1.0.1" tiny-lr "^1.1.1" tree-node-cli "^1.2.5" truncate-html "^1.0.1" @@ -5087,6 +5544,11 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= +electron-to-chromium@^1.3.122: + version "1.3.200" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.200.tgz#78fb858b466269e8eb46d31a52562f00c865127f" + integrity sha512-PUurrpyDA74MuAjJRD+79ss5BqJlU3mdArRbuu4wO/dt6jc3Ic/6BDmFJxkdwbfq39cHf/XKm2vW98XSvut9Dg== + electron-to-chromium@^1.3.191: version "1.3.191" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.191.tgz#c451b422cd8b2eab84dedabab5abcae1eaefb6f0" @@ -5334,6 +5796,11 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +escape-string-regexp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + escodegen@^1.9.1: version "1.11.1" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510" @@ -5622,12 +6089,12 @@ events@^3.0.0: resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88" integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA== -eventsource@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-0.1.6.tgz#0acede849ed7dd1ccc32c811bb11b944d4f29232" - integrity sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI= +eventsource@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-1.0.7.tgz#8fbc72c93fcd34088090bc0a4e64f4b5cee6d8d0" + integrity sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ== dependencies: - original ">=0.0.5" + original "^1.0.0" evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" @@ -5725,13 +6192,6 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -expand-tilde@^2.0.0, expand-tilde@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" - integrity sha1-l+gBqgUt8CRU3kawK/YhZCzchQI= - dependencies: - homedir-polyfill "^1.0.1" - express@^4.17.1: version "4.17.1" resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" @@ -5916,7 +6376,7 @@ faye-websocket@~0.10.0: dependencies: websocket-driver ">=0.5.1" -faye-websocket@~0.11.0: +faye-websocket@~0.11.1: version "0.11.3" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.3.tgz#5c0e9a8968e8912c286639fde977a8b209f2508e" integrity sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA== @@ -6073,10 +6533,10 @@ filenamify@^2.0.0: strip-outer "^1.0.0" trim-repeated "^1.0.0" -filesize@3.5.11: - version "3.5.11" - resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.5.11.tgz#1919326749433bb3cf77368bd158caabcc19e9ee" - integrity sha512-ZH7loueKBoDb7yG9esn1U+fgq7BzlzW6NRi5/rMdxIZ05dj7GFD/Xc5rq2CDt5Yq86CyfSYVyx4242QQNZbx1g== +filesize@3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" + integrity sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg== fill-range@^2.1.0: version "2.2.4" @@ -6220,6 +6680,20 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +fork-ts-checker-webpack-plugin@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.1.1.tgz#caf2a210778fb1e171b6993ca0a40f9b6589e3b7" + integrity sha512-gqWAEMLlae/oeVnN6RWCAhesOJMswAN1MaKNqhhjXHV5O0/rTUjWI4UbgQHdlrVbCnb+xLotXmJbBlC66QmpFw== + dependencies: + babel-code-frame "^6.22.0" + chalk "^2.4.1" + chokidar "^2.0.4" + micromatch "^3.1.10" + minimatch "^3.0.4" + semver "^5.6.0" + tapable "^1.0.0" + worker-rpc "^0.1.0" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -6268,15 +6742,6 @@ fs-extra@^1.0.0: jsonfile "^2.1.0" klaw "^1.0.0" -fs-extra@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd" - integrity sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -6286,6 +6751,15 @@ fs-extra@^7.0.0, fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-minipass@^1.2.5: version "1.2.6" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.6.tgz#2c5cc30ded81282bfe8a0d7c7c1853ddeb102c07" @@ -6365,7 +6839,7 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -gaze@^1.1.2: +gaze@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a" integrity sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g== @@ -6570,25 +7044,21 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, gl once "^1.3.0" path-is-absolute "^1.0.0" -global-modules@1.0.0, global-modules@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" - integrity sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg== +global-modules@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" + integrity sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A== dependencies: - global-prefix "^1.0.1" - is-windows "^1.0.1" - resolve-dir "^1.0.0" + global-prefix "^3.0.0" -global-prefix@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-1.0.2.tgz#dbf743c6c14992593c655568cb66ed32c0122ebe" - integrity sha1-2/dDxsFJklk8ZVVoy2btMsASLr4= +global-prefix@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-3.0.0.tgz#fc85f73064df69f50421f47f883fe5b913ba9b97" + integrity sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg== dependencies: - expand-tilde "^2.0.2" - homedir-polyfill "^1.0.1" - ini "^1.3.4" - is-windows "^1.0.1" - which "^1.2.14" + ini "^1.3.5" + kind-of "^6.0.2" + which "^1.3.1" global@^4.3.0: version "4.4.0" @@ -6603,18 +7073,7 @@ globals@^11.1.0, globals@^11.7.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= - dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -globby@^8.0.1: +globby@8.0.2, globby@^8.0.1: version "8.0.2" resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d" integrity sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w== @@ -6627,6 +7086,17 @@ globby@^8.0.1: pify "^3.0.0" slash "^1.0.0" +globby@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" + integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= + dependencies: + array-union "^1.0.1" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + globule@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.1.tgz#5dffb1b191f22d20797a9369b49eab4e9839696d" @@ -6686,7 +7156,7 @@ got@^8.3.1: url-parse-lax "^3.0.0" url-to-options "^1.0.1" -graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9: +graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== @@ -6717,12 +7187,13 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -gzip-size@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-3.0.0.tgz#546188e9bdc337f673772f81660464b389dce520" - integrity sha1-VGGI6b3DN/Zzdy+BZgRks4nc5SA= +gzip-size@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-5.0.0.tgz#a55ecd99222f4c48fd8c01c625ce3b349d0a0e80" + integrity sha512-5iI7omclyqrnWw4XbXAmGhPsABkSIDQonv2K0h61lybgofWa6iZyvrI3r2zsJH4P8Nb64fFVzlvfhs0g7BBxAA== dependencies: duplexer "^0.1.1" + pify "^3.0.0" handlebars@^4.1.0, handlebars@^4.1.2: version "4.1.2" @@ -6858,7 +7329,7 @@ hex-color-regex@^1.1.0: resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== -highlight.js@^9.12.0: +highlight.js@^9.15.8: version "9.15.8" resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.8.tgz#f344fda123f36f1a65490e932cf90569e4999971" integrity sha512-RrapkKQWwE+wKdF73VsOa2RQdIoO3mxwJ4P8mhbI6KYJUraUHRKM5w5zQQKXNk0xNL4UVRdulV9SBJcmzJNzVA== @@ -6877,13 +7348,6 @@ home-or-tmp@^3.0.0: resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb" integrity sha1-V6j+JM8zzdUkhgoVgh3cJchmcfs= -homedir-polyfill@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" - integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== - dependencies: - parse-passwd "^1.0.0" - hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" @@ -7094,6 +7558,11 @@ imagemin@^6.0.0: pify "^4.0.1" replace-ext "^1.0.0" +immer@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/immer/-/immer-1.10.0.tgz#bad67605ba9c810275d91e1c2a47d4582e98286d" + integrity sha512-O3sR1/opvCDGLEVcvrGTMtLac8GJ5IwZC4puPrLuRj3l7ICKvkmA0vGuU9OW8mV9WIBRnaxp5GJh9IEAaNOoYg== + immutable@4.0.0-rc.9: version "4.0.0-rc.9" resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.0.0-rc.9.tgz#1e6e0094e649013ec3742d2b5aeeca5eeda4f0bf" @@ -7191,7 +7660,7 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== @@ -7229,7 +7698,26 @@ inquirer@3.0.6: strip-ansi "^3.0.0" through "^2.3.6" -inquirer@3.3.0, inquirer@^3.0.6: +inquirer@6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" + integrity sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.11" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.0.0" + through "^2.3.6" + +inquirer@^3.0.6: version "3.3.0" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" integrity sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ== @@ -7298,6 +7786,11 @@ invert-kv@^2.0.0: resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== +ip-regex@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" + integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= + ip@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" @@ -7663,10 +8156,10 @@ is-retry-allowed@^1.0.0, is-retry-allowed@^1.1.0: resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" integrity sha1-EaBgVotnM5REAz0BJaYaINVk+zQ= -is-root@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-root/-/is-root-1.0.0.tgz#07b6c233bc394cd9d02ba15c966bd6660d6342d5" - integrity sha1-B7bCM7w5TNnQK6FclmvWZg1jQtU= +is-root@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-root/-/is-root-2.0.0.tgz#838d1e82318144e5a6f77819d90207645acc7019" + integrity sha512-F/pJIk8QD6OX5DNhRB7hWamLsUilmkDGho48KbgZ6xg/lmAZXHxzXQ91jzB3yRSw5kdQGGGc4yz8HYhTYIMWPg== is-ssh@^1.3.0: version "1.3.1" @@ -7716,6 +8209,11 @@ is-typedarray@~1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= +is-url@^1.2.2: + version "1.2.4" + resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.4.tgz#04a4df46d28c4cff3d73d01ff06abeb318a1aa52" + integrity sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww== + is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" @@ -7726,7 +8224,7 @@ is-whitespace-character@^1.0.0: resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.3.tgz#b3ad9546d916d7d3ffa78204bca0c26b56257fac" integrity sha512-SNPgMLz9JzPccD3nPctcj8sZlX9DAMJSKH8bP7Z6bohCwuNgX8xbWr1eTAYXX9Vpi/aSn8Y1akL9WgM3t43YNQ== -is-windows@^1.0.1, is-windows@^1.0.2: +is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== @@ -7741,12 +8239,14 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= -is2@0.0.9: - version "0.0.9" - resolved "https://registry.yarnpkg.com/is2/-/is2-0.0.9.tgz#119556d1d1651a41ba105af803267c80b299f629" - integrity sha1-EZVW0dFlGkG6EFr4AyZ8gLKZ9ik= +is2@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is2/-/is2-2.0.1.tgz#8ac355644840921ce435d94f05d3a94634d3481a" + integrity sha512-+WaJvnaA7aJySz2q/8sLjMb2Mw14KTplHmSwcSpZ/fWJPkUmqw3YTzSWbPJ7OAwRvdYTWF2Wg+yYJ1AdP5Z8CA== dependencies: - deep-is "0.1.2" + deep-is "^0.1.3" + ip-regex "^2.1.0" + is-url "^1.2.2" isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" @@ -8333,7 +8833,7 @@ loader-runner@^2.3.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== -loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3: +loader-utils@1.2.3, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA== @@ -8373,6 +8873,11 @@ lodash.bind@^4.1.4: resolved "https://registry.yarnpkg.com/lodash.bind/-/lodash.bind-4.2.1.tgz#7ae3017e939622ac31b7d7d7dcb1b34db1690d35" integrity sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU= +lodash.chunk@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" + integrity sha1-ZuXOH3btJ7QwPYxlEujRIW6BBrw= + lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" @@ -8448,7 +8953,7 @@ lodash.padend@^4.1.0: resolved "https://registry.yarnpkg.com/lodash.padend/-/lodash.padend-4.6.1.tgz#53ccba047d06e158d311f45da625f4e49e6f166e" integrity sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4= -lodash.padstart@^4.1.0: +lodash.padstart@^4.1.0, lodash.padstart@^4.6.1: version "4.6.1" resolved "https://registry.yarnpkg.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b" integrity sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs= @@ -8518,6 +9023,11 @@ lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17. resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== +lodash@^4.17.13: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + log-symbols@2.2.0, log-symbols@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" @@ -9040,6 +9550,11 @@ metro@0.49.2, metro@^0.49.1: xpipe "^1.0.5" yargs "^9.0.0" +microevent.ts@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/microevent.ts/-/microevent.ts-0.1.1.tgz#70b09b83f43df5172d0205a63025bce0f7357fa0" + integrity sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g== + micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" @@ -9152,13 +9667,6 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" - integrity sha1-Kk5AkLlrLbBqnX3wEFWmKnfJt3Q= - dependencies: - brace-expansion "^1.0.0" - minimatch@3.0.4, minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -9520,6 +10028,13 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" +node-releases@^1.1.13: + version "1.1.26" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.26.tgz#f30563edc5c7dc20cf524cc8652ffa7be0762937" + integrity sha512-fZPsuhhUHMTlfkhDLGtfY80DSJTjOcx+qD1j5pqPkuhUHVS7xHZIg9EE4DHK8O3f0zTxXHX5VIkDG8pu98/wfQ== + dependencies: + semver "^5.3.0" + node-releases@^1.1.25: version "1.1.25" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.25.tgz#0c2d7dbc7fed30fbe02a9ee3007b8c90bf0133d3" @@ -9850,10 +10365,10 @@ opn@4.0.2: object-assign "^4.0.1" pinkie-promise "^2.0.0" -opn@5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/opn/-/opn-5.2.0.tgz#71fdf934d6827d676cecbea1531f95d354641225" - integrity sha512-Jd/GpzPyHF4P2/aNOVmS3lfMSWV9J7cOhCG1s08XCEAsPkB7lp6ddiU0J7XzyQRDUh8BqJ7PchfINjR8jyofRQ== +opn@5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/opn/-/opn-5.4.0.tgz#cb545e7aab78562beb11aa3bfabc7042e1761035" + integrity sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw== dependencies: is-wsl "^1.1.0" @@ -9898,7 +10413,7 @@ optipng-bin@^5.0.0: bin-wrapper "^4.0.0" logalot "^2.0.0" -original@>=0.0.5: +original@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/original/-/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f" integrity sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg== @@ -10180,11 +10695,6 @@ parse-node-version@^1.0.0: resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA== -parse-passwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" - integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= - parse-path@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-4.0.1.tgz#0ec769704949778cb3b8eda5e994c32073a1adff" @@ -10383,6 +10893,13 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" +pkg-up@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" + integrity sha1-yBmscoBZpGHKscOImivjxJoATX8= + dependencies: + find-up "^2.1.0" + platform@^1.3.3: version "1.3.5" resolved "https://registry.yarnpkg.com/platform/-/platform-1.3.5.tgz#fb6958c696e07e2918d2eeda0f0bc9448d733444" @@ -10429,7 +10946,7 @@ pn@^1.1.0: resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== -portfinder@^1.0.17: +portfinder@^1.0.21: version "1.0.21" resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.21.tgz#60e1397b95ac170749db70034ece306b9a27e324" integrity sha512-ESabpDCzmBS3ekHbmpAIiESq3udRsCBGiBZLsC+HgBKv2ezb0R4oG+7RnYEVZ/ZCfhel5Tx3UzdNWA0Lox2QCA== @@ -10781,10 +11298,10 @@ prettylint@^1.0.0: meow "^3.7.0" tslib "^1.8.0" -prismjs@^1.15.0: - version "1.16.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.16.0.tgz#406eb2c8aacb0f5f0f1167930cb83835d10a4308" - integrity sha512-OA4MKxjFZHSvZcisLGe14THYsug/nF6O1f0pAJc0KN0wTyAcLqmsbE+lTGKSpyh+9pEW57+k6pg2AfYR+coyHA== +prismjs@^1.16.0: + version "1.17.1" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.17.1.tgz#e669fcbd4cdd873c35102881c33b14d0d68519be" + integrity sha512-PrEDJAFdUGbOP6xK/UsfkC5ghJsPJviKgnQOoxaDbBjwc8op68Quupwt1DeAFoG8GImPhiKXAvvsH7wDSLsu1Q== optionalDependencies: clipboard "^2.0.0" @@ -10965,11 +11482,6 @@ pure-rand@^1.6.2: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-1.6.2.tgz#90b3ae78efe36f7e6e27bfffedf934f77382e6e6" integrity sha512-HNwHOH63m7kCxe0kWEe5jSLwJiL2N83RUUN8POniFuZS+OsbFcMWlvXgxIU2nwKy2zYG2bQan40WBNK4biYPRg== -q@0.9.7: - version "0.9.7" - resolved "https://registry.yarnpkg.com/q/-/q-0.9.7.tgz#4de2e6cb3b29088c9e4cbc03bf9d42fb96ce2f75" - integrity sha1-TeLmyzspCIyeTLwDv51C+5bOL3U= - q@^1.1.2, q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -11106,28 +11618,35 @@ react-deep-force-update@^1.0.0: resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-1.1.2.tgz#3d2ae45c2c9040cbb1772be52f8ea1ade6ca2ee1" integrity sha512-WUSQJ4P/wWcusaH+zZmbECOk7H5N2pOIl0vzheeornkIMhu+qrNdGFm0bDZLCb0hSF0jf/kH1SgkNGfBdTc4wA== -react-dev-utils@^5.0.2: - version "5.0.3" - resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-5.0.3.tgz#92f97668f03deb09d7fa11ea288832a8c756e35e" - integrity sha512-Mvs6ofsc2xTjeZIrMaIfbXfsPVrbdVy/cVqq6SAacnqfMlcBpDuivhWZ1ODGeJ8HgmyWTLH971PYjj/EPCDVAw== +react-dev-utils@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-9.0.1.tgz#5c03d85a0b2537d0c46af7165c24a7dfb274bef2" + integrity sha512-pnaeMo/Pxel8aZpxk1WwxT3uXxM3tEwYvsjCYn5R7gNxjhN1auowdcLDzFB8kr7rafAj2rxmvfic/fbac5CzwQ== dependencies: + "@babel/code-frame" "7.0.0" address "1.0.3" - babel-code-frame "6.26.0" - chalk "1.1.3" - cross-spawn "5.1.0" + browserslist "4.5.4" + chalk "2.4.2" + cross-spawn "6.0.5" detect-port-alt "1.1.6" escape-string-regexp "1.0.5" - filesize "3.5.11" - global-modules "1.0.0" - gzip-size "3.0.0" - inquirer "3.3.0" - is-root "1.0.0" - opn "5.2.0" - react-error-overlay "^4.0.1" - recursive-readdir "2.2.1" + filesize "3.6.1" + find-up "3.0.0" + fork-ts-checker-webpack-plugin "1.1.1" + global-modules "2.0.0" + globby "8.0.2" + gzip-size "5.0.0" + immer "1.10.0" + inquirer "6.2.2" + is-root "2.0.0" + loader-utils "1.2.3" + opn "5.4.0" + pkg-up "2.0.0" + react-error-overlay "^5.1.6" + recursive-readdir "2.2.2" shell-quote "1.6.1" - sockjs-client "1.1.5" - strip-ansi "3.0.1" + sockjs-client "1.3.0" + strip-ansi "5.2.0" text-table "0.2.0" react-devtools-core@^3.4.2: @@ -11138,7 +11657,7 @@ react-devtools-core@^3.4.2: shell-quote "^1.6.1" ws "^3.3.1" -react-dom@*, react-dom@^16.5.0: +react-dom@*, react-dom@^16.8.4: version "16.8.6" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f" integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA== @@ -11148,10 +11667,10 @@ react-dom@*, react-dom@^16.5.0: prop-types "^15.6.2" scheduler "^0.13.6" -react-error-overlay@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-4.0.1.tgz#417addb0814a90f3a7082eacba7cee588d00da89" - integrity sha512-xXUbDAZkU08aAkjtUvldqbvI04ogv+a1XdHxvYuHPYKIVk/42BIOD0zSKTHAWV4+gDy3yGm283z2072rA2gdtw== +react-error-overlay@^5.1.6: + version "5.1.6" + resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-5.1.6.tgz#0cd73407c5d141f9638ae1e0c63e7b2bf7e9929d" + integrity sha512-X1Y+0jR47ImDVr54Ab6V9eGk0Hnu7fVWGeHQSOXHf/C2pF9c6uy3gef8QUeuUiWlNb0i08InPSE5a/KJzNzw1Q== react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.8.6" @@ -11256,7 +11775,7 @@ react-transform-hmr@^1.0.4: global "^4.3.0" react-proxy "^1.1.7" -react@*, react@^16.5.0: +react@*, react@^16.8.4: version "16.8.6" resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe" integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw== @@ -11432,12 +11951,12 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" -recursive-readdir@2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.1.tgz#90ef231d0778c5ce093c9a48d74e5c5422d13a99" - integrity sha1-kO8jHQd4xc4JPJpI105cVCLROpk= +recursive-readdir@2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.2.tgz#9946fb3274e1628de6e36b2f6714953b4845094f" + integrity sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg== dependencies: - minimatch "3.0.3" + minimatch "3.0.4" redent@^1.0.0: version "1.0.0" @@ -11482,11 +12001,6 @@ regenerator-runtime@^0.11.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.12.0: - version "0.12.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" - integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== - regenerator-runtime@^0.13.2: version "0.13.2" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" @@ -11499,6 +12013,13 @@ regenerator-transform@^0.13.4: dependencies: private "^0.1.6" +regenerator-transform@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" + integrity sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ== + dependencies: + private "^0.1.6" + regex-cache@^0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" @@ -11514,7 +12035,7 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.0: +regexp-tree@^0.1.0, regexp-tree@^0.1.6: version "0.1.11" resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.11.tgz#c9c7f00fcf722e0a56c7390983a7a63dd6c272f3" integrity sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg== @@ -11524,7 +12045,7 @@ regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== -regexpu-core@^4.1.3, regexpu-core@^4.2.0: +regexpu-core@^4.1.3, regexpu-core@^4.2.0, regexpu-core@^4.5.4: version "4.5.4" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== @@ -11678,14 +12199,6 @@ resolve-cwd@^2.0.0: dependencies: resolve-from "^3.0.0" -resolve-dir@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" - integrity sha1-eaQGRMNivoLybv/nOcm7U4IEb0M= - dependencies: - expand-tilde "^2.0.0" - global-modules "^1.0.0" - resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" @@ -11962,6 +12475,11 @@ semver@^6.0.0, semver@^6.2.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== +semver@^6.1.1: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -12108,13 +12626,15 @@ sisteransi@^1.0.0: resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.2.tgz#ec57d64b6f25c4f26c0e2c7dd23f2d7f12f7e418" integrity sha512-ZcYcZcT69nSLAR2oLN2JwNmLkJEKGooFMCdvOkFrToUt/WfcRWqhIg4P4KwY4dmLbuyXIx4o4YmPsvMRJYJd/w== -sitemap@^1.13.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/sitemap/-/sitemap-1.13.0.tgz#569cbe2180202926a62a266cd3de09c9ceb43f83" - integrity sha1-Vpy+IYAgKSamKiZs094Jyc60P4M= +sitemap@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/sitemap/-/sitemap-3.2.2.tgz#3f77c358fa97b555c879e457098e39910095c62b" + integrity sha512-TModL/WU4m2q/mQcrDgNANn0P4LwprM9MMvG4hu5zP4c6IIKs2YLTu6nXXnNr8ODW/WFtxKggiJ1EGn2W0GNmg== dependencies: - underscore "^1.7.0" - url-join "^1.1.0" + lodash.chunk "^4.2.0" + lodash.padstart "^4.6.1" + whatwg-url "^7.0.0" + xmlbuilder "^13.0.0" slash@^1.0.0: version "1.0.0" @@ -12221,17 +12741,17 @@ socket.io@2.1.1: socket.io-client "2.1.1" socket.io-parser "~3.2.0" -sockjs-client@1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.1.5.tgz#1bb7c0f7222c40f42adf14f4442cbd1269771a83" - integrity sha1-G7fA9yIsQPQq3xT0RCy9Eml3GoM= +sockjs-client@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/sockjs-client/-/sockjs-client-1.3.0.tgz#12fc9d6cb663da5739d3dc5fb6e8687da95cb177" + integrity sha512-R9jxEzhnnrdxLCNln0xg5uGHqMnkhPSTzUZH2eXcR03S/On9Yvoq2wyUZILRUhZCNVu2PmwWVoyuiPz8th8zbg== dependencies: - debug "^2.6.6" - eventsource "0.1.6" - faye-websocket "~0.11.0" - inherits "^2.0.1" + debug "^3.2.5" + eventsource "^1.0.7" + faye-websocket "~0.11.1" + inherits "^2.0.3" json3 "^3.3.2" - url-parse "^1.1.8" + url-parse "^1.4.3" socks-proxy-agent@^4.0.0: version "4.0.2" @@ -12561,7 +13081,14 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -strip-ansi@3.0.1, strip-ansi@^3.0.0, strip-ansi@^3.0.1: +strip-ansi@5.2.0, strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= @@ -12575,13 +13102,6 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" - integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== - dependencies: - ansi-regex "^4.1.0" - strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -12744,14 +13264,13 @@ tar@^4, tar@^4.4.10, tar@^4.4.8: safe-buffer "^5.1.2" yallist "^3.0.3" -tcp-port-used@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/tcp-port-used/-/tcp-port-used-0.1.2.tgz#9450e8768c83b416fd4d1a6a9449eeccbf496c29" - integrity sha1-lFDodoyDtBb9TRpqlEnuzL9JbCk= +tcp-port-used@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tcp-port-used/-/tcp-port-used-1.0.1.tgz#46061078e2d38c73979a2c2c12b5a674e6689d70" + integrity sha512-rwi5xJeU6utXoEIiMvVBMc9eJ2/ofzB+7nLOdnZuFTmNCLqRiQh2sMG9MqCxHU/69VC/Fwp5dV9306Qd54ll1Q== dependencies: - debug "0.7.4" - is2 "0.0.9" - q "0.9.7" + debug "4.1.0" + is2 "2.0.1" teeny-request@^3.11.3: version "3.11.3" @@ -13182,11 +13701,6 @@ underscore.string@~2.4.0: resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-2.4.0.tgz#8cdd8fbac4e2d2ea1e7e2e8097c42f442280f85b" integrity sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs= -underscore@^1.7.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.1.tgz#06dce34a0e68a7babc29b365b8e74b8925203961" - integrity sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg== - underscore@~1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209" @@ -13347,11 +13861,6 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -url-join@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/url-join/-/url-join-1.1.0.tgz#741c6c2f4596c4830d6718460920d0c92202dc78" - integrity sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg= - url-parse-lax@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" @@ -13366,7 +13875,7 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.0.0" -url-parse@^1.1.8, url-parse@^1.4.3: +url-parse@^1.4.3: version "1.4.7" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg== @@ -13685,7 +14194,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@1.3.1, which@^1.2.1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@1.3.1, which@^1.2.1, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== @@ -13728,6 +14237,13 @@ worker-farm@^1.6.0, worker-farm@^1.7.0: dependencies: errno "~0.1.7" +worker-rpc@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/worker-rpc/-/worker-rpc-0.1.1.tgz#cb565bd6d7071a8f16660686051e969ad32f54d5" + integrity sha512-P1WjMrUB3qgJNI9jfmpZ/htmBEjFh//6l/5y8SD9hg1Ef5zTTVVoRjTrTEzPrNBQvmhMxkoTsjOXN10GWU7aCg== + dependencies: + microevent.ts "~0.1.1" + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -13856,6 +14372,11 @@ xmlbuilder@8.2.2: resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-8.2.2.tgz#69248673410b4ba42e1a6136551d2922335aa773" integrity sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M= +xmlbuilder@^13.0.0: + version "13.0.2" + resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-13.0.2.tgz#02ae33614b6a047d1c32b5389c1fdacb2bce47a7" + integrity sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ== + xmlbuilder@^9.0.7: version "9.0.7" resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" From f440ded8d0f5fb7cef427a4535118c3549e257a1 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 26 Jul 2019 22:23:41 +0200 Subject: [PATCH 06/34] add filename for obsolete snapshot file (#8665) * add a reproduction to my issue * ADD filesRemovedList property to snapshotSummary & display this in the CLI report * ADD tests * ADD to changelog * FIX unit tests & add a null-check before getting the array length of new property filesRemovedList * chore: run with default reporter to debug ci * simplify cleanup function of jest-snapshot * chore: use filter over reduce * chore: only report obsolete snapshots of non-ignored tests * Revert "chore: run with default reporter to debug ci" This reverts commit d2ff007f38046d74cf51e2302908ea42d74933ca. * Update CHANGELOG.md * get rid of unnecessary array spread --- CHANGELOG.md | 1 + e2e/__tests__/snapshot-unknown.test.ts | 20 ++++++++++++ .../__snapshots__/fails.test.js.snap | 3 ++ .../__snapshots__/fails2.test.js.snap | 3 ++ .../__snapshots__/works.test.js.snap | 3 ++ e2e/snapshot-unknown/__tests__/works.test.js | 14 +++++++++ e2e/snapshot-unknown/package.json | 5 +++ packages/jest-core/src/TestScheduler.ts | 4 +++ .../__tests__/get_snapshot_summary.test.js | 4 +++ .../src/__tests__/summary_reporter.test.js | 3 ++ .../src/get_snapshot_summary.ts | 8 +++++ packages/jest-snapshot/src/index.ts | 31 ++++++++++++++----- packages/jest-test-result/src/helpers.ts | 1 + packages/jest-test-result/src/types.ts | 1 + 14 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 e2e/__tests__/snapshot-unknown.test.ts create mode 100644 e2e/snapshot-unknown/__tests__/__snapshots__/fails.test.js.snap create mode 100644 e2e/snapshot-unknown/__tests__/__snapshots__/fails2.test.js.snap create mode 100644 e2e/snapshot-unknown/__tests__/__snapshots__/works.test.js.snap create mode 100644 e2e/snapshot-unknown/__tests__/works.test.js create mode 100644 e2e/snapshot-unknown/package.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 208b90faf636..52487eeaf581 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - `[expect]` Improve report when mock-spy matcher fails, part 4 ([#8710](https://github.com/facebook/jest/pull/8710)) - `[expect]` Throw matcher error when received cannot be jasmine spy ([#8747](https://github.com/facebook/jest/pull/8747)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) +- `[jest-core]` Improve report when snapshots are obsolete ([#8448](https://github.com/facebook/jest/pull/8665)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) - `[*]` Manage the global timeout with `--testTimeout` command line argument. ([#8456](https://github.com/facebook/jest/pull/8456)) - `[pretty-format]` Render custom displayName of memoized components diff --git a/e2e/__tests__/snapshot-unknown.test.ts b/e2e/__tests__/snapshot-unknown.test.ts new file mode 100644 index 000000000000..b1697cae7077 --- /dev/null +++ b/e2e/__tests__/snapshot-unknown.test.ts @@ -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. + */ + +import runJest from '../runJest'; + +describe('Snapshot serializers', () => { + it('renders snapshot', () => { + const result = runJest('snapshot-unknown', ['-w=1']); + const stderr = result.stderr; + + expect(stderr).toMatch('2 snapshot files obsolete'); + expect(stderr).toMatch('__tests__/__snapshots__/fails.test.js.snap'); + expect(stderr).toMatch('__tests__/__snapshots__/fails2.test.js.snap'); + expect(result.status).toBe(1); + }); +}); diff --git a/e2e/snapshot-unknown/__tests__/__snapshots__/fails.test.js.snap b/e2e/snapshot-unknown/__tests__/__snapshots__/fails.test.js.snap new file mode 100644 index 000000000000..2c4c1a181285 --- /dev/null +++ b/e2e/snapshot-unknown/__tests__/__snapshots__/fails.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`snapshot this one makes not toMatchSnapshot assertion, but has a .snap file 1`] = `"normal"`; diff --git a/e2e/snapshot-unknown/__tests__/__snapshots__/fails2.test.js.snap b/e2e/snapshot-unknown/__tests__/__snapshots__/fails2.test.js.snap new file mode 100644 index 000000000000..2c4c1a181285 --- /dev/null +++ b/e2e/snapshot-unknown/__tests__/__snapshots__/fails2.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`snapshot this one makes not toMatchSnapshot assertion, but has a .snap file 1`] = `"normal"`; diff --git a/e2e/snapshot-unknown/__tests__/__snapshots__/works.test.js.snap b/e2e/snapshot-unknown/__tests__/__snapshots__/works.test.js.snap new file mode 100644 index 000000000000..2a8b56674496 --- /dev/null +++ b/e2e/snapshot-unknown/__tests__/__snapshots__/works.test.js.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`snapshot some snapshots exists and are fine 1`] = `"normal"`; diff --git a/e2e/snapshot-unknown/__tests__/works.test.js b/e2e/snapshot-unknown/__tests__/works.test.js new file mode 100644 index 000000000000..a02cba20cbef --- /dev/null +++ b/e2e/snapshot-unknown/__tests__/works.test.js @@ -0,0 +1,14 @@ +/** + * 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'; + +describe('snapshot', () => { + it('some snapshots exists and are fine', () => { + expect('normal').toMatchSnapshot(); + }); +}); diff --git a/e2e/snapshot-unknown/package.json b/e2e/snapshot-unknown/package.json new file mode 100644 index 000000000000..148788b25446 --- /dev/null +++ b/e2e/snapshot-unknown/package.json @@ -0,0 +1,5 @@ +{ + "jest": { + "testEnvironment": "node" + } +} diff --git a/packages/jest-core/src/TestScheduler.ts b/packages/jest-core/src/TestScheduler.ts index ff29bde939b2..bce8ca39125d 100644 --- a/packages/jest-core/src/TestScheduler.ts +++ b/packages/jest-core/src/TestScheduler.ts @@ -145,9 +145,13 @@ export default class TestScheduler { context.hasteFS, this._globalConfig.updateSnapshot, snapshot.buildSnapshotResolver(context.config), + context.config.testPathIgnorePatterns, ); aggregatedResults.snapshot.filesRemoved += status.filesRemoved; + aggregatedResults.snapshot.filesRemovedList = ( + aggregatedResults.snapshot.filesRemovedList || [] + ).concat(status.filesRemovedList); }); const updateAll = this._globalConfig.updateSnapshot === 'all'; aggregatedResults.snapshot.didUpdate = updateAll; diff --git a/packages/jest-reporters/src/__tests__/get_snapshot_summary.test.js b/packages/jest-reporters/src/__tests__/get_snapshot_summary.test.js index c2a911d22365..fb76b156b1e2 100644 --- a/packages/jest-reporters/src/__tests__/get_snapshot_summary.test.js +++ b/packages/jest-reporters/src/__tests__/get_snapshot_summary.test.js @@ -21,6 +21,7 @@ test('creates a snapshot summary', () => { didUpdate: false, filesAdded: 1, filesRemoved: 1, + filesRemovedList: [], filesUnmatched: 1, filesUpdated: 1, matched: 2, @@ -49,6 +50,7 @@ test('creates a snapshot summary after an update', () => { didUpdate: true, filesAdded: 1, filesRemoved: 1, + filesRemovedList: [], filesUnmatched: 1, filesUpdated: 1, unchecked: 1, @@ -75,6 +77,7 @@ it('creates a snapshot summary with multiple snapshot being written/updated', () didUpdate: false, filesAdded: 2, filesRemoved: 2, + filesRemovedList: [], filesUnmatched: 2, filesUpdated: 2, unchecked: 2, @@ -105,6 +108,7 @@ it('returns nothing if there are no updates', () => { didUpdate: false, filesAdded: 0, filesRemoved: 0, + filesRemovedList: [], filesUnmatched: 0, filesUpdated: 0, unchecked: 0, diff --git a/packages/jest-reporters/src/__tests__/summary_reporter.test.js b/packages/jest-reporters/src/__tests__/summary_reporter.test.js index b4b56758a6c7..ead47477fc61 100644 --- a/packages/jest-reporters/src/__tests__/summary_reporter.test.js +++ b/packages/jest-reporters/src/__tests__/summary_reporter.test.js @@ -70,6 +70,7 @@ test('snapshots needs update with yarn test', () => { numTotalTestSuites: 1, numTotalTests: 1, snapshot: { + filesRemovedList: [], filesUnmatched: 1, total: 2, uncheckedKeysByFile: [], @@ -98,6 +99,7 @@ test('snapshots all have results (no update)', () => { didUpdate: false, filesAdded: 1, filesRemoved: 1, + filesRemovedList: [], filesUnmatched: 1, filesUpdated: 1, matched: 2, @@ -134,6 +136,7 @@ test('snapshots all have results (after update)', () => { didUpdate: true, filesAdded: 1, filesRemoved: 1, + filesRemovedList: [], filesUnmatched: 1, filesUpdated: 1, matched: 2, diff --git a/packages/jest-reporters/src/get_snapshot_summary.ts b/packages/jest-reporters/src/get_snapshot_summary.ts index 902cb79b7034..214963b0edf4 100644 --- a/packages/jest-reporters/src/get_snapshot_summary.ts +++ b/packages/jest-reporters/src/get_snapshot_summary.ts @@ -84,6 +84,14 @@ export default ( ); } } + if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) { + const [head, ...tail] = snapshots.filesRemovedList; + summary.push(` ${DOWN_ARROW} ${DOT}${formatTestPath(globalConfig, head)}`); + + tail.forEach(key => { + summary.push(` ${DOT}${formatTestPath(globalConfig, key)}`); + }); + } if (snapshots.unchecked) { if (snapshots.didUpdate) { diff --git a/packages/jest-snapshot/src/index.ts b/packages/jest-snapshot/src/index.ts index dd9978d1acb5..a6de3a1a9ddd 100644 --- a/packages/jest-snapshot/src/index.ts +++ b/packages/jest-snapshot/src/index.ts @@ -122,22 +122,39 @@ const cleanup = ( hasteFS: HasteFS, update: Config.SnapshotUpdateState, snapshotResolver: JestSnapshotResolver, -) => { + testPathIgnorePatterns?: Config.ProjectConfig['testPathIgnorePatterns'], +): { + filesRemoved: number; + filesRemovedList: Array; +} => { const pattern = '\\.' + EXTENSION + '$'; const files = hasteFS.matchFiles(pattern); - const filesRemoved = files.reduce((acc, snapshotFile) => { - if (!fileExists(snapshotResolver.resolveTestPath(snapshotFile), hasteFS)) { + let testIgnorePatternsRegex: RegExp | null = null; + if (testPathIgnorePatterns && testPathIgnorePatterns.length > 0) { + testIgnorePatternsRegex = new RegExp(testPathIgnorePatterns.join('|')); + } + + const list = files.filter(snapshotFile => { + const testPath = snapshotResolver.resolveTestPath(snapshotFile); + + // ignore snapshots of ignored tests + if (testIgnorePatternsRegex && testIgnorePatternsRegex.test(testPath)) { + return false; + } + + if (!fileExists(testPath, hasteFS)) { if (update === 'all') { fs.unlinkSync(snapshotFile); } - return acc + 1; + return true; } - return acc; - }, 0); + return false; + }); return { - filesRemoved, + filesRemoved: list.length, + filesRemovedList: list, }; }; diff --git a/packages/jest-test-result/src/helpers.ts b/packages/jest-test-result/src/helpers.ts index 202cd2bf6e8c..6020142861bc 100644 --- a/packages/jest-test-result/src/helpers.ts +++ b/packages/jest-test-result/src/helpers.ts @@ -27,6 +27,7 @@ export const makeEmptyAggregatedTestResult = (): AggregatedResult => ({ filesAdded: 0, // combines individual test results + removed files after the full run filesRemoved: 0, + filesRemovedList: [], filesUnmatched: 0, filesUpdated: 0, matched: 0, diff --git a/packages/jest-test-result/src/types.ts b/packages/jest-test-result/src/types.ts index e9acdc40fc86..a9427cd7abb2 100644 --- a/packages/jest-test-result/src/types.ts +++ b/packages/jest-test-result/src/types.ts @@ -181,6 +181,7 @@ export type SnapshotSummary = { failure: boolean; filesAdded: number; filesRemoved: number; + filesRemovedList: Array; filesUnmatched: number; filesUpdated: number; matched: number; From 8902dbe77f73a03f3324f816f5a780844e7f8dcf Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Sat, 27 Jul 2019 05:21:38 -0300 Subject: [PATCH 07/34] [docs] changed react-testing-library package name to @testing-library/react (#8753) --- .circleci/config.yml | 4 +- CHANGELOG.md | 1 + docs/TutorialReact.md | 2 +- .../__tests__/CheckboxWithLabel-test.js | 2 +- examples/react-testing-library/package.json | 4 +- .../version-24.0/TutorialReact.md | 2 +- .../version-24.8/TutorialReact.md | 2 +- yarn.lock | 49 ++++++++++--------- 8 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cf29628f4b33..4b00c42135d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,8 +41,8 @@ jobs: - run: *install - save-cache: *save-cache - run: - # react-native does not work with node 6 - command: rm -rf examples/react-native && yarn test-ci-partial + # react-native and react-testing-library do not work with node 6 + command: rm -rf examples/react-native examples/react-testing-library && yarn test-ci-partial - store_test_results: path: reports/junit diff --git a/CHANGELOG.md b/CHANGELOG.md index 52487eeaf581..64375e1d65d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - `[docs]` Add information about using `jest.doMock` with ES6 imports ([#8573](https://github.com/facebook/jest/pull/8573)) - `[docs]` Fix variable name in custom-matcher-api code example ([#8582](https://github.com/facebook/jest/pull/8582)) - `[docs]` Fix example used in custom environment docs ([#8617](https://github.com/facebook/jest/pull/8617)) +- `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753)) - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) ### Performance diff --git a/docs/TutorialReact.md b/docs/TutorialReact.md index 97e6e93ea421..a24fa8a33ff7 100644 --- a/docs/TutorialReact.md +++ b/docs/TutorialReact.md @@ -212,7 +212,7 @@ If you'd like to assert, and manipulate your rendered components you can use [re #### react-testing-library -You have to run `yarn add --dev react-testing-library` to use react-testing-library. +You have to run `yarn add --dev @testing-library/react` to use react-testing-library. Let's implement a simple checkbox which swaps between two labels: diff --git a/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js b/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js index cd3cf4832b94..190e3fec0d34 100644 --- a/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js +++ b/examples/react-testing-library/__tests__/CheckboxWithLabel-test.js @@ -1,7 +1,7 @@ // Copyright 2004-present Facebook. All Rights Reserved. import React from 'react'; -import {render, fireEvent, cleanup} from 'react-testing-library'; +import {render, fireEvent, cleanup} from '@testing-library/react'; import CheckboxWithLabel from '../CheckboxWithLabel'; // automatically unmount and cleanup DOM after the test is finished. diff --git a/examples/react-testing-library/package.json b/examples/react-testing-library/package.json index 271f352011a9..6f5ca6db0820 100644 --- a/examples/react-testing-library/package.json +++ b/examples/react-testing-library/package.json @@ -11,9 +11,9 @@ "@babel/plugin-proposal-class-properties": "*", "@babel/preset-env": "*", "@babel/preset-react": "*", + "@testing-library/react": "*", "babel-jest": "*", - "jest": "*", - "react-testing-library": "*" + "jest": "*" }, "scripts": { "test": "jest" diff --git a/website/versioned_docs/version-24.0/TutorialReact.md b/website/versioned_docs/version-24.0/TutorialReact.md index a398d5705e94..4268ca9ceb95 100644 --- a/website/versioned_docs/version-24.0/TutorialReact.md +++ b/website/versioned_docs/version-24.0/TutorialReact.md @@ -213,7 +213,7 @@ If you'd like to assert, and manipulate your rendered components you can use [re #### react-testing-library -You have to run `yarn add --dev react-testing-library` to use react-testing-library. +You have to run `yarn add --dev @testing-library/react` to use react-testing-library. Let's implement a simple checkbox which swaps between two labels: diff --git a/website/versioned_docs/version-24.8/TutorialReact.md b/website/versioned_docs/version-24.8/TutorialReact.md index 2c2c38bc044a..acf28a84e09d 100644 --- a/website/versioned_docs/version-24.8/TutorialReact.md +++ b/website/versioned_docs/version-24.8/TutorialReact.md @@ -213,7 +213,7 @@ If you'd like to assert, and manipulate your rendered components you can use [re #### react-testing-library -You have to run `yarn add --dev react-testing-library` to use react-testing-library. +You have to run `yarn add --dev @testing-library/react` to use react-testing-library. Let's implement a simple checkbox which swaps between two labels: diff --git a/yarn.lock b/yarn.lock index 0423551f06b9..18612e815ce4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1217,10 +1217,10 @@ pirates "^4.0.0" source-map-support "^0.5.9" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.3", "@babel/runtime@^7.4.5": - version "7.5.4" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.4.tgz#cb7d1ad7c6d65676e66b47186577930465b5271b" - integrity sha512-Na84uwyImZZc3FKf4aUF1tysApzwf3p2yuFBIyBfbzT5glzKTdvYI4KVW4kcgjrzoGUjC7w3YyCHcJKaRxsr2Q== +"@babel/runtime@^7.0.0", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.4": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" + integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== dependencies: regenerator-runtime "^0.13.2" @@ -2124,6 +2124,25 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd" integrity sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow== +"@testing-library/dom@^5.5.4": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-5.6.0.tgz#18a7c162a6a79964e731ad7b810022a28218047c" + integrity sha512-nAsRvQLr/b6TGNjuHMEbWXCNPLrQYnzqa/KKQZL7wBOtfptUxsa4Ah9aqkHW0ZmCSFmUDj4nFUxWPVTeMu0iCw== + dependencies: + "@babel/runtime" "^7.4.5" + "@sheerun/mutationobserver-shim" "^0.3.2" + aria-query "3.0.0" + pretty-format "^24.8.0" + wait-for-expect "^1.2.0" + +"@testing-library/react@*": + version "8.0.7" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-8.0.7.tgz#b5992c9156e926850a0e3a7c882ae1aed83b1c77" + integrity sha512-6XoeWSr3UCdxMswbkW0BmuXYw8a6w+stt+5gg4D4zAcljfhXETQ5o28bjJFwNab4OPg8gBNK8KIVot86L4Q8Vg== + dependencies: + "@babel/runtime" "^7.5.4" + "@testing-library/dom" "^5.5.4" + "@types/ansi-escapes@^3.0.0", "@types/ansi-escapes@^3.0.1": version "3.0.1" resolved "https://registry.yarnpkg.com/@types/ansi-escapes/-/ansi-escapes-3.0.1.tgz#328e46c6ac3177ca4cf2efdeed326cf77da01ef7" @@ -3031,7 +3050,7 @@ argv@^0.0.2: resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab" integrity sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas= -aria-query@^3.0.0: +aria-query@3.0.0, aria-query@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" integrity sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w= @@ -5407,16 +5426,6 @@ dom-serializer@0, dom-serializer@~0.1.0, dom-serializer@~0.1.1: domelementtype "^1.3.0" entities "^1.1.1" -dom-testing-library@^3.13.1: - version "3.19.4" - resolved "https://registry.yarnpkg.com/dom-testing-library/-/dom-testing-library-3.19.4.tgz#f5b737f59ee9749a4568fa353f1f59be97c888c3" - integrity sha512-GJOx8CLpnkvM3takILOsld/itUUc9+7Qh6caN1Spj6+9jIgNPY36fsvoH7sEgYokC0lBRdttO7G7fIFYCXlmcA== - dependencies: - "@babel/runtime" "^7.4.3" - "@sheerun/mutationobserver-shim" "^0.3.2" - pretty-format "^24.7.0" - wait-for-expect "^1.1.1" - dom-walk@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" @@ -11759,14 +11768,6 @@ react-test-renderer@*, react-test-renderer@^16.0.0-0: react-is "^16.8.6" scheduler "^0.13.6" -react-testing-library@*: - version "6.0.0" - resolved "https://registry.yarnpkg.com/react-testing-library/-/react-testing-library-6.0.0.tgz#81edfcfae8a795525f48685be9bf561df45bb35d" - integrity sha512-h0h+YLe4KWptK6HxOMnoNN4ngu3W8isrwDmHjPC5gxc+nOZOCurOvbKVYCvvuAw91jdO7VZSm/5KR7TxKnz0qA== - dependencies: - "@babel/runtime" "^7.3.1" - dom-testing-library "^3.13.1" - react-transform-hmr@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/react-transform-hmr/-/react-transform-hmr-1.0.4.tgz#e1a40bd0aaefc72e8dfd7a7cda09af85066397bb" @@ -14036,7 +14037,7 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" -wait-for-expect@^1.1.1: +wait-for-expect@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-1.2.0.tgz#fdab6a26e87d2039101db88bff3d8158e5c3e13f" integrity sha512-EJhKpA+5UHixduMBEGhTFuLuVgQBKWxkFbefOdj2bbk2/OpA5Opsc4aUTGmF+qJ+v3kTGxDRNYwKaT4j6g5n8Q== From da05da4db7dbe6dd15791f5831113e3ce7c51cfb Mon Sep 17 00:00:00 2001 From: Joana Deluca Kleis Date: Sat, 27 Jul 2019 14:03:17 -0300 Subject: [PATCH 08/34] [docs] Updated react-testing-library imports in website (#8757) --- CHANGELOG.md | 1 + docs/TutorialReact.md | 2 +- website/versioned_docs/version-24.0/TutorialReact.md | 2 +- website/versioned_docs/version-24.8/TutorialReact.md | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64375e1d65d9..fbe84a49aa01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - `[docs]` Fix variable name in custom-matcher-api code example ([#8582](https://github.com/facebook/jest/pull/8582)) - `[docs]` Fix example used in custom environment docs ([#8617](https://github.com/facebook/jest/pull/8617)) - `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753)) +- `[docs]` Updated imports of react-testing-library to @testing-library/react in website ([#8757](https://github.com/facebook/jest/pull/8757)) - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) ### Performance diff --git a/docs/TutorialReact.md b/docs/TutorialReact.md index a24fa8a33ff7..fd92ccbf5f5c 100644 --- a/docs/TutorialReact.md +++ b/docs/TutorialReact.md @@ -253,7 +253,7 @@ export default class CheckboxWithLabel extends React.Component { ```javascript // __tests__/CheckboxWithLabel-test.js import React from 'react'; -import {render, fireEvent, cleanup} from 'react-testing-library'; +import {render, fireEvent, cleanup} from '@testing-library/react'; import CheckboxWithLabel from '../CheckboxWithLabel'; // automatically unmount and cleanup DOM after the test is finished. diff --git a/website/versioned_docs/version-24.0/TutorialReact.md b/website/versioned_docs/version-24.0/TutorialReact.md index 4268ca9ceb95..38fc7a6a91a5 100644 --- a/website/versioned_docs/version-24.0/TutorialReact.md +++ b/website/versioned_docs/version-24.0/TutorialReact.md @@ -254,7 +254,7 @@ export default class CheckboxWithLabel extends React.Component { ```javascript // __tests__/CheckboxWithLabel-test.js import React from 'react'; -import {render, fireEvent, cleanup} from 'react-testing-library'; +import {render, fireEvent, cleanup} from '@testing-library/react'; import CheckboxWithLabel from '../CheckboxWithLabel'; // automatically unmount and cleanup DOM after the test is finished. diff --git a/website/versioned_docs/version-24.8/TutorialReact.md b/website/versioned_docs/version-24.8/TutorialReact.md index acf28a84e09d..abe47abebf7d 100644 --- a/website/versioned_docs/version-24.8/TutorialReact.md +++ b/website/versioned_docs/version-24.8/TutorialReact.md @@ -254,7 +254,7 @@ export default class CheckboxWithLabel extends React.Component { ```javascript // __tests__/CheckboxWithLabel-test.js import React from 'react'; -import {render, fireEvent, cleanup} from 'react-testing-library'; +import {render, fireEvent, cleanup} from '@testing-library/react'; import CheckboxWithLabel from '../CheckboxWithLabel'; // automatically unmount and cleanup DOM after the test is finished. From dcc1918792545277b04e649a68460877bf202181 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 28 Jul 2019 00:35:28 +0530 Subject: [PATCH 09/34] refactor: Extract transform code to @jest-transform (#8756) --- CHANGELOG.md | 1 + packages/jest-core/package.json | 1 - packages/jest-core/src/runGlobalHook.ts | 49 ++++--------------- packages/jest-transform/package.json | 1 + .../jest-transform/src/ScriptTransformer.ts | 44 +++++++++++++++++ 5 files changed, 55 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbe84a49aa01..e92a2f5d7cc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - `[jest-validate]` Allow `maxWorkers` as part of the `jest.config.js` ([#8565](https://github.com/facebook/jest/pull/8565)) - `[jest-runtime]` Allow passing configuration objects to transformers ([#7288](https://github.com/facebook/jest/pull/7288)) - `[@jest/core, @jest/test-sequencer]` Support async sort in custom `testSequencer` ([#8642](https://github.com/facebook/jest/pull/8642)) +- `[@jest-transform]` Extract transforming require logic within `jest-core` into `@jest-transform` ([#8756](https://github.com/facebook/jest/pull/8756)) ### Fixes diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 7986a583c215..89a8a31d4177 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -29,7 +29,6 @@ "jest-watcher": "^24.8.0", "micromatch": "^3.1.10", "p-each-series": "^1.0.0", - "pirates": "^4.0.1", "realpath-native": "^1.1.0", "rimraf": "^2.5.4", "slash": "^2.0.0", diff --git a/packages/jest-core/src/runGlobalHook.ts b/packages/jest-core/src/runGlobalHook.ts index 6b20792ba019..f0490863c924 100644 --- a/packages/jest-core/src/runGlobalHook.ts +++ b/packages/jest-core/src/runGlobalHook.ts @@ -5,9 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {extname} from 'path'; import pEachSeries from 'p-each-series'; -import {addHook} from 'pirates'; import {Config} from '@jest/types'; import {Test} from 'jest-runner'; import {ScriptTransformer} from '@jest/transform'; @@ -47,46 +45,17 @@ export default async ({ const transformer = new ScriptTransformer(projectConfig); - // Load the transformer to avoid a cycle where we need to load a - // transformer in order to transform it in the require hooks - transformer.preloadTransformer(modulePath); + await transformer.requireAndTranspileModule(modulePath, async m => { + const globalModule = interopRequireDefault(m).default; - let transforming = false; - const revertHook = addHook( - (code, filename) => { - try { - transforming = true; - return ( - transformer.transformSource(filename, code, false).code || code - ); - } finally { - transforming = false; - } - }, - { - exts: [extname(modulePath)], - ignoreNodeModules: false, - matcher: (...args) => { - if (transforming) { - // Don't transform any dependency required by the transformer itself - return false; - } - return transformer.shouldTransform(...args); - }, - }, - ); - - const globalModule = interopRequireDefault(require(modulePath)).default; - - if (typeof globalModule !== 'function') { - throw new TypeError( - `${moduleName} file must export a function at ${modulePath}`, - ); - } - - await globalModule(globalConfig); + if (typeof globalModule !== 'function') { + throw new TypeError( + `${moduleName} file must export a function at ${modulePath}`, + ); + } - revertHook(); + await globalModule(globalConfig); + }); }); } diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index 36db7ac359b2..bf3b6f14792f 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -20,6 +20,7 @@ "jest-regex-util": "^24.3.0", "jest-util": "^24.8.0", "micromatch": "^3.1.10", + "pirates": "^4.0.1", "realpath-native": "^1.1.0", "slash": "^2.0.0", "source-map": "^0.6.1", diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index aa594db3ed00..aafff4c113fe 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -20,6 +20,7 @@ import stableStringify from 'fast-json-stable-stringify'; import slash from 'slash'; import writeFileAtomic from 'write-file-atomic'; import {sync as realpath} from 'realpath-native'; +import {addHook} from 'pirates'; import { Options, Transformer, @@ -434,6 +435,49 @@ export default class ScriptTransformer { return fileSource; } + async requireAndTranspileModule( + moduleName: string, + callback?: (module: ModuleType) => void | Promise, + ): Promise { + // Load the transformer to avoid a cycle where we need to load a + // transformer in order to transform it in the require hooks + this.preloadTransformer(moduleName); + + let transforming = false; + const revertHook = addHook( + (code, filename) => { + try { + transforming = true; + return this.transformSource(filename, code, false).code || code; + } finally { + transforming = false; + } + }, + { + exts: [path.extname(moduleName)], + ignoreNodeModules: false, + matcher: filename => { + if (transforming) { + // Don't transform any dependency required by the transformer itself + return false; + } + return this.shouldTransform(filename); + }, + }, + ); + const module: ModuleType = require(moduleName); + + try { + if (callback) { + await callback(module); + } + } finally { + revertHook(); + } + + return module; + } + /** * @deprecated use `this.shouldTransform` instead */ From a5a1a594614ab5c3c68c5bd5f2a8baa59bd7070d Mon Sep 17 00:00:00 2001 From: Eran Shabi Date: Sun, 28 Jul 2019 11:47:41 +0300 Subject: [PATCH 10/34] feat: add jest.advanceTimersToNextTimer method (#8713) --- CHANGELOG.md | 1 + docs/JestObjectAPI.md | 6 + packages/jest-environment/src/index.ts | 5 + .../src/__tests__/jestFakeTimers.test.ts | 123 +++++++++++++++++- .../jest-fake-timers/src/jestFakeTimers.ts | 17 +++ packages/jest-runtime/src/index.ts | 2 + 6 files changed, 153 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e92a2f5d7cc0..2cdb00e79fc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - `[jest-validate]` Allow `maxWorkers` as part of the `jest.config.js` ([#8565](https://github.com/facebook/jest/pull/8565)) - `[jest-runtime]` Allow passing configuration objects to transformers ([#7288](https://github.com/facebook/jest/pull/7288)) - `[@jest/core, @jest/test-sequencer]` Support async sort in custom `testSequencer` ([#8642](https://github.com/facebook/jest/pull/8642)) +- `[jest-runtime, @jest/fake-timers]` Add `jest.advanceTimersToNextTimer` ([#8713](https://github.com/facebook/jest/pull/8713)) - `[@jest-transform]` Extract transforming require logic within `jest-core` into `@jest-transform` ([#8756](https://github.com/facebook/jest/pull/8756)) ### Fixes diff --git a/docs/JestObjectAPI.md b/docs/JestObjectAPI.md index 33011e837fd5..6919fcb905f6 100644 --- a/docs/JestObjectAPI.md +++ b/docs/JestObjectAPI.md @@ -623,6 +623,12 @@ Executes only the macro-tasks that are currently pending (i.e., only the tasks t This is useful for scenarios such as one where the module being tested schedules a `setTimeout()` whose callback schedules another `setTimeout()` recursively (meaning the scheduling never stops). In these scenarios, it's useful to be able to run forward in time by a single step at a time. +### `jest.advanceTimersToNextTimer(steps)` + +Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run. + +Optionally, you can provide `steps`, so it will run `steps` amount of next timeouts/intervals. + ### `jest.clearAllTimers()` Removes any pending timers from the timer system. diff --git a/packages/jest-environment/src/index.ts b/packages/jest-environment/src/index.ts index 3e23757e4ee8..3801ca1cf2cb 100644 --- a/packages/jest-environment/src/index.ts +++ b/packages/jest-environment/src/index.ts @@ -62,6 +62,11 @@ export interface Jest { * @deprecated Use `expect.extend` instead */ addMatchers(matchers: Record): void; + /** + * Advances all timers by the needed milliseconds so that only the next timeouts/intervals will run. + * Optionally, you can provide steps, so it will run steps amount of next timeouts/intervals. + */ + advanceTimersToNextTimer(steps?: number): void; /** * Disables automatic mocking in the module loader. */ diff --git a/packages/jest-fake-timers/src/__tests__/jestFakeTimers.test.ts b/packages/jest-fake-timers/src/__tests__/jestFakeTimers.test.ts index 483d2a7ca5a5..d011eee66d2d 100644 --- a/packages/jest-fake-timers/src/__tests__/jestFakeTimers.test.ts +++ b/packages/jest-fake-timers/src/__tests__/jestFakeTimers.test.ts @@ -624,7 +624,6 @@ describe('FakeTimers', () => { timers.advanceTimersByTime(100); }); - it('throws before allowing infinite recursion', () => { const global = ({process} as unknown) as NodeJS.Global; const timers = new FakeTimers({ @@ -651,6 +650,128 @@ describe('FakeTimers', () => { }); }); + describe('advanceTimersToNextTimer', () => { + it('runs timers in order', () => { + const global = ({process} as unknown) as NodeJS.Global; + const timers = new FakeTimers({ + config, + global, + moduleMocker, + timerConfig, + }); + timers.useFakeTimers(); + + const runOrder: Array = []; + const mock1 = jest.fn(() => runOrder.push('mock1')); + const mock2 = jest.fn(() => runOrder.push('mock2')); + const mock3 = jest.fn(() => runOrder.push('mock3')); + const mock4 = jest.fn(() => runOrder.push('mock4')); + + global.setTimeout(mock1, 100); + global.setTimeout(mock2, 0); + global.setTimeout(mock3, 0); + global.setInterval(() => { + mock4(); + }, 200); + + timers.advanceTimersToNextTimer(); + // Move forward to t=0 + expect(runOrder).toEqual(['mock2', 'mock3']); + + timers.advanceTimersToNextTimer(); + // Move forward to t=100 + expect(runOrder).toEqual(['mock2', 'mock3', 'mock1']); + + timers.advanceTimersToNextTimer(); + // Move forward to t=200 + expect(runOrder).toEqual(['mock2', 'mock3', 'mock1', 'mock4']); + + timers.advanceTimersToNextTimer(); + // Move forward to t=400 + expect(runOrder).toEqual(['mock2', 'mock3', 'mock1', 'mock4', 'mock4']); + }); + + it('run correct amount of steps', () => { + const global = ({process} as unknown) as NodeJS.Global; + const timers = new FakeTimers({ + config, + global, + moduleMocker, + timerConfig, + }); + timers.useFakeTimers(); + + const runOrder: Array = []; + const mock1 = jest.fn(() => runOrder.push('mock1')); + const mock2 = jest.fn(() => runOrder.push('mock2')); + const mock3 = jest.fn(() => runOrder.push('mock3')); + const mock4 = jest.fn(() => runOrder.push('mock4')); + + global.setTimeout(mock1, 100); + global.setTimeout(mock2, 0); + global.setTimeout(mock3, 0); + global.setInterval(() => { + mock4(); + }, 200); + + // Move forward to t=100 + timers.advanceTimersToNextTimer(2); + expect(runOrder).toEqual(['mock2', 'mock3', 'mock1']); + + // Move forward to t=600 + timers.advanceTimersToNextTimer(3); + expect(runOrder).toEqual([ + 'mock2', + 'mock3', + 'mock1', + 'mock4', + 'mock4', + 'mock4', + ]); + }); + + it('setTimeout inside setTimeout', () => { + const global = ({process} as unknown) as NodeJS.Global; + const timers = new FakeTimers({ + config, + global, + moduleMocker, + timerConfig, + }); + timers.useFakeTimers(); + + const runOrder: Array = []; + const mock1 = jest.fn(() => runOrder.push('mock1')); + const mock2 = jest.fn(() => runOrder.push('mock2')); + const mock3 = jest.fn(() => runOrder.push('mock3')); + const mock4 = jest.fn(() => runOrder.push('mock4')); + + global.setTimeout(mock1, 0); + global.setTimeout(() => { + mock2(); + global.setTimeout(mock3, 50); + }, 25); + global.setTimeout(mock4, 100); + + // Move forward to t=75 + timers.advanceTimersToNextTimer(3); + expect(runOrder).toEqual(['mock1', 'mock2', 'mock3']); + }); + + it('does nothing when no timers have been scheduled', () => { + const global = ({process} as unknown) as NodeJS.Global; + const timers = new FakeTimers({ + config, + global, + moduleMocker, + timerConfig, + }); + timers.useFakeTimers(); + + timers.advanceTimersToNextTimer(); + }); + }); + describe('reset', () => { it('resets all pending setTimeouts', () => { const global = ({process} as unknown) as NodeJS.Global; diff --git a/packages/jest-fake-timers/src/jestFakeTimers.ts b/packages/jest-fake-timers/src/jestFakeTimers.ts index 83876f13f02b..aea098eadf3d 100644 --- a/packages/jest-fake-timers/src/jestFakeTimers.ts +++ b/packages/jest-fake-timers/src/jestFakeTimers.ts @@ -237,6 +237,23 @@ export default class FakeTimers { .forEach(([timerHandle]) => this._runTimerHandle(timerHandle)); } + advanceTimersToNextTimer(steps = 1) { + if (steps < 1) { + return; + } + const nextExpiry = Array.from(this._timers.values()).reduce( + (minExpiry: number | null, timer: Timer): number => { + if (minExpiry === null || timer.expiry < minExpiry) return timer.expiry; + return minExpiry; + }, + null, + ); + if (nextExpiry !== null) { + this.advanceTimersByTime(nextExpiry - this._now); + this.advanceTimersToNextTimer(steps - 1); + } + } + advanceTimersByTime(msToRun: number) { this._checkFakeTimers(); // Only run a generous number of timers and then bail. diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts index e3cba4c951bd..f107a5ab077d 100644 --- a/packages/jest-runtime/src/index.ts +++ b/packages/jest-runtime/src/index.ts @@ -1037,6 +1037,8 @@ class Runtime { this._environment.global.jasmine.addMatchers(matchers), advanceTimersByTime: (msToRun: number) => _getFakeTimers().advanceTimersByTime(msToRun), + advanceTimersToNextTimer: (steps?: number) => + _getFakeTimers().advanceTimersToNextTimer(steps), autoMockOff: disableAutomock, autoMockOn: enableAutomock, clearAllMocks, From 38b4b62bccadd49e9b951d3dff4ec37ad5423d54 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 28 Jul 2019 14:22:37 +0530 Subject: [PATCH 11/34] fix: Allow extra options in Global Type (#8758) --- packages/jest-types/src/Global.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/jest-types/src/Global.ts b/packages/jest-types/src/Global.ts index 3203b7533d62..f43daaed8ed3 100644 --- a/packages/jest-types/src/Global.ts +++ b/packages/jest-types/src/Global.ts @@ -82,4 +82,5 @@ export interface Global extends NodeJS.Global { pending: () => void; spyOn: () => void; spyOnProperty: () => void; + [extras: string]: any; } From 1b38e11c17c71999a53f8e00527276daaa6722da Mon Sep 17 00:00:00 2001 From: Lucas Fernandes da Costa Date: Sun, 28 Jul 2019 23:12:46 +0100 Subject: [PATCH 12/34] Fix handling circular references correctly in objects (#8687) * fix: handle circular references correctly in objects (closes #8663) * fix: handling circular references properly in getObjectSubset (#8663) --- CHANGELOG.md | 1 + .../__snapshots__/matchers.test.js.snap | 122 +++++++++++++++++ .../expect/src/__tests__/matchers.test.js | 126 +++++++++++++++--- packages/expect/src/__tests__/utils.test.js | 122 +++++++++++++++++ packages/expect/src/utils.ts | 70 ++++++---- 5 files changed, 396 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cdb00e79fc5..ee98f50fbc50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - `[jest-core]` Fix incorrect `passWithNoTests` warning ([#8595](https://github.com/facebook/jest/pull/8595)) - `[jest-snapshots]` Fix test retries that contain snapshots ([#8629](https://github.com/facebook/jest/pull/8629)) - `[jest-mock]` Fix incorrect assignments when restoring mocks in instances where they originally didn't exist ([#8631](https://github.com/facebook/jest/pull/8631)) +- `[expect]` Fix stack overflow when matching objects with circular references ([#8687](https://github.com/facebook/jest/pull/8687)) ### Chore & Maintenance diff --git a/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap index 38ef42eebc21..e50e796cb05f 100644 --- a/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap @@ -4092,6 +4092,128 @@ Expected: not Set {2, 1} Received: Set {1, 2}" `; +exports[`toMatchObject() circular references simple circular references {pass: false} expect({"a": "hello", "ref": [Circular]}).toMatchObject({"a": "world", "ref": [Circular]}) 1`] = ` +"expect(received).toMatchObject(expected) + +- Expected ++ Received + + Object { +- \\"a\\": \\"world\\", ++ \\"a\\": \\"hello\\", + \\"ref\\": [Circular], + }" +`; + +exports[`toMatchObject() circular references simple circular references {pass: false} expect({"ref": "not a ref"}).toMatchObject({"a": "hello", "ref": [Circular]}) 1`] = ` +"expect(received).toMatchObject(expected) + +- Expected ++ Received + + Object { +- \\"a\\": \\"hello\\", +- \\"ref\\": [Circular], ++ \\"ref\\": \\"not a ref\\", + }" +`; + +exports[`toMatchObject() circular references simple circular references {pass: false} expect({}).toMatchObject({"a": "hello", "ref": [Circular]}) 1`] = ` +"expect(received).toMatchObject(expected) + +- Expected ++ Received + +- Object { +- \\"a\\": \\"hello\\", +- \\"ref\\": [Circular], +- } ++ Object {}" +`; + +exports[`toMatchObject() circular references simple circular references {pass: true} expect({"a": "hello", "ref": [Circular]}).toMatchObject({"a": "hello", "ref": [Circular]}) 1`] = ` +"expect(received).not.toMatchObject(expected) + +Expected: not {\\"a\\": \\"hello\\", \\"ref\\": [Circular]}" +`; + +exports[`toMatchObject() circular references simple circular references {pass: true} expect({"a": "hello", "ref": [Circular]}).toMatchObject({}) 1`] = ` +"expect(received).not.toMatchObject(expected) + +Expected: not {} +Received: {\\"a\\": \\"hello\\", \\"ref\\": [Circular]}" +`; + +exports[`toMatchObject() circular references transitive circular references {pass: false} expect({"a": "world", "nestedObj": {"parentObj": [Circular]}}).toMatchObject({"a": "hello", "nestedObj": {"parentObj": [Circular]}}) 1`] = ` +"expect(received).toMatchObject(expected) + +- Expected ++ Received + + Object { +- \\"a\\": \\"hello\\", ++ \\"a\\": \\"world\\", + \\"nestedObj\\": Object { + \\"parentObj\\": [Circular], + }, + }" +`; + +exports[`toMatchObject() circular references transitive circular references {pass: false} expect({"nestedObj": {"parentObj": "not the parent ref"}}).toMatchObject({"a": "hello", "nestedObj": {"parentObj": [Circular]}}) 1`] = ` +"expect(received).toMatchObject(expected) + +- Expected ++ Received + + Object { +- \\"a\\": \\"hello\\", + \\"nestedObj\\": Object { +- \\"parentObj\\": [Circular], ++ \\"parentObj\\": \\"not the parent ref\\", + }, + }" +`; + +exports[`toMatchObject() circular references transitive circular references {pass: false} expect({}).toMatchObject({"a": "hello", "nestedObj": {"parentObj": [Circular]}}) 1`] = ` +"expect(received).toMatchObject(expected) + +- Expected ++ Received + +- Object { +- \\"a\\": \\"hello\\", +- \\"nestedObj\\": Object { +- \\"parentObj\\": [Circular], +- }, +- } ++ Object {}" +`; + +exports[`toMatchObject() circular references transitive circular references {pass: true} expect({"a": "hello", "nestedObj": {"parentObj": [Circular]}}).toMatchObject({"a": "hello", "nestedObj": {"parentObj": [Circular]}}) 1`] = ` +"expect(received).not.toMatchObject(expected) + +Expected: not {\\"a\\": \\"hello\\", \\"nestedObj\\": {\\"parentObj\\": [Circular]}}" +`; + +exports[`toMatchObject() circular references transitive circular references {pass: true} expect({"a": "hello", "nestedObj": {"parentObj": [Circular]}}).toMatchObject({}) 1`] = ` +"expect(received).not.toMatchObject(expected) + +Expected: not {} +Received: {\\"a\\": \\"hello\\", \\"nestedObj\\": {\\"parentObj\\": [Circular]}}" +`; + +exports[`toMatchObject() does not match properties up in the prototype chain 1`] = ` +"expect(received).toMatchObject(expected) + +- Expected ++ Received + + Object { + \\"other\\": \\"child\\", +- \\"ref\\": [Circular], + }" +`; + exports[`toMatchObject() throws expect("44").toMatchObject({}) 1`] = ` "expect(received).toMatchObject(expected) diff --git a/packages/expect/src/__tests__/matchers.test.js b/packages/expect/src/__tests__/matchers.test.js index 3634f3c98796..e7b683898e43 100644 --- a/packages/expect/src/__tests__/matchers.test.js +++ b/packages/expect/src/__tests__/matchers.test.js @@ -1537,7 +1537,91 @@ describe('toMatchObject()', () => { } } - [ + const testNotToMatchSnapshots = tuples => { + tuples.forEach(([n1, n2]) => { + it(`{pass: true} expect(${stringify(n1)}).toMatchObject(${stringify( + n2, + )})`, () => { + jestExpect(n1).toMatchObject(n2); + expect(() => + jestExpect(n1).not.toMatchObject(n2), + ).toThrowErrorMatchingSnapshot(); + }); + }); + }; + + const testToMatchSnapshots = tuples => { + tuples.forEach(([n1, n2]) => { + it(`{pass: false} expect(${stringify(n1)}).toMatchObject(${stringify( + n2, + )})`, () => { + jestExpect(n1).not.toMatchObject(n2); + expect(() => + jestExpect(n1).toMatchObject(n2), + ).toThrowErrorMatchingSnapshot(); + }); + }); + }; + + describe('circular references', () => { + describe('simple circular references', () => { + const circularObjA1 = {a: 'hello'}; + circularObjA1.ref = circularObjA1; + + const circularObjB = {a: 'world'}; + circularObjB.ref = circularObjB; + + const circularObjA2 = {a: 'hello'}; + circularObjA2.ref = circularObjA2; + + const primitiveInsteadOfRef = {}; + primitiveInsteadOfRef.ref = 'not a ref'; + + testNotToMatchSnapshots([ + [circularObjA1, {}], + [circularObjA2, circularObjA1], + ]); + + testToMatchSnapshots([ + [{}, circularObjA1], + [circularObjA1, circularObjB], + [primitiveInsteadOfRef, circularObjA1], + ]); + }); + + describe('transitive circular references', () => { + const transitiveCircularObjA1 = {a: 'hello'}; + transitiveCircularObjA1.nestedObj = {parentObj: transitiveCircularObjA1}; + + const transitiveCircularObjA2 = {a: 'hello'}; + transitiveCircularObjA2.nestedObj = { + parentObj: transitiveCircularObjA2, + }; + + const transitiveCircularObjB = {a: 'world'}; + transitiveCircularObjB.nestedObj = { + parentObj: transitiveCircularObjB, + }; + + const primitiveInsteadOfRef = {}; + primitiveInsteadOfRef.nestedObj = { + parentObj: 'not the parent ref', + }; + + testNotToMatchSnapshots([ + [transitiveCircularObjA1, {}], + [transitiveCircularObjA2, transitiveCircularObjA1], + ]); + + testToMatchSnapshots([ + [{}, transitiveCircularObjA1], + [transitiveCircularObjB, transitiveCircularObjA1], + [primitiveInsteadOfRef, transitiveCircularObjA1], + ]); + }); + }); + + testNotToMatchSnapshots([ [{a: 'b', c: 'd'}, {a: 'b'}], [{a: 'b', c: 'd'}, {a: 'b', c: 'd'}], [{a: 'b', t: {x: {r: 'r'}, z: 'z'}}, {a: 'b', t: {z: 'z'}}], @@ -1560,18 +1644,9 @@ describe('toMatchObject()', () => { [new Error('bar'), {message: 'bar'}], [new Foo(), {a: undefined, b: 'b'}], [Object.assign(Object.create(null), {a: 'b'}), {a: 'b'}], - ].forEach(([n1, n2]) => { - it(`{pass: true} expect(${stringify(n1)}).toMatchObject(${stringify( - n2, - )})`, () => { - jestExpect(n1).toMatchObject(n2); - expect(() => - jestExpect(n1).not.toMatchObject(n2), - ).toThrowErrorMatchingSnapshot(); - }); - }); + ]); - [ + testToMatchSnapshots([ [{a: 'b', c: 'd'}, {e: 'b'}], [{a: 'b', c: 'd'}, {a: 'b!', c: 'd'}], [{a: 'a', c: 'd'}, {a: jestExpect.any(Number)}], @@ -1597,16 +1672,7 @@ describe('toMatchObject()', () => { [[1, 2, 3], [1, 2, 2]], [new Error('foo'), new Error('bar')], [Object.assign(Object.create(null), {a: 'b'}), {c: 'd'}], - ].forEach(([n1, n2]) => { - it(`{pass: false} expect(${stringify(n1)}).toMatchObject(${stringify( - n2, - )})`, () => { - jestExpect(n1).not.toMatchObject(n2); - expect(() => - jestExpect(n1).toMatchObject(n2), - ).toThrowErrorMatchingSnapshot(); - }); - }); + ]); [ [null, {}], @@ -1628,4 +1694,20 @@ describe('toMatchObject()', () => { ).toThrowErrorMatchingSnapshot(); }); }); + + it('does not match properties up in the prototype chain', () => { + const a = {}; + a.ref = a; + + const b = Object.create(a); + b.other = 'child'; + + const matcher = {other: 'child'}; + matcher.ref = matcher; + + jestExpect(b).not.toMatchObject(matcher); + expect(() => + jestExpect(b).toMatchObject(matcher), + ).toThrowErrorMatchingSnapshot(); + }); }); diff --git a/packages/expect/src/__tests__/utils.test.js b/packages/expect/src/__tests__/utils.test.js index 0850053b120a..b20b3db68700 100644 --- a/packages/expect/src/__tests__/utils.test.js +++ b/packages/expect/src/__tests__/utils.test.js @@ -164,6 +164,74 @@ describe('getObjectSubset()', () => { }, ); }); + + describe('calculating subsets of objects with circular references', () => { + test('simple circular references', () => { + const nonCircularObj = {a: 'world', b: 'something'}; + + const circularObjA = {a: 'hello'}; + circularObjA.ref = circularObjA; + + const circularObjB = {a: 'world'}; + circularObjB.ref = circularObjB; + + const primitiveInsteadOfRef = {b: 'something'}; + primitiveInsteadOfRef.ref = 'not a ref'; + + const nonCircularRef = {b: 'something'}; + nonCircularRef.ref = {}; + + expect(getObjectSubset(circularObjA, nonCircularObj)).toEqual({ + a: 'hello', + }); + expect(getObjectSubset(nonCircularObj, circularObjA)).toEqual({ + a: 'world', + }); + + expect(getObjectSubset(circularObjB, circularObjA)).toEqual(circularObjB); + + expect(getObjectSubset(primitiveInsteadOfRef, circularObjA)).toEqual({ + ref: 'not a ref', + }); + expect(getObjectSubset(nonCircularRef, circularObjA)).toEqual({ + ref: {}, + }); + }); + + test('transitive circular references', () => { + const nonCircularObj = {a: 'world', b: 'something'}; + + const transitiveCircularObjA = {a: 'hello'}; + transitiveCircularObjA.nestedObj = {parentObj: transitiveCircularObjA}; + + const transitiveCircularObjB = {a: 'world'}; + transitiveCircularObjB.nestedObj = {parentObj: transitiveCircularObjB}; + + const primitiveInsteadOfRef = {}; + primitiveInsteadOfRef.nestedObj = {otherProp: 'not the parent ref'}; + + const nonCircularRef = {}; + nonCircularRef.nestedObj = {otherProp: {}}; + + expect(getObjectSubset(transitiveCircularObjA, nonCircularObj)).toEqual({ + a: 'hello', + }); + expect(getObjectSubset(nonCircularObj, transitiveCircularObjA)).toEqual({ + a: 'world', + }); + + expect( + getObjectSubset(transitiveCircularObjB, transitiveCircularObjA), + ).toEqual(transitiveCircularObjB); + + expect( + getObjectSubset(primitiveInsteadOfRef, transitiveCircularObjA), + ).toEqual({nestedObj: {otherProp: 'not the parent ref'}}); + expect(getObjectSubset(nonCircularRef, transitiveCircularObjA)).toEqual({ + nestedObj: {otherProp: {}}, + }); + }); + }); }); describe('emptyObject()', () => { @@ -202,6 +270,60 @@ describe('subsetEquality()', () => { test('undefined does not return errors', () => { expect(subsetEquality(undefined, {foo: 'bar'})).not.toBeTruthy(); }); + + describe('matching subsets with circular references', () => { + test('simple circular references', () => { + const circularObjA1 = {a: 'hello'}; + circularObjA1.ref = circularObjA1; + + const circularObjA2 = {a: 'hello'}; + circularObjA2.ref = circularObjA2; + + const circularObjB = {a: 'world'}; + circularObjB.ref = circularObjB; + + const primitiveInsteadOfRef = {}; + primitiveInsteadOfRef.ref = 'not a ref'; + + expect(subsetEquality(circularObjA1, {})).toBe(true); + expect(subsetEquality({}, circularObjA1)).toBe(false); + expect(subsetEquality(circularObjA2, circularObjA1)).toBe(true); + expect(subsetEquality(circularObjB, circularObjA1)).toBe(false); + expect(subsetEquality(primitiveInsteadOfRef, circularObjA1)).toBe(false); + }); + + test('transitive circular references', () => { + const transitiveCircularObjA1 = {a: 'hello'}; + transitiveCircularObjA1.nestedObj = {parentObj: transitiveCircularObjA1}; + + const transitiveCircularObjA2 = {a: 'hello'}; + transitiveCircularObjA2.nestedObj = { + parentObj: transitiveCircularObjA2, + }; + + const transitiveCircularObjB = {a: 'world'}; + transitiveCircularObjB.nestedObj = { + parentObj: transitiveCircularObjB, + }; + + const primitiveInsteadOfRef = {}; + primitiveInsteadOfRef.nestedObj = { + parentObj: 'not the parent ref', + }; + + expect(subsetEquality(transitiveCircularObjA1, {})).toBe(true); + expect(subsetEquality({}, transitiveCircularObjA1)).toBe(false); + expect( + subsetEquality(transitiveCircularObjA2, transitiveCircularObjA1), + ).toBe(true); + expect( + subsetEquality(transitiveCircularObjB, transitiveCircularObjA1), + ).toBe(false); + expect( + subsetEquality(primitiveInsteadOfRef, transitiveCircularObjA1), + ).toBe(false); + }); + }); }); describe('iterableEquality', () => { diff --git a/packages/expect/src/utils.ts b/packages/expect/src/utils.ts index f8aa8aec01d3..6e77197bf219 100644 --- a/packages/expect/src/utils.ts +++ b/packages/expect/src/utils.ts @@ -104,7 +104,11 @@ export const getPath = ( // Strip properties from object that are not present in the subset. Useful for // printing the diff for toMatchObject() without adding unrelated noise. -export const getObjectSubset = (object: any, subset: any): any => { +export const getObjectSubset = ( + object: any, + subset: any, + seenReferences: WeakMap = new WeakMap(), +): any => { if (Array.isArray(object)) { if (Array.isArray(subset) && subset.length === object.length) { return subset.map((sub: any, i: number) => @@ -113,18 +117,17 @@ export const getObjectSubset = (object: any, subset: any): any => { } } else if (object instanceof Date) { return object; - } else if ( - typeof object === 'object' && - object !== null && - typeof subset === 'object' && - subset !== null - ) { + } else if (isObject(object) && isObject(subset)) { const trimmed: any = {}; - Object.keys(subset) - .filter(key => hasOwnProperty(object, key)) - .forEach( - key => (trimmed[key] = getObjectSubset(object[key], subset[key])), - ); + seenReferences.set(object, trimmed); + + Object.keys(object) + .filter(key => hasOwnProperty(subset, key)) + .forEach(key => { + trimmed[key] = seenReferences.has(object[key]) + ? seenReferences.get(object[key]) + : getObjectSubset(object[key], subset[key], seenReferences); + }); if (Object.keys(trimmed).length > 0) { return trimmed; @@ -257,9 +260,10 @@ export const iterableEquality = ( return true; }; +const isObject = (a: any) => a !== null && typeof a === 'object'; + const isObjectWithKeys = (a: any) => - a !== null && - typeof a === 'object' && + isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date); @@ -268,16 +272,36 @@ export const subsetEquality = ( object: any, subset: any, ): undefined | boolean => { - if (!isObjectWithKeys(subset)) { - return undefined; - } + // subsetEquality needs to keep track of the references + // it has already visited to avoid infinite loops in case + // there are circular references in the subset passed to it. + const subsetEqualityWithContext = ( + seenReferences: WeakMap = new WeakMap(), + ) => (object: any, subset: any): undefined | boolean => { + if (!isObjectWithKeys(subset)) { + return undefined; + } - return Object.keys(subset).every( - key => - object != null && - hasOwnProperty(object, key) && - equals(object[key], subset[key], [iterableEquality, subsetEquality]), - ); + return Object.keys(subset).every(key => { + if (isObjectWithKeys(subset[key])) { + if (seenReferences.get(subset[key])) { + return equals(object[key], subset[key], [iterableEquality]); + } + seenReferences.set(subset[key], true); + } + + return ( + object != null && + hasOwnProperty(object, key) && + equals(object[key], subset[key], [ + iterableEquality, + subsetEqualityWithContext(seenReferences), + ]) + ); + }); + }; + + return subsetEqualityWithContext()(object, subset); }; export const typeEquality = (a: any, b: any) => { From 88ccda0910c83b92bcb5671dc9b0de94e5250054 Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Tue, 30 Jul 2019 17:44:14 -0400 Subject: [PATCH 13/34] expect: Improve report when negative CalledWith assertion fails (#8755) * expect: Improve report when negative CalledWith assertion fails * Add missing argument in printReceivedCalls for LastCalled * Update CHANGELOG.md * Remove label argument from printReceivedCalls * Display equal args with dim color and delete redundant tests --- CHANGELOG.md | 1 + .../__snapshots__/spyMatchers.test.js.snap | 316 ++++++++++-------- .../expect/src/__tests__/spyMatchers.test.js | 21 -- packages/expect/src/spyMatchers.ts | 208 +++++++++--- 4 files changed, 341 insertions(+), 205 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee98f50fbc50..0c3127501c4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - `[expect]` Improve report when mock-spy matcher fails, part 3 ([#8697](https://github.com/facebook/jest/pull/8697)) - `[expect]` Improve report when mock-spy matcher fails, part 4 ([#8710](https://github.com/facebook/jest/pull/8710)) - `[expect]` Throw matcher error when received cannot be jasmine spy ([#8747](https://github.com/facebook/jest/pull/8747)) +- `[expect]` Improve report when negative CalledWith assertion fails ([#8755](https://github.com/facebook/jest/pull/8755)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) - `[jest-core]` Improve report when snapshots are obsolete ([#8448](https://github.com/facebook/jest/pull/8665)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) diff --git a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap index c25156a340cd..73a8f011f7d1 100644 --- a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap @@ -1,10 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`lastCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.lastCalledWith(expected) +"expect(named-mock).not.lastCalledWith(...expected) -Expected mock function \\"named-mock\\" to not have been last called with: - [\\"foo\\", \\"bar\\"]" +Expected: not \\"foo\\", \\"bar\\" + +Number of calls: 1" `; exports[`lastCalledWith works only on spies or jest.fn 1`] = ` @@ -25,17 +26,19 @@ But it was not called." `; exports[`lastCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.lastCalledWith(expected) +"expect(jest.fn()).not.lastCalledWith(...expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function to not have been last called with: - [Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]" +Number of calls: 1" `; exports[`lastCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.lastCalledWith(expected) +"expect(jest.fn()).not.lastCalledWith(...expected) + +Expected: not Map {1 => 2, 2 => 1} -Expected mock function to not have been last called with: - [Map {1 => 2, 2 => 1}]" +Number of calls: 1" `; exports[`lastCalledWith works with Map 2`] = ` @@ -60,10 +63,11 @@ Difference: `; exports[`lastCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.lastCalledWith(expected) +"expect(jest.fn()).not.lastCalledWith(...expected) + +Expected: not Set {1, 2} -Expected mock function to not have been last called with: - [Set {1, 2}]" +Number of calls: 1" `; exports[`lastCalledWith works with Set 2`] = ` @@ -97,17 +101,22 @@ as argument 2, but it was called with `; exports[`lastCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.lastCalledWith(expected) +"expect(jest.fn()).not.lastCalledWith(...expected) -Expected mock function to not have been last called with: - [\\"foo\\", \\"bar\\"]" +Expected: not \\"foo\\", \\"bar\\" + +Number of calls: 1" `; exports[`lastCalledWith works with many arguments 1`] = ` -"expect(jest.fn()).not.lastCalledWith(expected) +"expect(jest.fn()).not.lastCalledWith(...expected) + +Expected: not \\"foo\\", \\"bar\\" +Received + 2: \\"foo\\", \\"bar1\\" +-> 3: \\"foo\\", \\"bar\\" -Expected mock function to not have been last called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 3" `; exports[`lastCalledWith works with many arguments that don't match 1`] = ` @@ -270,10 +279,12 @@ Number of returns: 1" `; exports[`nthCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.nthCalledWith(expected) +"expect(named-mock).not.nthCalledWith(n, ...expected) + +n: 1 +Expected: not \\"foo\\", \\"bar\\" -Expected mock function \\"named-mock\\" first call to not have been called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 1" `; exports[`nthCalledWith negative throw matcher error for n that is not integer 1`] = ` @@ -303,22 +314,6 @@ n has type: number n has value: 0" `; -exports[`nthCalledWith should replace 1st, 2nd, 3rd with first, second, third 1`] = ` -"expect(jest.fn()).nthCalledWith(expected) - -Expected mock function first call to have been called with: - \\"foo\\" -as argument 1, but it was called with - \\"foo1\\"." -`; - -exports[`nthCalledWith should replace 1st, 2nd, 3rd with first, second, third 2`] = ` -"expect(jest.fn()).not.nthCalledWith(expected) - -Expected mock function first call to not have been called with: - [\\"foo1\\", \\"bar\\"]" -`; - exports[`nthCalledWith works only on spies or jest.fn 1`] = ` "expect(received).nthCalledWith(n, ...expected) @@ -337,17 +332,21 @@ But it was not called." `; exports[`nthCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.nthCalledWith(expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) + +n: 1 +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function first call to not have been called with: - [Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]" +Number of calls: 1" `; exports[`nthCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.nthCalledWith(expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) + +n: 1 +Expected: not Map {1 => 2, 2 => 1} -Expected mock function first call to not have been called with: - [Map {1 => 2, 2 => 1}]" +Number of calls: 1" `; exports[`nthCalledWith works with Map 2`] = ` @@ -372,10 +371,12 @@ Difference: `; exports[`nthCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.nthCalledWith(expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) -Expected mock function first call to not have been called with: - [Set {1, 2}]" +n: 1 +Expected: not Set {1, 2} + +Number of calls: 1" `; exports[`nthCalledWith works with Set 2`] = ` @@ -409,17 +410,24 @@ as argument 2, but it was called with `; exports[`nthCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.nthCalledWith(expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) + +n: 1 +Expected: not \\"foo\\", \\"bar\\" -Expected mock function first call to not have been called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 1" `; exports[`nthCalledWith works with three calls 1`] = ` -"expect(jest.fn()).not.nthCalledWith(expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) -Expected mock function first call to not have been called with: - [\\"foo1\\", \\"bar\\"]" +n: 1 +Expected: not \\"foo1\\", \\"bar\\" +Received +-> 1: \\"foo1\\", \\"bar\\" + 2: \\"foo\\", \\"bar1\\" + +Number of calls: 3" `; exports[`nthCalledWith works with trailing undefined arguments 1`] = ` @@ -720,7 +728,7 @@ exports[`toBeCalled includes the custom mock name in the error message 1`] = ` Expected number of calls: 0 Received number of calls: 1 -1: called with no arguments" +1: called with 0 arguments" `; exports[`toBeCalled passes when called 1`] = ` @@ -886,10 +894,11 @@ Expected number of calls: not 2" `; exports[`toBeCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.toBeCalledWith(expected) +"expect(named-mock).not.toBeCalledWith(...expected) + +Expected: not \\"foo\\", \\"bar\\" -Expected mock function \\"named-mock\\" not to have been called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 1" `; exports[`toBeCalledWith works only on spies or jest.fn 1`] = ` @@ -910,17 +919,19 @@ But it was not called." `; exports[`toBeCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.toBeCalledWith(expected) +"expect(jest.fn()).not.toBeCalledWith(...expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function not to have been called with: - [Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]" +Number of calls: 1" `; exports[`toBeCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.toBeCalledWith(expected) +"expect(jest.fn()).not.toBeCalledWith(...expected) + +Expected: not Map {1 => 2, 2 => 1} -Expected mock function not to have been called with: - [Map {1 => 2, 2 => 1}]" +Number of calls: 1" `; exports[`toBeCalledWith works with Map 2`] = ` @@ -945,10 +956,11 @@ Difference: `; exports[`toBeCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.toBeCalledWith(expected) +"expect(jest.fn()).not.toBeCalledWith(...expected) -Expected mock function not to have been called with: - [Set {1, 2}]" +Expected: not Set {1, 2} + +Number of calls: 1" `; exports[`toBeCalledWith works with Set 2`] = ` @@ -982,17 +994,21 @@ as argument 2, but it was called with `; exports[`toBeCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.toBeCalledWith(expected) +"expect(jest.fn()).not.toBeCalledWith(...expected) + +Expected: not \\"foo\\", \\"bar\\" -Expected mock function not to have been called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 1" `; exports[`toBeCalledWith works with many arguments 1`] = ` -"expect(jest.fn()).not.toBeCalledWith(expected) +"expect(jest.fn()).not.toBeCalledWith(...expected) + +Expected: not \\"foo\\", \\"bar\\" +Received + 3: \\"foo\\", \\"bar\\" -Expected mock function not to have been called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 3" `; exports[`toBeCalledWith works with many arguments that don't match 1`] = ` @@ -1050,7 +1066,7 @@ exports[`toHaveBeenCalled includes the custom mock name in the error message 1`] Expected number of calls: 0 Received number of calls: 1 -1: called with no arguments" +1: called with 0 arguments" `; exports[`toHaveBeenCalled passes when called 1`] = ` @@ -1216,10 +1232,11 @@ Expected number of calls: not 2" `; exports[`toHaveBeenCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.toHaveBeenCalledWith(expected) +"expect(named-mock).not.toHaveBeenCalledWith(...expected) -Expected mock function \\"named-mock\\" not to have been called with: - [\\"foo\\", \\"bar\\"]" +Expected: not \\"foo\\", \\"bar\\" + +Number of calls: 1" `; exports[`toHaveBeenCalledWith works only on spies or jest.fn 1`] = ` @@ -1240,17 +1257,19 @@ But it was not called." `; exports[`toHaveBeenCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.toHaveBeenCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenCalledWith(...expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function not to have been called with: - [Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]" +Number of calls: 1" `; exports[`toHaveBeenCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveBeenCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenCalledWith(...expected) + +Expected: not Map {1 => 2, 2 => 1} -Expected mock function not to have been called with: - [Map {1 => 2, 2 => 1}]" +Number of calls: 1" `; exports[`toHaveBeenCalledWith works with Map 2`] = ` @@ -1275,10 +1294,11 @@ Difference: `; exports[`toHaveBeenCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveBeenCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenCalledWith(...expected) + +Expected: not Set {1, 2} -Expected mock function not to have been called with: - [Set {1, 2}]" +Number of calls: 1" `; exports[`toHaveBeenCalledWith works with Set 2`] = ` @@ -1312,17 +1332,21 @@ as argument 2, but it was called with `; exports[`toHaveBeenCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.toHaveBeenCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenCalledWith(...expected) -Expected mock function not to have been called with: - [\\"foo\\", \\"bar\\"]" +Expected: not \\"foo\\", \\"bar\\" + +Number of calls: 1" `; exports[`toHaveBeenCalledWith works with many arguments 1`] = ` -"expect(jest.fn()).not.toHaveBeenCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenCalledWith(...expected) + +Expected: not \\"foo\\", \\"bar\\" +Received + 3: \\"foo\\", \\"bar\\" -Expected mock function not to have been called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 3" `; exports[`toHaveBeenCalledWith works with many arguments that don't match 1`] = ` @@ -1350,10 +1374,11 @@ Expected mock function to have been called with: `; exports[`toHaveBeenLastCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.toHaveBeenLastCalledWith(expected) +"expect(named-mock).not.toHaveBeenLastCalledWith(...expected) -Expected mock function \\"named-mock\\" to not have been last called with: - [\\"foo\\", \\"bar\\"]" +Expected: not \\"foo\\", \\"bar\\" + +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works only on spies or jest.fn 1`] = ` @@ -1374,17 +1399,19 @@ But it was not called." `; exports[`toHaveBeenLastCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenLastCalledWith(...expected) + +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} -Expected mock function to not have been last called with: - [Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]" +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenLastCalledWith(...expected) -Expected mock function to not have been last called with: - [Map {1 => 2, 2 => 1}]" +Expected: not Map {1 => 2, 2 => 1} + +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with Map 2`] = ` @@ -1409,10 +1436,11 @@ Difference: `; exports[`toHaveBeenLastCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenLastCalledWith(...expected) -Expected mock function to not have been last called with: - [Set {1, 2}]" +Expected: not Set {1, 2} + +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with Set 2`] = ` @@ -1446,17 +1474,22 @@ as argument 2, but it was called with `; exports[`toHaveBeenLastCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenLastCalledWith(...expected) + +Expected: not \\"foo\\", \\"bar\\" -Expected mock function to not have been last called with: - [\\"foo\\", \\"bar\\"]" +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with many arguments 1`] = ` -"expect(jest.fn()).not.toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenLastCalledWith(...expected) -Expected mock function to not have been last called with: - [\\"foo\\", \\"bar\\"]" +Expected: not \\"foo\\", \\"bar\\" +Received + 2: \\"foo\\", \\"bar1\\" +-> 3: \\"foo\\", \\"bar\\" + +Number of calls: 3" `; exports[`toHaveBeenLastCalledWith works with many arguments that don't match 1`] = ` @@ -1476,10 +1509,12 @@ Expected mock function to have been last called with: `; exports[`toHaveBeenNthCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.toHaveBeenNthCalledWith(expected) +"expect(named-mock).not.toHaveBeenNthCalledWith(n, ...expected) -Expected mock function \\"named-mock\\" first call to not have been called with: - [\\"foo\\", \\"bar\\"]" +n: 1 +Expected: not \\"foo\\", \\"bar\\" + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith negative throw matcher error for n that is not integer 1`] = ` @@ -1509,22 +1544,6 @@ n has type: number n has value: 0" `; -exports[`toHaveBeenNthCalledWith should replace 1st, 2nd, 3rd with first, second, third 1`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(expected) - -Expected mock function first call to have been called with: - \\"foo\\" -as argument 1, but it was called with - \\"foo1\\"." -`; - -exports[`toHaveBeenNthCalledWith should replace 1st, 2nd, 3rd with first, second, third 2`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(expected) - -Expected mock function first call to not have been called with: - [\\"foo1\\", \\"bar\\"]" -`; - exports[`toHaveBeenNthCalledWith works only on spies or jest.fn 1`] = ` "expect(received).toHaveBeenNthCalledWith(n, ...expected) @@ -1543,17 +1562,21 @@ But it was not called." `; exports[`toHaveBeenNthCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) -Expected mock function first call to not have been called with: - [Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}]" +n: 1 +Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) -Expected mock function first call to not have been called with: - [Map {1 => 2, 2 => 1}]" +n: 1 +Expected: not Map {1 => 2, 2 => 1} + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Map 2`] = ` @@ -1578,10 +1601,12 @@ Difference: `; exports[`toHaveBeenNthCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) + +n: 1 +Expected: not Set {1, 2} -Expected mock function first call to not have been called with: - [Set {1, 2}]" +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Set 2`] = ` @@ -1615,17 +1640,24 @@ as argument 2, but it was called with `; exports[`toHaveBeenNthCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) -Expected mock function first call to not have been called with: - [\\"foo\\", \\"bar\\"]" +n: 1 +Expected: not \\"foo\\", \\"bar\\" + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with three calls 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) + +n: 1 +Expected: not \\"foo1\\", \\"bar\\" +Received +-> 1: \\"foo1\\", \\"bar\\" + 2: \\"foo\\", \\"bar1\\" -Expected mock function first call to not have been called with: - [\\"foo1\\", \\"bar\\"]" +Number of calls: 3" `; exports[`toHaveBeenNthCalledWith works with trailing undefined arguments 1`] = ` diff --git a/packages/expect/src/__tests__/spyMatchers.test.js b/packages/expect/src/__tests__/spyMatchers.test.js index c6ce6366a124..db6322d736eb 100644 --- a/packages/expect/src/__tests__/spyMatchers.test.js +++ b/packages/expect/src/__tests__/spyMatchers.test.js @@ -347,27 +347,6 @@ const createSpy = fn => { expect(() => { jestExpect(fn).not[calledWith](1, 'foo1', 'bar'); - jestExpect(fn).not[calledWith](2, 'foo', 'bar1'); - jestExpect(fn).not[calledWith](3, 'foo', 'bar'); - }).toThrowErrorMatchingSnapshot(); - }); - - test('should replace 1st, 2nd, 3rd with first, second, third', async () => { - const fn = jest.fn(); - fn('foo1', 'bar'); - fn('foo', 'bar1'); - fn('foo', 'bar'); - - expect(() => { - jestExpect(fn)[calledWith](1, 'foo', 'bar'); - jestExpect(fn)[calledWith](2, 'foo', 'bar'); - jestExpect(fn)[calledWith](3, 'foo1', 'bar'); - }).toThrowErrorMatchingSnapshot(); - - expect(() => { - jestExpect(fn).not[calledWith](1, 'foo1', 'bar'); - jestExpect(fn).not[calledWith](2, 'foo', 'bar1'); - jestExpect(fn).not[calledWith](3, 'foo', 'bar'); }).toThrowErrorMatchingSnapshot(); }); diff --git a/packages/expect/src/spyMatchers.ts b/packages/expect/src/spyMatchers.ts index 3e6360332173..7be62b35d270 100644 --- a/packages/expect/src/spyMatchers.ts +++ b/packages/expect/src/spyMatchers.ts @@ -9,6 +9,7 @@ import { diff, ensureExpectedIsNumber, ensureNoExpected, + DIM_COLOR, EXPECTED_COLOR, matcherErrorMessage, matcherHint, @@ -27,10 +28,38 @@ const PRINT_LIMIT = 3; const CALL_PRINT_LIMIT = 3; const LAST_CALL_PRINT_LIMIT = 1; -const printReceivedArgs = (args: Array): string => - args.length === 0 - ? 'called with no arguments' - : args.map(arg => printReceived(arg)).join(', '); +const NO_ARGUMENTS = 'called with 0 arguments'; + +const printExpectedArgs = (expected: Array): string => + expected.length === 0 + ? NO_ARGUMENTS + : expected.map(arg => printExpected(arg)).join(', '); + +const printReceivedArgs = ( + received: Array, + expected?: Array, +): string => + received.length === 0 + ? NO_ARGUMENTS + : received + .map((arg, i) => + Array.isArray(expected) && + i < expected.length && + isEqualValue(expected[i], arg) + ? printCommon(arg) + : printReceived(arg), + ) + .join(', '); + +const printCommon = (val: unknown) => DIM_COLOR(stringify(val)); + +const isEqualValue = (expected: unknown, received: unknown): boolean => + equals(expected, received, [iterableEquality]); + +const isEqualCall = ( + expected: Array, + received: Array, +): boolean => equals(expected, received, [iterableEquality]); const isEqualReturn = (expected: unknown, result: any): boolean => result.type === 'return' && @@ -68,6 +97,40 @@ const getRightAlignedPrinter = (label: string): PrintLabel => { suffix; }; +type IndexedCall = [number, Array]; + +// Return either empty string or one line per indexed result, +// so additional empty line can separate from `Number of returns` which follows. +const printReceivedCallsNegative = ( + expected: Array, + indexedCalls: Array, + isOnlyCall: boolean, + iExpectedCall?: number, +) => { + if (indexedCalls.length === 0) { + return ''; + } + + const label = 'Received: '; + if (isOnlyCall) { + return label + printReceivedArgs(indexedCalls[0], expected) + '\n'; + } + + const printAligned = getRightAlignedPrinter(label); + + return ( + 'Received\n' + + indexedCalls.reduce( + (printed: string, [i, args]: IndexedCall) => + printed + + printAligned(String(i + 1), i === iExpectedCall) + + printReceivedArgs(args, expected) + + '\n', + '', + ) + ); +}; + const printResult = (result: any) => result.type === 'throw' ? 'function call threw an error' @@ -309,7 +372,7 @@ const createToBeCalledWithMatcher = (matcherName: string) => isNot: this.isNot, promise: this.promise, }; - ensureMockOrSpy(received, matcherName.slice(1), expectedArgument, options); + ensureMockOrSpy(received, matcherName, expectedArgument, options); const receivedIsSpy = isSpy(received); const type = receivedIsSpy ? 'spy' : 'mock function'; @@ -324,18 +387,38 @@ const createToBeCalledWithMatcher = (matcherName: string) => : received.mock.calls; const [match, fail] = partition(calls, call => - equals(call, expected, [iterableEquality]), + isEqualCall(expected, call as Array), ); const pass = match.length > 0; const message = pass - ? () => - matcherHint('.not' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} not to have been called with:\n` + - ` ${printExpected(expected)}` + ? () => { + // Some examples of calls that are equal to expected value. + const indexedCalls: Array = []; + let i = 0; + while (i < calls.length && indexedCalls.length < PRINT_LIMIT) { + if (isEqualCall(expected, calls[i])) { + indexedCalls.push([i, calls[i]]); + } + i += 1; + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `Expected: not ${printExpectedArgs(expected)}\n` + + (calls.length === 1 && stringify(calls[0]) === stringify(expected) + ? '' + : printReceivedCallsNegative( + expected, + indexedCalls, + calls.length === 1, + )) + + `\nNumber of calls: ${printReceived(calls.length)}` + ); + } : () => - matcherHint(matcherName, receivedName) + + matcherHint('.' + matcherName, receivedName) + '\n\n' + `Expected ${identifier} to have been called with:\n` + formatMismatchedCalls(fail, expected, CALL_PRINT_LIMIT); @@ -425,7 +508,7 @@ const createLastCalledWithMatcher = (matcherName: string) => isNot: this.isNot, promise: this.promise, }; - ensureMockOrSpy(received, matcherName.slice(1), expectedArgument, options); + ensureMockOrSpy(received, matcherName, expectedArgument, options); const receivedIsSpy = isSpy(received); const type = receivedIsSpy ? 'spy' : 'mock function'; @@ -434,19 +517,40 @@ const createLastCalledWithMatcher = (matcherName: string) => receivedIsSpy || receivedName === 'jest.fn()' ? type : `${type} "${receivedName}"`; + const calls = receivedIsSpy ? received.calls.all().map((x: any) => x.args) : received.mock.calls; - const pass = equals(calls[calls.length - 1], expected, [iterableEquality]); + const iLast = calls.length - 1; + + const pass = iLast >= 0 && isEqualCall(expected, calls[iLast]); const message = pass - ? () => - matcherHint('.not' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} to not have been last called with:\n` + - ` ${printExpected(expected)}` + ? () => { + const indexedCalls: Array = []; + if (iLast > 0) { + // Display preceding call as context. + indexedCalls.push([iLast - 1, calls[iLast - 1]]); + } + indexedCalls.push([iLast, calls[iLast]]); + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `Expected: not ${printExpectedArgs(expected)}\n` + + (calls.length === 1 && stringify(calls[0]) === stringify(expected) + ? '' + : printReceivedCallsNegative( + expected, + indexedCalls, + calls.length === 1, + iLast, + )) + + `\nNumber of calls: ${printReceived(calls.length)}` + ); + } : () => - matcherHint(matcherName, receivedName) + + matcherHint('.' + matcherName, receivedName) + '\n\n' + `Expected ${identifier} to have been last called with:\n` + formatMismatchedCalls(calls, expected, LAST_CALL_PRINT_LIMIT); @@ -549,17 +653,12 @@ const createNthCalledWithMatcher = (matcherName: string) => promise: this.promise, secondArgument: '...expected', }; - ensureMockOrSpy(received, matcherName.slice(1), expectedArgument, options); + ensureMockOrSpy(received, matcherName, expectedArgument, options); if (!Number.isSafeInteger(nth) || nth < 1) { throw new Error( matcherErrorMessage( - matcherHint( - matcherName.slice(1), - undefined, - expectedArgument, - options, - ), + matcherHint(matcherName, undefined, expectedArgument, options), `${EXPECTED_COLOR(expectedArgument)} must be a positive integer`, printWithType(expectedArgument, nth, printExpected), ), @@ -574,21 +673,46 @@ const createNthCalledWithMatcher = (matcherName: string) => receivedIsSpy || receivedName === 'jest.fn()' ? type : `${type} "${receivedName}"`; + const calls = receivedIsSpy ? received.calls.all().map((x: any) => x.args) : received.mock.calls; - const pass = equals(calls[nth - 1], expected, [iterableEquality]); + const length = calls.length; + const iNth = nth - 1; + + const pass = iNth < length && isEqualCall(expected, calls[iNth]); const message = pass - ? () => - matcherHint('.not' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} ${nthToString( - nth, - )} call to not have been called with:\n` + - ` ${printExpected(expected)}` + ? () => { + // Display preceding and following calls, + // in case assertions fails because index is off by one. + const indexedCalls: Array = []; + if (iNth - 1 >= 0) { + indexedCalls.push([iNth - 1, calls[iNth - 1]]); + } + indexedCalls.push([iNth, calls[iNth]]); + if (iNth + 1 < length) { + indexedCalls.push([iNth + 1, calls[iNth + 1]]); + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `n: ${nth}\n` + + `Expected: not ${printExpectedArgs(expected)}\n` + + (calls.length === 1 && stringify(calls[0]) === stringify(expected) + ? '' + : printReceivedCallsNegative( + expected, + indexedCalls, + calls.length === 1, + iNth, + )) + + `\nNumber of calls: ${printReceived(calls.length)}` + ); + } : () => - matcherHint(matcherName, receivedName) + + matcherHint('.' + matcherName, receivedName) + '\n\n' + `Expected ${identifier} ${nthToString( nth, @@ -730,21 +854,21 @@ const createNthReturnedWithMatcher = (matcherName: string) => }; const spyMatchers: MatchersObject = { - lastCalledWith: createLastCalledWithMatcher('.lastCalledWith'), + lastCalledWith: createLastCalledWithMatcher('lastCalledWith'), lastReturnedWith: createLastReturnedMatcher('lastReturnedWith'), - nthCalledWith: createNthCalledWithMatcher('.nthCalledWith'), + nthCalledWith: createNthCalledWithMatcher('nthCalledWith'), nthReturnedWith: createNthReturnedWithMatcher('nthReturnedWith'), toBeCalled: createToBeCalledMatcher('toBeCalled'), toBeCalledTimes: createToBeCalledTimesMatcher('toBeCalledTimes'), - toBeCalledWith: createToBeCalledWithMatcher('.toBeCalledWith'), + toBeCalledWith: createToBeCalledWithMatcher('toBeCalledWith'), toHaveBeenCalled: createToBeCalledMatcher('toHaveBeenCalled'), toHaveBeenCalledTimes: createToBeCalledTimesMatcher('toHaveBeenCalledTimes'), - toHaveBeenCalledWith: createToBeCalledWithMatcher('.toHaveBeenCalledWith'), + toHaveBeenCalledWith: createToBeCalledWithMatcher('toHaveBeenCalledWith'), toHaveBeenLastCalledWith: createLastCalledWithMatcher( - '.toHaveBeenLastCalledWith', + 'toHaveBeenLastCalledWith', ), toHaveBeenNthCalledWith: createNthCalledWithMatcher( - '.toHaveBeenNthCalledWith', + 'toHaveBeenNthCalledWith', ), toHaveLastReturnedWith: createLastReturnedMatcher('toHaveLastReturnedWith'), toHaveNthReturnedWith: createNthReturnedWithMatcher('toHaveNthReturnedWith'), From 2cd7576e6a152c6b2223a8803ea72f619d82c28c Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Wed, 31 Jul 2019 04:04:11 -0300 Subject: [PATCH 14/34] docs: use toContainEqual in MockFunctions example (#8765) * Update MockFunctions - toContain -> toContainEqual toContain won't work in this case, because it will try to compare arrays with Object.is, not equality. * Update CHANGELOG.md * Update order docs MockFunctions --- CHANGELOG.md | 1 + docs/MockFunctions.md | 2 +- website/versioned_docs/version-22.x/MockFunctions.md | 2 +- website/versioned_docs/version-23.x/MockFunctions.md | 2 +- website/versioned_docs/version-24.0/MockFunctions.md | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c3127501c4c..51367d00c36a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ - `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753)) - `[docs]` Updated imports of react-testing-library to @testing-library/react in website ([#8757](https://github.com/facebook/jest/pull/8757)) - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) +- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) ### Performance diff --git a/docs/MockFunctions.md b/docs/MockFunctions.md index 287cb4c2a36c..eb632cca83a2 100644 --- a/docs/MockFunctions.md +++ b/docs/MockFunctions.md @@ -263,7 +263,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock` expect(mockFunc.mock.calls.length).toBeGreaterThan(0); // The mock function was called at least once with the specified args -expect(mockFunc.mock.calls).toContain([arg1, arg2]); +expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]); // The last call to the mock function was called with the specified args expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([ diff --git a/website/versioned_docs/version-22.x/MockFunctions.md b/website/versioned_docs/version-22.x/MockFunctions.md index 347908a12122..ae51d048bbb5 100644 --- a/website/versioned_docs/version-22.x/MockFunctions.md +++ b/website/versioned_docs/version-22.x/MockFunctions.md @@ -221,7 +221,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock` expect(mockFunc.mock.calls.length).toBeGreaterThan(0); // The mock function was called at least once with the specified args -expect(mockFunc.mock.calls).toContain([arg1, arg2]); +expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]); // The last call to the mock function was called with the specified args expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([ diff --git a/website/versioned_docs/version-23.x/MockFunctions.md b/website/versioned_docs/version-23.x/MockFunctions.md index 0baf3f137ccf..8e9d11106743 100644 --- a/website/versioned_docs/version-23.x/MockFunctions.md +++ b/website/versioned_docs/version-23.x/MockFunctions.md @@ -267,7 +267,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock` expect(mockFunc.mock.calls.length).toBeGreaterThan(0); // The mock function was called at least once with the specified args -expect(mockFunc.mock.calls).toContain([arg1, arg2]); +expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]); // The last call to the mock function was called with the specified args expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([ diff --git a/website/versioned_docs/version-24.0/MockFunctions.md b/website/versioned_docs/version-24.0/MockFunctions.md index 5debbd5c9e60..2aac9feeae4d 100644 --- a/website/versioned_docs/version-24.0/MockFunctions.md +++ b/website/versioned_docs/version-24.0/MockFunctions.md @@ -264,7 +264,7 @@ These matchers are really just sugar for common forms of inspecting the `.mock` expect(mockFunc.mock.calls.length).toBeGreaterThan(0); // The mock function was called at least once with the specified args -expect(mockFunc.mock.calls).toContain([arg1, arg2]); +expect(mockFunc.mock.calls).toContainEqual([arg1, arg2]); // The last call to the mock function was called with the specified args expect(mockFunc.mock.calls[mockFunc.mock.calls.length - 1]).toEqual([ From cff67fd170c374804d1fa983a63d060174d62288 Mon Sep 17 00:00:00 2001 From: Mikhail Bodrov Date: Sat, 3 Aug 2019 16:19:38 +0300 Subject: [PATCH 15/34] Cache JestHook emitters (#8746) --- CHANGELOG.md | 2 ++ packages/jest-watcher/src/JestHooks.ts | 27 ++++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51367d00c36a..3985721a9662 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ ### Performance +- `[jest-watcher]` Minor optimization for JestHook ([#8746](https://github.com/facebook/jest/pull/8746) + ## 24.8.0 ### Features diff --git a/packages/jest-watcher/src/JestHooks.ts b/packages/jest-watcher/src/JestHooks.ts index 5f8cad6b775c..f697192f2da4 100644 --- a/packages/jest-watcher/src/JestHooks.ts +++ b/packages/jest-watcher/src/JestHooks.ts @@ -25,20 +25,17 @@ class JestHooks { shouldRunTestSuite: Array; }; + private _subscriber: JestHookSubscriber; + private _emitter: JestHookEmitter; + constructor() { this._listeners = { onFileChange: [], onTestRunComplete: [], shouldRunTestSuite: [], }; - } - - isUsed(hook: AvailableHooks) { - return this._listeners[hook] && this._listeners[hook].length; - } - getSubscriber(): JestHookSubscriber { - return { + this._subscriber = { onFileChange: fn => { this._listeners.onFileChange.push(fn); }, @@ -49,10 +46,8 @@ class JestHooks { this._listeners.shouldRunTestSuite.push(fn); }, }; - } - getEmitter(): JestHookEmitter { - return { + this._emitter = { onFileChange: fs => this._listeners.onFileChange.forEach(listener => listener(fs)), onTestRunComplete: results => @@ -70,6 +65,18 @@ class JestHooks { }, }; } + + isUsed(hook: AvailableHooks) { + return this._listeners[hook] && this._listeners[hook].length; + } + + getSubscriber(): Readonly { + return this._subscriber; + } + + getEmitter(): Readonly { + return this._emitter; + } } export default JestHooks; From e3ed22a62f6d03d96667a0ac2b24e58fda7e238d Mon Sep 17 00:00:00 2001 From: dynacore Date: Sun, 4 Aug 2019 01:45:15 -0600 Subject: [PATCH 16/34] docs: fix broken link for Relay test examples (#8780) --- docs/MoreResources.md | 2 +- website/versioned_docs/version-22.x/MoreResources.md | 2 +- website/versioned_docs/version-23.x/MoreResources.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/MoreResources.md b/docs/MoreResources.md index 1e273085b055..d721632b8ac9 100644 --- a/docs/MoreResources.md +++ b/docs/MoreResources.md @@ -15,7 +15,7 @@ By now you should have a good idea of how Jest can make it easy to test your app ## Learn by example -You will find a number of example test cases in the [`examples`](https://github.com/facebook/jest/tree/master/examples) folder on GitHub. You can also learn from the excellent tests used by the [React](https://github.com/facebook/react/tree/master/packages/react/src/__tests__), [Relay](https://github.com/facebook/relay/tree/master/packages/react-relay/modern/__tests__), and [React Native](https://github.com/facebook/react-native/tree/master/Libraries/Animated/src/__tests__) projects. +You will find a number of example test cases in the [`examples`](https://github.com/facebook/jest/tree/master/examples) folder on GitHub. You can also learn from the excellent tests used by the [React](https://github.com/facebook/react/tree/master/packages/react/src/__tests__), [Relay](https://github.com/facebook/relay/tree/master/packages/react-relay/__tests__), and [React Native](https://github.com/facebook/react-native/tree/master/Libraries/Animated/src/__tests__) projects. ## Join the community diff --git a/website/versioned_docs/version-22.x/MoreResources.md b/website/versioned_docs/version-22.x/MoreResources.md index d11a2cfee407..bdd94f721096 100644 --- a/website/versioned_docs/version-22.x/MoreResources.md +++ b/website/versioned_docs/version-22.x/MoreResources.md @@ -16,7 +16,7 @@ By now you should have a good idea of how Jest can make it easy to test your app ## Learn by example -You will find a number of example test cases in the [`examples`](https://github.com/facebook/jest/tree/master/examples) folder on GitHub. You can also learn from the excellent tests used by the [React](https://github.com/facebook/react/tree/master/src/renderers/__tests__), [Relay](https://github.com/facebook/relay/tree/master/packages/react-relay/modern/__tests__), and [React Native](https://github.com/facebook/react-native/tree/master/Libraries/Animated/src/__tests__) projects. +You will find a number of example test cases in the [`examples`](https://github.com/facebook/jest/tree/master/examples) folder on GitHub. You can also learn from the excellent tests used by the [React](https://github.com/facebook/react/tree/master/src/renderers/__tests__), [Relay](https://github.com/facebook/relay/tree/master/packages/react-relay/__tests__), and [React Native](https://github.com/facebook/react-native/tree/master/Libraries/Animated/src/__tests__) projects. ## Join the community diff --git a/website/versioned_docs/version-23.x/MoreResources.md b/website/versioned_docs/version-23.x/MoreResources.md index 8d9da0b3f051..4d19619ad385 100644 --- a/website/versioned_docs/version-23.x/MoreResources.md +++ b/website/versioned_docs/version-23.x/MoreResources.md @@ -16,7 +16,7 @@ By now you should have a good idea of how Jest can make it easy to test your app ## Learn by example -You will find a number of example test cases in the [`examples`](https://github.com/facebook/jest/tree/master/examples) folder on GitHub. You can also learn from the excellent tests used by the [React](https://github.com/facebook/react/tree/master/packages/react/src/__tests__), [Relay](https://github.com/facebook/relay/tree/master/packages/react-relay/modern/__tests__), and [React Native](https://github.com/facebook/react-native/tree/master/Libraries/Animated/src/__tests__) projects. +You will find a number of example test cases in the [`examples`](https://github.com/facebook/jest/tree/master/examples) folder on GitHub. You can also learn from the excellent tests used by the [React](https://github.com/facebook/react/tree/master/packages/react/src/__tests__), [Relay](https://github.com/facebook/relay/tree/master/packages/react-relay/__tests__), and [React Native](https://github.com/facebook/react-native/tree/master/Libraries/Animated/src/__tests__) projects. ## Join the community From 2a004bfdb17f12b1cc0b2a6d7e3620aecd095260 Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Sun, 4 Aug 2019 13:57:18 -0400 Subject: [PATCH 17/34] expect: Improve report when positive CalledWith assertion fails (#8771) * expect: Improve report when positive CalledWith assertion fails * Replace isOnlyCallLineDiffable variable with inline call * Exchange operands in or condition * Update CHANGELOG.md --- CHANGELOG.md | 1 + .../__snapshots__/spyMatchers.test.js.snap | 384 +++++++--------- packages/expect/src/spyMatchers.ts | 420 +++++++++++++----- 3 files changed, 472 insertions(+), 333 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3985721a9662..696eeb23d138 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - `[expect]` Improve report when mock-spy matcher fails, part 4 ([#8710](https://github.com/facebook/jest/pull/8710)) - `[expect]` Throw matcher error when received cannot be jasmine spy ([#8747](https://github.com/facebook/jest/pull/8747)) - `[expect]` Improve report when negative CalledWith assertion fails ([#8755](https://github.com/facebook/jest/pull/8755)) +- `[expect]` Improve report when positive CalledWith assertion fails ([#8771](https://github.com/facebook/jest/pull/8771)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) - `[jest-core]` Improve report when snapshots are obsolete ([#8448](https://github.com/facebook/jest/pull/8665)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) diff --git a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap index 73a8f011f7d1..c22e8bdf327e 100644 --- a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap @@ -18,11 +18,11 @@ Received has value: [Function fn]" `; exports[`lastCalledWith works when not called 1`] = ` -"expect(jest.fn()).lastCalledWith(expected) +"expect(jest.fn()).lastCalledWith(...expected) -Expected mock function to have been last called with: - [\\"foo\\", \\"bar\\"] -But it was not called." +Expected: \\"foo\\", \\"bar\\" + +Number of calls: 0" `; exports[`lastCalledWith works with Immutable.js objects 1`] = ` @@ -42,14 +42,7 @@ Number of calls: 1" `; exports[`lastCalledWith works with Map 2`] = ` -"expect(jest.fn()).lastCalledWith(expected) - -Expected mock function to have been last called with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -as argument 1, but it was called with - Map {1 => 2, 2 => 1}. - -Difference: +"expect(jest.fn()).lastCalledWith(...expected) - Expected + Received @@ -59,7 +52,9 @@ Difference: - \\"b\\" => \\"a\\", + 1 => 2, + 2 => 1, - }" + }, + +Number of calls: 1" `; exports[`lastCalledWith works with Set 1`] = ` @@ -71,14 +66,7 @@ Number of calls: 1" `; exports[`lastCalledWith works with Set 2`] = ` -"expect(jest.fn()).lastCalledWith(expected) - -Expected mock function to have been last called with: - Set {3, 4} -as argument 1, but it was called with - Set {1, 2}. - -Difference: +"expect(jest.fn()).lastCalledWith(...expected) - Expected + Received @@ -88,16 +76,18 @@ Difference: - 4, + 1, + 2, - }" + }, + +Number of calls: 1" `; exports[`lastCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).lastCalledWith(expected) +"expect(jest.fn()).lastCalledWith(...expected) -Expected mock function to have been last called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +Expected: \\"foo\\", \\"bar\\" +Received: \\"foo\\", \\"bar1\\" + +Number of calls: 1" `; exports[`lastCalledWith works with arguments that match 1`] = ` @@ -120,19 +110,23 @@ Number of calls: 3" `; exports[`lastCalledWith works with many arguments that don't match 1`] = ` -"expect(jest.fn()).lastCalledWith(expected) +"expect(jest.fn()).lastCalledWith(...expected) -Expected mock function to have been last called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar3\\"." +Expected: \\"foo\\", \\"bar\\" +Received + 2: \\"foo\\", \\"bar2\\" +-> 3: \\"foo\\", \\"bar3\\" + +Number of calls: 3" `; exports[`lastCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).lastCalledWith(expected) +"expect(jest.fn()).lastCalledWith(...expected) -Expected mock function to have been last called with: - Did not expect argument 2 but it was called with undefined." +Expected: \\"foo\\" +Received: \\"foo\\", undefined + +Number of calls: 1" `; exports[`lastReturnedWith a call that throws is not considered to have returned 1`] = ` @@ -324,11 +318,12 @@ Received has value: [Function fn]" `; exports[`nthCalledWith works when not called 1`] = ` -"expect(jest.fn()).nthCalledWith(expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) -Expected mock function first call to have been called with: - [\\"foo\\", \\"bar\\"] -But it was not called." +n: 1 +Expected: \\"foo\\", \\"bar\\" + +Number of calls: 0" `; exports[`nthCalledWith works with Immutable.js objects 1`] = ` @@ -350,15 +345,9 @@ Number of calls: 1" `; exports[`nthCalledWith works with Map 2`] = ` -"expect(jest.fn()).nthCalledWith(expected) - -Expected mock function first call to have been called with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -as argument 1, but it was called with - Map {1 => 2, 2 => 1}. - -Difference: +"expect(jest.fn()).nthCalledWith(n, ...expected) +n: 1 - Expected + Received @@ -367,7 +356,9 @@ Difference: - \\"b\\" => \\"a\\", + 1 => 2, + 2 => 1, - }" + }, + +Number of calls: 1" `; exports[`nthCalledWith works with Set 1`] = ` @@ -380,15 +371,9 @@ Number of calls: 1" `; exports[`nthCalledWith works with Set 2`] = ` -"expect(jest.fn()).nthCalledWith(expected) - -Expected mock function first call to have been called with: - Set {3, 4} -as argument 1, but it was called with - Set {1, 2}. - -Difference: +"expect(jest.fn()).nthCalledWith(n, ...expected) +n: 1 - Expected + Received @@ -397,16 +382,19 @@ Difference: - 4, + 1, + 2, - }" + }, + +Number of calls: 1" `; exports[`nthCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).nthCalledWith(expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) + +n: 1 +Expected: \\"foo\\", \\"bar\\" +Received: \\"foo\\", \\"bar1\\" -Expected mock function first call to have been called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +Number of calls: 1" `; exports[`nthCalledWith works with arguments that match 1`] = ` @@ -431,10 +419,13 @@ Number of calls: 3" `; exports[`nthCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).nthCalledWith(expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) -Expected mock function first call to have been called with: - Did not expect argument 2 but it was called with undefined." +n: 1 +Expected: \\"foo\\" +Received: \\"foo\\", undefined + +Number of calls: 1" `; exports[`nthReturnedWith a call that throws is not considered to have returned 1`] = ` @@ -911,11 +902,11 @@ Received has value: [Function fn]" `; exports[`toBeCalledWith works when not called 1`] = ` -"expect(jest.fn()).toBeCalledWith(expected) +"expect(jest.fn()).toBeCalledWith(...expected) + +Expected: \\"foo\\", \\"bar\\" -Expected mock function to have been called with: - [\\"foo\\", \\"bar\\"] -But it was not called." +Number of calls: 0" `; exports[`toBeCalledWith works with Immutable.js objects 1`] = ` @@ -935,14 +926,7 @@ Number of calls: 1" `; exports[`toBeCalledWith works with Map 2`] = ` -"expect(jest.fn()).toBeCalledWith(expected) - -Expected mock function to have been called with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -as argument 1, but it was called with - Map {1 => 2, 2 => 1}. - -Difference: +"expect(jest.fn()).toBeCalledWith(...expected) - Expected + Received @@ -952,7 +936,9 @@ Difference: - \\"b\\" => \\"a\\", + 1 => 2, + 2 => 1, - }" + }, + +Number of calls: 1" `; exports[`toBeCalledWith works with Set 1`] = ` @@ -964,14 +950,7 @@ Number of calls: 1" `; exports[`toBeCalledWith works with Set 2`] = ` -"expect(jest.fn()).toBeCalledWith(expected) - -Expected mock function to have been called with: - Set {3, 4} -as argument 1, but it was called with - Set {1, 2}. - -Difference: +"expect(jest.fn()).toBeCalledWith(...expected) - Expected + Received @@ -981,16 +960,18 @@ Difference: - 4, + 1, + 2, - }" + }, + +Number of calls: 1" `; exports[`toBeCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).toBeCalledWith(expected) +"expect(jest.fn()).toBeCalledWith(...expected) + +Expected: \\"foo\\", \\"bar\\" +Received: \\"foo\\", \\"bar1\\" -Expected mock function to have been called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +Number of calls: 1" `; exports[`toBeCalledWith works with arguments that match 1`] = ` @@ -1012,27 +993,24 @@ Number of calls: 3" `; exports[`toBeCalledWith works with many arguments that don't match 1`] = ` -"expect(jest.fn()).toBeCalledWith(expected) +"expect(jest.fn()).toBeCalledWith(...expected) -Expected mock function to have been called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar3\\". - - \\"bar\\" -as argument 2, but it was called with - \\"bar2\\". +Expected: \\"foo\\", \\"bar\\" +Received + 1: \\"foo\\", \\"bar1\\" + 2: \\"foo\\", \\"bar2\\" + 3: \\"foo\\", \\"bar3\\" - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +Number of calls: 3" `; exports[`toBeCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).toBeCalledWith(expected) +"expect(jest.fn()).toBeCalledWith(...expected) -Expected mock function to have been called with: - Did not expect argument 2 but it was called with undefined." +Expected: \\"foo\\" +Received: \\"foo\\", undefined + +Number of calls: 1" `; exports[`toHaveBeenCalled .not fails with any argument passed 1`] = ` @@ -1249,11 +1227,11 @@ Received has value: [Function fn]" `; exports[`toHaveBeenCalledWith works when not called 1`] = ` -"expect(jest.fn()).toHaveBeenCalledWith(expected) +"expect(jest.fn()).toHaveBeenCalledWith(...expected) -Expected mock function to have been called with: - [\\"foo\\", \\"bar\\"] -But it was not called." +Expected: \\"foo\\", \\"bar\\" + +Number of calls: 0" `; exports[`toHaveBeenCalledWith works with Immutable.js objects 1`] = ` @@ -1273,14 +1251,7 @@ Number of calls: 1" `; exports[`toHaveBeenCalledWith works with Map 2`] = ` -"expect(jest.fn()).toHaveBeenCalledWith(expected) - -Expected mock function to have been called with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -as argument 1, but it was called with - Map {1 => 2, 2 => 1}. - -Difference: +"expect(jest.fn()).toHaveBeenCalledWith(...expected) - Expected + Received @@ -1290,7 +1261,9 @@ Difference: - \\"b\\" => \\"a\\", + 1 => 2, + 2 => 1, - }" + }, + +Number of calls: 1" `; exports[`toHaveBeenCalledWith works with Set 1`] = ` @@ -1302,14 +1275,7 @@ Number of calls: 1" `; exports[`toHaveBeenCalledWith works with Set 2`] = ` -"expect(jest.fn()).toHaveBeenCalledWith(expected) - -Expected mock function to have been called with: - Set {3, 4} -as argument 1, but it was called with - Set {1, 2}. - -Difference: +"expect(jest.fn()).toHaveBeenCalledWith(...expected) - Expected + Received @@ -1319,16 +1285,18 @@ Difference: - 4, + 1, + 2, - }" + }, + +Number of calls: 1" `; exports[`toHaveBeenCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).toHaveBeenCalledWith(expected) +"expect(jest.fn()).toHaveBeenCalledWith(...expected) -Expected mock function to have been called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +Expected: \\"foo\\", \\"bar\\" +Received: \\"foo\\", \\"bar1\\" + +Number of calls: 1" `; exports[`toHaveBeenCalledWith works with arguments that match 1`] = ` @@ -1350,27 +1318,24 @@ Number of calls: 3" `; exports[`toHaveBeenCalledWith works with many arguments that don't match 1`] = ` -"expect(jest.fn()).toHaveBeenCalledWith(expected) +"expect(jest.fn()).toHaveBeenCalledWith(...expected) -Expected mock function to have been called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar3\\". - - \\"bar\\" -as argument 2, but it was called with - \\"bar2\\". +Expected: \\"foo\\", \\"bar\\" +Received + 1: \\"foo\\", \\"bar1\\" + 2: \\"foo\\", \\"bar2\\" + 3: \\"foo\\", \\"bar3\\" - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +Number of calls: 3" `; exports[`toHaveBeenCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).toHaveBeenCalledWith(expected) +"expect(jest.fn()).toHaveBeenCalledWith(...expected) -Expected mock function to have been called with: - Did not expect argument 2 but it was called with undefined." +Expected: \\"foo\\" +Received: \\"foo\\", undefined + +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith includes the custom mock name in the error message 1`] = ` @@ -1391,11 +1356,11 @@ Received has value: [Function fn]" `; exports[`toHaveBeenLastCalledWith works when not called 1`] = ` -"expect(jest.fn()).toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).toHaveBeenLastCalledWith(...expected) + +Expected: \\"foo\\", \\"bar\\" -Expected mock function to have been last called with: - [\\"foo\\", \\"bar\\"] -But it was not called." +Number of calls: 0" `; exports[`toHaveBeenLastCalledWith works with Immutable.js objects 1`] = ` @@ -1415,14 +1380,7 @@ Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with Map 2`] = ` -"expect(jest.fn()).toHaveBeenLastCalledWith(expected) - -Expected mock function to have been last called with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -as argument 1, but it was called with - Map {1 => 2, 2 => 1}. - -Difference: +"expect(jest.fn()).toHaveBeenLastCalledWith(...expected) - Expected + Received @@ -1432,7 +1390,9 @@ Difference: - \\"b\\" => \\"a\\", + 1 => 2, + 2 => 1, - }" + }, + +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with Set 1`] = ` @@ -1444,14 +1404,7 @@ Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with Set 2`] = ` -"expect(jest.fn()).toHaveBeenLastCalledWith(expected) - -Expected mock function to have been last called with: - Set {3, 4} -as argument 1, but it was called with - Set {1, 2}. - -Difference: +"expect(jest.fn()).toHaveBeenLastCalledWith(...expected) - Expected + Received @@ -1461,16 +1414,18 @@ Difference: - 4, + 1, + 2, - }" + }, + +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).toHaveBeenLastCalledWith(...expected) + +Expected: \\"foo\\", \\"bar\\" +Received: \\"foo\\", \\"bar1\\" -Expected mock function to have been last called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +Number of calls: 1" `; exports[`toHaveBeenLastCalledWith works with arguments that match 1`] = ` @@ -1493,19 +1448,23 @@ Number of calls: 3" `; exports[`toHaveBeenLastCalledWith works with many arguments that don't match 1`] = ` -"expect(jest.fn()).toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).toHaveBeenLastCalledWith(...expected) + +Expected: \\"foo\\", \\"bar\\" +Received + 2: \\"foo\\", \\"bar2\\" +-> 3: \\"foo\\", \\"bar3\\" -Expected mock function to have been last called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar3\\"." +Number of calls: 3" `; exports[`toHaveBeenLastCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).toHaveBeenLastCalledWith(expected) +"expect(jest.fn()).toHaveBeenLastCalledWith(...expected) -Expected mock function to have been last called with: - Did not expect argument 2 but it was called with undefined." +Expected: \\"foo\\" +Received: \\"foo\\", undefined + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith includes the custom mock name in the error message 1`] = ` @@ -1554,11 +1513,12 @@ Received has value: [Function fn]" `; exports[`toHaveBeenNthCalledWith works when not called 1`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) -Expected mock function first call to have been called with: - [\\"foo\\", \\"bar\\"] -But it was not called." +n: 1 +Expected: \\"foo\\", \\"bar\\" + +Number of calls: 0" `; exports[`toHaveBeenNthCalledWith works with Immutable.js objects 1`] = ` @@ -1580,15 +1540,9 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Map 2`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(expected) - -Expected mock function first call to have been called with: - Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} -as argument 1, but it was called with - Map {1 => 2, 2 => 1}. - -Difference: +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) +n: 1 - Expected + Received @@ -1597,7 +1551,9 @@ Difference: - \\"b\\" => \\"a\\", + 1 => 2, + 2 => 1, - }" + }, + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Set 1`] = ` @@ -1610,15 +1566,9 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Set 2`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(expected) - -Expected mock function first call to have been called with: - Set {3, 4} -as argument 1, but it was called with - Set {1, 2}. - -Difference: +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) +n: 1 - Expected + Received @@ -1627,16 +1577,19 @@ Difference: - 4, + 1, + 2, - }" + }, + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) -Expected mock function first call to have been called with: - \\"bar\\" -as argument 2, but it was called with - \\"bar1\\"." +n: 1 +Expected: \\"foo\\", \\"bar\\" +Received: \\"foo\\", \\"bar1\\" + +Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with arguments that match 1`] = ` @@ -1661,10 +1614,13 @@ Number of calls: 3" `; exports[`toHaveBeenNthCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) + +n: 1 +Expected: \\"foo\\" +Received: \\"foo\\", undefined -Expected mock function first call to have been called with: - Did not expect argument 2 but it was called with undefined." +Number of calls: 1" `; exports[`toHaveLastReturnedWith a call that throws is not considered to have returned 1`] = ` diff --git a/packages/expect/src/spyMatchers.ts b/packages/expect/src/spyMatchers.ts index 7be62b35d270..890dfce1f18b 100644 --- a/packages/expect/src/spyMatchers.ts +++ b/packages/expect/src/spyMatchers.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import getType, {isPrimitive} from 'jest-get-type'; import { diff, ensureExpectedIsNumber, @@ -22,11 +23,12 @@ import { } from 'jest-matcher-utils'; import {MatchersObject, MatcherState, SyncExpectationResult} from './types'; import {equals} from './jasmineUtils'; -import {iterableEquality, partition, isOneline} from './utils'; +import {iterableEquality} from './utils'; + +// The optional property of matcher context is true if undefined. +const isExpand = (expand?: boolean): boolean => expand !== false; const PRINT_LIMIT = 3; -const CALL_PRINT_LIMIT = 3; -const LAST_CALL_PRINT_LIMIT = 1; const NO_ARGUMENTS = 'called with 0 arguments'; @@ -99,8 +101,6 @@ const getRightAlignedPrinter = (label: string): PrintLabel => { type IndexedCall = [number, Array]; -// Return either empty string or one line per indexed result, -// so additional empty line can separate from `Number of returns` which follows. const printReceivedCallsNegative = ( expected: Array, indexedCalls: Array, @@ -131,6 +131,188 @@ const printReceivedCallsNegative = ( ); }; +const printExpectedReceivedCallsPositive = ( + expected: Array, + indexedCalls: Array, + expand: boolean, + isOnlyCall: boolean, + iExpectedCall?: number, +) => { + const expectedLine = `Expected: ${printExpectedArgs(expected)}\n`; + if (indexedCalls.length === 0) { + return expectedLine; + } + + const label = 'Received: '; + if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) { + const received = indexedCalls[0][1]; + + if (isLineDiffableCall(expected, received)) { + // Display diff without indentation. + const lines = [ + EXPECTED_COLOR('- Expected'), + RECEIVED_COLOR('+ Received'), + '', + ]; + + const length = Math.max(expected.length, received.length); + for (let i = 0; i < length; i += 1) { + if (i < expected.length && i < received.length) { + if (isEqualValue(expected[i], received[i])) { + lines.push(` ${printCommon(received[i])},`); + continue; + } + + if (isLineDiffableArg(expected[i], received[i])) { + const difference = diff(expected[i], received[i], {expand}); + if ( + typeof difference === 'string' && + difference.includes('- Expected') && + difference.includes('+ Received') + ) { + // Omit annotation in case multiple args have diff. + lines.push( + difference + .split('\n') + .slice(3) + .join('\n') + ',', + ); + continue; + } + } + } + + if (i < expected.length) { + lines.push(EXPECTED_COLOR('- ' + stringify(expected[i])) + ','); + } + if (i < received.length) { + lines.push(RECEIVED_COLOR('+ ' + stringify(received[i])) + ','); + } + } + + return lines.join('\n') + '\n'; + } + + return expectedLine + label + printReceivedArgs(received, expected) + '\n'; + } + + const printAligned = getRightAlignedPrinter(label); + + return ( + expectedLine + + 'Received\n' + + indexedCalls.reduce((printed: string, [i, received]: IndexedCall) => { + const aligned = printAligned(String(i + 1), i === iExpectedCall); + return ( + printed + + ((i === iExpectedCall || iExpectedCall === undefined) && + isLineDiffableCall(expected, received) + ? aligned.replace(': ', '\n') + + printDiffCall(expected, received, expand) + : aligned + printReceivedArgs(received, expected)) + + '\n' + ); + }, '') + ); +}; + +const indentation = 'Received'.replace(/\w/g, ' '); + +const printDiffCall = ( + expected: Array, + received: Array, + expand: boolean, +) => + received + .map((arg, i) => { + if (i < expected.length) { + if (isEqualValue(expected[i], arg)) { + return indentation + ' ' + printCommon(arg) + ','; + } + + if (isLineDiffableArg(expected[i], arg)) { + const difference = diff(expected[i], arg, {expand}); + + if ( + typeof difference === 'string' && + difference.includes('- Expected') && + difference.includes('+ Received') + ) { + // Display diff with indentation. + // Omit annotation in case multiple args have diff. + return ( + difference + .split('\n') + .slice(3) + .map(line => indentation + line) + .join('\n') + ',' + ); + } + } + } + + // Display + only if received arg has no corresponding expected arg. + return ( + indentation + + (i < expected.length + ? ' ' + printReceived(arg) + : RECEIVED_COLOR('+ ' + stringify(arg))) + + ',' + ); + }) + .join('\n'); + +const isLineDiffableCall = ( + expected: Array, + received: Array, +): boolean => + expected.some( + (arg, i) => i < received.length && isLineDiffableArg(arg, received[i]), + ); + +// Almost redundant with function in jest-matcher-utils, +// except no line diff for any strings. +const isLineDiffableArg = (expected: unknown, received: unknown): boolean => { + const expectedType = getType(expected); + const receivedType = getType(received); + + if (expectedType !== receivedType) { + return false; + } + + if (isPrimitive(expected)) { + return false; + } + + if ( + expectedType === 'date' || + expectedType === 'function' || + expectedType === 'regexp' + ) { + return false; + } + + if (expected instanceof Error && received instanceof Error) { + return false; + } + + if ( + expectedType === 'object' && + typeof (expected as any).asymmetricMatch === 'function' + ) { + return false; + } + + if ( + receivedType === 'object' && + typeof (received as any).asymmetricMatch === 'function' + ) { + return false; + } + + return true; +}; + const printResult = (result: any) => result.type === 'throw' ? 'function call threw an error' @@ -152,7 +334,7 @@ const printReceivedResults = ( return ''; } - if (isOnlyCall) { + if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) { return label + printResult(indexedResults[0][1]) + '\n'; } @@ -375,21 +557,13 @@ const createToBeCalledWithMatcher = (matcherName: string) => ensureMockOrSpy(received, matcherName, expectedArgument, options); const receivedIsSpy = isSpy(received); - const type = receivedIsSpy ? 'spy' : 'mock function'; const receivedName = receivedIsSpy ? 'spy' : received.getMockName(); - const identifier = - receivedIsSpy || receivedName === 'jest.fn()' - ? type - : `${type} "${receivedName}"`; const calls = receivedIsSpy ? received.calls.all().map((x: any) => x.args) : received.mock.calls; - const [match, fail] = partition(calls, call => - isEqualCall(expected, call as Array), - ); - const pass = match.length > 0; + const pass = calls.some((call: any) => isEqualCall(expected, call)); const message = pass ? () => { @@ -417,11 +591,27 @@ const createToBeCalledWithMatcher = (matcherName: string) => `\nNumber of calls: ${printReceived(calls.length)}` ); } - : () => - matcherHint('.' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} to have been called with:\n` + - formatMismatchedCalls(fail, expected, CALL_PRINT_LIMIT); + : () => { + // Some examples of calls that are not equal to expected value. + const indexedCalls: Array = []; + let i = 0; + while (i < calls.length && indexedCalls.length < PRINT_LIMIT) { + indexedCalls.push([i, calls[i]]); + i += 1; + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + printExpectedReceivedCallsPositive( + expected, + indexedCalls, + isExpand(this.expand), + calls.length === 1, + ) + + `\nNumber of calls: ${printReceived(calls.length)}` + ); + }; return {message, pass}; }; @@ -511,12 +701,7 @@ const createLastCalledWithMatcher = (matcherName: string) => ensureMockOrSpy(received, matcherName, expectedArgument, options); const receivedIsSpy = isSpy(received); - const type = receivedIsSpy ? 'spy' : 'mock function'; const receivedName = receivedIsSpy ? 'spy' : received.getMockName(); - const identifier = - receivedIsSpy || receivedName === 'jest.fn()' - ? type - : `${type} "${receivedName}"`; const calls = receivedIsSpy ? received.calls.all().map((x: any) => x.args) @@ -549,11 +734,38 @@ const createLastCalledWithMatcher = (matcherName: string) => `\nNumber of calls: ${printReceived(calls.length)}` ); } - : () => - matcherHint('.' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} to have been last called with:\n` + - formatMismatchedCalls(calls, expected, LAST_CALL_PRINT_LIMIT); + : () => { + const indexedCalls: Array = []; + if (iLast >= 0) { + if (iLast > 0) { + let i = iLast - 1; + // Is there a preceding call that is equal to expected args? + while (i >= 0 && !isEqualCall(expected, calls[i])) { + i -= 1; + } + if (i < 0) { + i = iLast - 1; // otherwise, preceding call + } + + indexedCalls.push([i, calls[i]]); + } + + indexedCalls.push([iLast, calls[iLast]]); + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + printExpectedReceivedCallsPositive( + expected, + indexedCalls, + isExpand(this.expand), + calls.length === 1, + iLast, + ) + + `\nNumber of calls: ${printReceived(calls.length)}` + ); + }; return {message, pass}; }; @@ -666,13 +878,7 @@ const createNthCalledWithMatcher = (matcherName: string) => } const receivedIsSpy = isSpy(received); - const type = receivedIsSpy ? 'spy' : 'mock function'; - const receivedName = receivedIsSpy ? 'spy' : received.getMockName(); - const identifier = - receivedIsSpy || receivedName === 'jest.fn()' - ? type - : `${type} "${receivedName}"`; const calls = receivedIsSpy ? received.calls.all().map((x: any) => x.args) @@ -711,17 +917,66 @@ const createNthCalledWithMatcher = (matcherName: string) => `\nNumber of calls: ${printReceived(calls.length)}` ); } - : () => - matcherHint('.' + matcherName, receivedName) + - '\n\n' + - `Expected ${identifier} ${nthToString( - nth, - )} call to have been called with:\n` + - formatMismatchedCalls( - calls[nth - 1] ? [calls[nth - 1]] : [], - expected, - LAST_CALL_PRINT_LIMIT, + : () => { + // Display preceding and following calls: + // * nearest call that is equal to expected args + // * otherwise, adjacent call + // in case assertions fails because of index, especially off by one. + const indexedCalls: Array = []; + if (iNth < length) { + if (iNth - 1 >= 0) { + let i = iNth - 1; + // Is there a preceding call that is equal to expected args? + while (i >= 0 && !isEqualCall(expected, calls[i])) { + i -= 1; + } + if (i < 0) { + i = iNth - 1; // otherwise, adjacent call + } + + indexedCalls.push([i, calls[i]]); + } + indexedCalls.push([iNth, calls[iNth]]); + if (iNth + 1 < length) { + let i = iNth + 1; + // Is there a following call that is equal to expected args? + while (i < length && !isEqualCall(expected, calls[i])) { + i += 1; + } + if (i >= length) { + i = iNth + 1; // otherwise, adjacent call + } + + indexedCalls.push([i, calls[i]]); + } + } else if (length > 0) { + // The number of received calls is fewer than the expected number. + let i = length - 1; + // Is there a call that is equal to expected args? + while (i >= 0 && !isEqualCall(expected, calls[i])) { + i -= 1; + } + if (i < 0) { + i = length - 1; // otherwise, last call + } + + indexedCalls.push([i, calls[i]]); + } + + return ( + matcherHint(matcherName, receivedName, expectedArgument, options) + + '\n\n' + + `n: ${nth}\n` + + printExpectedReceivedCallsPositive( + expected, + indexedCalls, + isExpand(this.expand), + calls.length === 1, + iNth, + ) + + `\nNumber of calls: ${printReceived(calls.length)}` ); + }; return {message, pass}; }; @@ -923,77 +1178,4 @@ const ensureMock = ( } }; -const getPrintedCalls = ( - calls: Array, - limit: number, - sep: string, - fn: Function, -): string => { - const result = []; - let i = calls.length; - - while (--i >= 0 && --limit >= 0) { - result.push(fn(calls[i])); - } - - return result.join(sep); -}; - -const formatMismatchedCalls = ( - calls: Array, - expected: any, - limit: number, -): string => { - if (calls.length) { - return getPrintedCalls( - calls, - limit, - '\n\n', - formatMismatchedArgs.bind(null, expected), - ); - } else { - return ( - ` ${printExpected(expected)}\n` + - `But it was ${RECEIVED_COLOR('not called')}.` - ); - } -}; - -const formatMismatchedArgs = (expected: any, received: any): string => { - const length = Math.max(expected.length, received.length); - - const printedArgs = []; - for (let i = 0; i < length; i++) { - if (!equals(expected[i], received[i], [iterableEquality])) { - const oneline = isOneline(expected[i], received[i]); - const diffString = diff(expected[i], received[i]); - printedArgs.push( - ` ${printExpected(expected[i])}\n` + - `as argument ${i + 1}, but it was called with\n` + - ` ${printReceived(received[i])}.` + - (diffString && !oneline ? `\n\nDifference:\n\n${diffString}` : ''), - ); - } else if (i >= expected.length) { - printedArgs.push( - ` Did not expect argument ${i + 1} ` + - `but it was called with ${printReceived(received[i])}.`, - ); - } - } - - return printedArgs.join('\n'); -}; - -const nthToString = (nth: number): string => { - switch (nth) { - case 1: - return 'first'; - case 2: - return 'second'; - case 3: - return 'third'; - } - return `${nth}th`; -}; - export default spyMatchers; From 2eea09fbe1f64ede934179b5af72e3dbfd9d0665 Mon Sep 17 00:00:00 2001 From: Patrick Carroll Date: Sun, 4 Aug 2019 14:40:53 -0700 Subject: [PATCH 18/34] Update ManualMocks.md (#8781) --- docs/ManualMocks.md | 2 +- website/versioned_docs/version-22.x/ManualMocks.md | 2 +- website/versioned_docs/version-23.x/ManualMocks.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ManualMocks.md b/docs/ManualMocks.md index 2d4f549f9c63..f3da20638962 100644 --- a/docs/ManualMocks.md +++ b/docs/ManualMocks.md @@ -9,7 +9,7 @@ Manual mocks are used to stub out functionality with mock data. For example, ins Manual mocks are defined by writing a module in a `__mocks__/` subdirectory immediately adjacent to the module. For example, to mock a module called `user` in the `models` directory, create a file called `user.js` and put it in the `models/__mocks__` directory. Note that the `__mocks__` folder is case-sensitive, so naming the directory `__MOCKS__` will break on some systems. -> When we require that module in our tests, then explicitly calling `jest.mock('./moduleName')` is **required**. +> When we require that module in our tests, explicitly calling `jest.mock('./moduleName')` is **required**. ## Mocking Node modules diff --git a/website/versioned_docs/version-22.x/ManualMocks.md b/website/versioned_docs/version-22.x/ManualMocks.md index 3f3f5a8d4180..5168e970bda0 100644 --- a/website/versioned_docs/version-22.x/ManualMocks.md +++ b/website/versioned_docs/version-22.x/ManualMocks.md @@ -10,7 +10,7 @@ Manual mocks are used to stub out functionality with mock data. For example, ins Manual mocks are defined by writing a module in a `__mocks__/` subdirectory immediately adjacent to the module. For example, to mock a module called `user` in the `models` directory, create a file called `user.js` and put it in the `models/__mocks__` directory. Note that the `__mocks__` folder is case-sensitive, so naming the directory `__MOCKS__` will break on some systems. -> When we require that module in our tests, then explicitly calling `jest.mock('./moduleName')` is **required**. +> When we require that module in our tests, explicitly calling `jest.mock('./moduleName')` is **required**. ## Mocking Node modules diff --git a/website/versioned_docs/version-23.x/ManualMocks.md b/website/versioned_docs/version-23.x/ManualMocks.md index 86f0a7f0ddbe..1dc9d0aaeda9 100644 --- a/website/versioned_docs/version-23.x/ManualMocks.md +++ b/website/versioned_docs/version-23.x/ManualMocks.md @@ -10,7 +10,7 @@ Manual mocks are used to stub out functionality with mock data. For example, ins Manual mocks are defined by writing a module in a `__mocks__/` subdirectory immediately adjacent to the module. For example, to mock a module called `user` in the `models` directory, create a file called `user.js` and put it in the `models/__mocks__` directory. Note that the `__mocks__` folder is case-sensitive, so naming the directory `__MOCKS__` will break on some systems. -> When we require that module in our tests, then explicitly calling `jest.mock('./moduleName')` is **required**. +> When we require that module in our tests, explicitly calling `jest.mock('./moduleName')` is **required**. ## Mocking Node modules From e740de246b3a5ef4a7692f2f58bf8223323e4daf Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Tue, 6 Aug 2019 04:59:16 -0400 Subject: [PATCH 19/34] chore: Make sure copyright header comment includes license (#8783) * chore: Make sure copyright header comment includes license * Add period at end of copyright line in checkCopyrightHeaders.js :) * Update CHANGELOG.md --- CHANGELOG.md | 2 +- babel.config.js | 7 +- .../__snapshots__/beforeAllFiltered.ts.snap | 10 +- .../__snapshots__/beforeEachQueue.ts.snap | 10 +- .../coverageRemapping.test.ts.snap | 108 +++++++++--------- .../__snapshots__/detectOpenHandles.ts.snap | 28 ++--- .../__snapshots__/failures.test.ts.snap | 108 +++++++++--------- .../__snapshots__/processExit.test.ts.snap | 16 +-- .../resolveNoFileExtensions.test.ts.snap | 10 +- e2e/async-regenerator/__tests__/test.js | 7 +- e2e/async-regenerator/babel.config.js | 7 +- e2e/babel-plugin-jest-hoist/babel.config.js | 7 +- .../__tests__/beforeAllFiltered.test.js | 7 +- .../__tests__/beforeEachQueue.test.js | 7 +- .../__tests__/failedAssertion.js | 7 +- .../__tests__/coveredTest.ts | 8 +- e2e/coverage-remapping/covered.ts | 7 +- e2e/coverage-report/babel.config.js | 7 +- e2e/custom-resolver/__mocks__/manualMock.js | 7 +- e2e/custom-resolver/bar.js | 7 +- e2e/custom-resolver/foo.js | 7 +- e2e/custom-resolver/manualMock.js | 7 +- e2e/custom-resolver/resolver.js | 7 +- e2e/deprecated-cli-options/__tests__/dummy.js | 7 +- e2e/detect-open-handles/__tests__/inside.js | 7 +- e2e/detect-open-handles/__tests__/outside.js | 7 +- e2e/detect-open-handles/__tests__/promise.js | 7 +- e2e/detect-open-handles/babel.config.js | 7 +- e2e/detect-open-handles/server.js | 7 +- e2e/expect-async-matcher/babel.config.js | 7 +- e2e/failures/__tests__/duringTests.test.js | 7 +- e2e/failures/babel.config.js | 7 +- e2e/filter/my-broken-filter.js | 7 +- e2e/filter/my-broken-setup-filter.js | 7 +- e2e/filter/my-clowny-filter.js | 7 +- e2e/filter/my-filter.js | 7 +- e2e/filter/my-secondary-filter.js | 7 +- e2e/filter/my-setup-filter.js | 7 +- e2e/global-setup-custom-transform/index.js | 7 +- .../transformer.js | 7 +- e2e/global-setup/babel.config.js | 7 +- .../custom-tests-dir/pass.test.js | 7 +- e2e/global-setup/invalidSetup.js | 7 +- e2e/global-teardown/babel.config.js | 7 +- .../custom-tests-dir/pass.test.js | 7 +- e2e/global-teardown/invalidTeardown.js | 7 +- .../__tests__/pendingInPromise.test.js | 7 +- .../bar/__tests__/boggusBar.test.js | 7 +- .../foo/__tests__/boggusFoo.test.js | 7 +- e2e/native-async-mock/Native.js | 7 +- .../__tests__/nativeAsyncMock.test.js | 7 +- e2e/override-globals/babel.config.js | 7 +- .../jest-preset-js/jest-preset.js | 7 +- .../js/node_modules/jest-preset-js/mapper.js | 7 +- .../node_modules/jest-preset-json/mapper.js | 7 +- e2e/process-exit/__tests__/test.js | 7 +- e2e/process-exit/babel.config.js | 7 +- e2e/require-main/babel.config.js | 7 +- e2e/resolve-get-paths/babel.config.js | 7 +- e2e/resolve-no-extensions/__tests__/test.js | 7 +- e2e/resolve-no-extensions/babel.config.js | 7 +- e2e/resolve-no-extensions/index.js | 7 +- e2e/resolve-with-paths/babel.config.js | 7 +- e2e/run-programmatically/babel.config.js | 7 +- .../__tests__/snapshot.test.js | 7 +- .../customSnapshotResolver.js | 7 +- e2e/test-environment-async/TestEnvironment.js | 7 +- .../CircusHandleTestEventEnvironment.js | 7 +- .../__tests__/circusHandleTestEvent.test.js | 3 + .../DocblockPragmasEnvironment.js | 7 +- .../__tests__/docblockPragmas.test.js | 3 + .../timerAndMock.test.js | 7 +- .../with-reset-mocks/timerWithMock.test.js | 7 +- .../__tests__/useRealTimers.test.js | 7 +- e2e/to-match-inline-snapshot/babel.config.js | 7 +- .../babel.config.js | 7 +- .../__tests__/linkedModules.test.js | 7 +- .../ignored/normal.js | 7 +- e2e/transform-linked-modules/package/index.js | 7 +- e2e/transform-linked-modules/preprocessor.js | 7 +- .../babel-jest-ignored/babel.config.js | 7 +- e2e/transform/babel-jest/babel.config.js | 7 +- .../babel.config.js | 7 +- .../ecmascript-modules-support/src/index.mjs | 7 +- .../ecmascript-modules-support/src/module.mjs | 7 +- .../multiple-transformers/babel.config.js | 7 +- .../__tests__/coveredTest.ts | 7 +- e2e/typescript-coverage/covered.ts | 7 +- .../typescriptPreprocessor.js | 7 +- jest.config.ci.js | 7 +- jest.config.js | 7 +- packages/jest-circus/runner.js | 5 +- .../src/__mocks__/testEventHandler.ts | 5 +- .../jest-circus/src/__mocks__/testUtils.ts | 5 +- .../src/__tests__/afterAll.test.ts | 5 +- .../src/__tests__/baseTest.test.ts | 5 +- .../jest-circus/src/__tests__/hooks.test.ts | 5 +- .../has_jest_config_file/jest.config.js | 7 +- .../src/__tests__/Defaults.test.ts | 7 +- .../src/__tests__/readConfig.test.ts | 7 +- .../src/__tests__/readConfigs.test.ts | 7 +- .../jest-core/src/SnapshotInteractiveMode.ts | 5 +- .../src/__tests__/FailedTestsCache.test.js | 7 +- .../__fixtures__/watch_plugin_throws.js | 7 +- .../__snapshots__/watch.test.js.snap | 2 +- .../__tests__/getNoTestsFoundMessage.test.js | 7 +- .../jest-core/src/__tests__/run_jest.test.js | 7 +- .../test_root/__testtests__/test.foobar | 7 +- .../__tests__/test_root/__testtests__/test.js | 7 +- .../test_root/__testtests__/test.jsx | 7 +- .../src/__tests__/test_root/module.foobar | 7 +- .../src/__tests__/test_root/module.jsx | 7 +- .../src/__tests__/test_root/no_tests.js | 7 +- .../__testtests__/test.js | 7 +- .../test_root_with_(parentheses)/module.jsx | 7 +- .../jest-core/src/getNoTestFoundFailed.ts | 7 +- .../src/getNoTestFoundPassWithNoTests.ts | 7 +- .../getNoTestFoundRelatedToChangedFiles.ts | 7 +- .../jest-core/src/getNoTestFoundVerbose.ts | 7 +- packages/jest-core/src/pluralize.ts | 7 +- .../jest-docblock/src/__tests__/index.test.ts | 1 - .../src/lib/__tests__/fast_path.test.js | 2 - .../__tests__/getPlatformExtension.test.js | 2 - .../lib/__tests__/normalizePathSep.test.js | 2 - .../src/__tests__/index.test.ts | 7 +- .../src/__tests__/index.test.ts | 7 +- packages/jest-repl/src/cli/repl.ts | 2 - .../src/__tests__/isBuiltinModule.test.ts | 7 +- .../src/__tests__/defaultResolver.js | 7 +- .../__mocks__/nested1/nested2/nested3.js | 7 +- .../test_root/dep_on_mapped_module.js | 7 +- .../test_root/mapped_dir/moduleInMapped.js | 7 +- .../test_root/nested1/nested2/nested3.js | 7 +- .../node_modules/jest-resolve-test/browser.js | 7 +- .../node_modules/jest-resolve-test/node.js | 7 +- .../sourcemaps/out/throwing-mapped-fn.js | 12 +- .../sourcemaps/throwing-mapped-fn.js | 5 +- packages/jest-runtime/src/helpers.ts | 7 +- .../jest-snapshot/src/__mocks__/prettier.js | 7 +- ...customSnapshotResolver-inconsistent-fns.js | 7 +- ...hotResolver-missing-resolveSnapshotPath.js | 7 +- ...napshotResolver-missing-resolveTestPath.js | 7 +- ...missing-test-path-for-consistency-check.js | 7 +- .../fixtures/customSnapshotResolver.js | 7 +- .../src/__tests__/snapshot_resolver.test.ts | 7 +- .../src/__tests__/getCallsite.test.ts | 7 +- .../src/enhanceUnexpectedTokenMessage.ts | 7 +- .../src/__tests__/isInteractive.test.ts | 7 +- packages/jest-util/src/isInteractive.ts | 7 +- .../src/lib/__tests__/scroll.test.ts | 7 +- scripts/checkCopyrightHeaders.js | 16 ++- scripts/remove-postinstall.js | 7 +- website/fetchSupporters.js | 7 +- website/languages.js | 3 + website/pages/en/videos.js | 7 +- website/siteConfig.js | 3 +- website/static/css/custom.css | 7 +- website/static/css/hljs-jest.css | 7 +- website/static/css/jest.css | 7 +- website/static/landing.js | 7 +- 160 files changed, 985 insertions(+), 323 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 696eeb23d138..6283466826be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,7 @@ - `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753)) - `[docs]` Updated imports of react-testing-library to @testing-library/react in website ([#8757](https://github.com/facebook/jest/pull/8757)) - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) -- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) +- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783)) ### Performance diff --git a/babel.config.js b/babel.config.js index 1b7ec83a43ec..7e1e2aeaf94d 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { babelrcRoots: ['examples/*'], diff --git a/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap b/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap index 45020a37634b..247de33015d5 100644 --- a/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap +++ b/e2e/__tests__/__snapshots__/beforeAllFiltered.ts.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Correct BeforeAll run ensures the BeforeAll of ignored suite is not run 1`] = ` - console.log __tests__/beforeAllFiltered.test.js:5 + console.log __tests__/beforeAllFiltered.test.js:10 beforeAll 1 - console.log __tests__/beforeAllFiltered.test.js:8 + console.log __tests__/beforeAllFiltered.test.js:13 beforeEach 1 - console.log __tests__/beforeAllFiltered.test.js:17 + console.log __tests__/beforeAllFiltered.test.js:22 It Foo - console.log __tests__/beforeAllFiltered.test.js:11 + console.log __tests__/beforeAllFiltered.test.js:16 afterEach 1 - console.log __tests__/beforeAllFiltered.test.js:14 + console.log __tests__/beforeAllFiltered.test.js:19 afterAll 1 `; diff --git a/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap b/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap index 98ede3375283..a665905a9f06 100644 --- a/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap +++ b/e2e/__tests__/__snapshots__/beforeEachQueue.ts.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Correct beforeEach order ensures the correct order for beforeEach 1`] = ` - console.log __tests__/beforeEachQueue.test.js:5 + console.log __tests__/beforeEachQueue.test.js:10 BeforeEach - console.log __tests__/beforeEachQueue.test.js:9 + console.log __tests__/beforeEachQueue.test.js:14 It Foo - console.log __tests__/beforeEachQueue.test.js:12 + console.log __tests__/beforeEachQueue.test.js:17 BeforeEach Inline Foo - console.log __tests__/beforeEachQueue.test.js:5 + console.log __tests__/beforeEachQueue.test.js:10 BeforeEach - console.log __tests__/beforeEachQueue.test.js:17 + console.log __tests__/beforeEachQueue.test.js:22 It Bar `; diff --git a/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap b/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap index ee84a8e4d887..924acea07ce9 100644 --- a/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap @@ -27,32 +27,32 @@ Object { "loc": Object { "end": Object { "column": 35, - "line": 6, + "line": 11, }, "start": Object { "column": 34, - "line": 6, + "line": 11, }, }, "locations": Array [ Object { "end": Object { "column": 35, - "line": 6, + "line": 11, }, "start": Object { "column": 34, - "line": 6, + "line": 11, }, }, Object { "end": Object { "column": 39, - "line": 6, + "line": 11, }, "start": Object { "column": 38, - "line": 6, + "line": 11, }, }, ], @@ -62,32 +62,32 @@ Object { "loc": Object { "end": Object { "column": 35, - "line": 7, + "line": 12, }, "start": Object { "column": 34, - "line": 7, + "line": 12, }, }, "locations": Array [ Object { "end": Object { "column": 35, - "line": 7, + "line": 12, }, "start": Object { "column": 34, - "line": 7, + "line": 12, }, }, Object { "end": Object { "column": 39, - "line": 7, + "line": 12, }, "start": Object { "column": 38, - "line": 7, + "line": 12, }, }, ], @@ -97,42 +97,42 @@ Object { "loc": Object { "end": Object { "column": 31, - "line": 8, + "line": 13, }, "start": Object { "column": 27, - "line": 8, + "line": 13, }, }, "locations": Array [ Object { "end": Object { "column": 31, - "line": 8, + "line": 13, }, "start": Object { "column": 27, - "line": 8, + "line": 13, }, }, Object { "end": Object { "column": 39, - "line": 8, + "line": 13, }, "start": Object { "column": 35, - "line": 8, + "line": 13, }, }, Object { "end": Object { "column": 48, - "line": 8, + "line": 13, }, "start": Object { "column": 43, - "line": 8, + "line": 13, }, }, ], @@ -142,32 +142,32 @@ Object { "loc": Object { "end": Object { "column": 40, - "line": 9, + "line": 14, }, "start": Object { "column": 30, - "line": 9, + "line": 14, }, }, "locations": Array [ Object { "end": Object { "column": 40, - "line": 9, + "line": 14, }, "start": Object { "column": 30, - "line": 9, + "line": 14, }, }, Object { "end": Object { "column": 53, - "line": 9, + "line": 14, }, "start": Object { "column": 43, - "line": 9, + "line": 14, }, }, ], @@ -184,21 +184,21 @@ Object { "decl": Object { "end": Object { "column": 29, - "line": 5, + "line": 10, }, "start": Object { "column": 9, - "line": 5, + "line": 10, }, }, "loc": Object { "end": Object { "column": 1, - "line": 12, + "line": 17, }, "start": Object { "column": 49, - "line": 5, + "line": 10, }, }, "name": "difference", @@ -207,21 +207,21 @@ Object { "decl": Object { "end": Object { "column": 36, - "line": 9, + "line": 14, }, "start": Object { "column": 30, - "line": 9, + "line": 14, }, }, "loc": Object { "end": Object { "column": 40, - "line": 9, + "line": 14, }, "start": Object { "column": 30, - "line": 9, + "line": 14, }, }, "name": "(anonymous_1)", @@ -230,21 +230,21 @@ Object { "decl": Object { "end": Object { "column": 49, - "line": 9, + "line": 14, }, "start": Object { "column": 43, - "line": 9, + "line": 14, }, }, "loc": Object { "end": Object { "column": 53, - "line": 9, + "line": 14, }, "start": Object { "column": 43, - "line": 9, + "line": 14, }, }, "name": "(anonymous_2)", @@ -265,81 +265,81 @@ Object { "0": Object { "end": Object { "column": 2, - "line": 12, + "line": 17, }, "start": Object { "column": 0, - "line": 5, + "line": 10, }, }, "1": Object { "end": Object { "column": 39, - "line": 6, + "line": 11, }, "start": Object { "column": 27, - "line": 6, + "line": 11, }, }, "2": Object { "end": Object { "column": 39, - "line": 7, + "line": 12, }, "start": Object { "column": 27, - "line": 7, + "line": 12, }, }, "3": Object { "end": Object { "column": 48, - "line": 8, + "line": 13, }, "start": Object { "column": 27, - "line": 8, + "line": 13, }, }, "4": Object { "end": Object { "column": 53, - "line": 9, + "line": 14, }, "start": Object { "column": 23, - "line": 9, + "line": 14, }, }, "5": Object { "end": Object { "column": 43, - "line": 9, + "line": 14, }, "start": Object { "column": 36, - "line": 9, + "line": 14, }, }, "6": Object { "end": Object { "column": 54, - "line": 9, + "line": 14, }, "start": Object { "column": 49, - "line": 9, + "line": 14, }, }, "7": Object { "end": Object { "column": 15, - "line": 11, + "line": 16, }, "start": Object { "column": 2, - "line": 11, + "line": 16, }, }, }, diff --git a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap index eb668ee97c2f..adde74db4e47 100644 --- a/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap +++ b/e2e/__tests__/__snapshots__/detectOpenHandles.ts.snap @@ -13,14 +13,14 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit ● GETADDRINFOREQWRAP - 7 | const app = new Server(); - 8 | - > 9 | app.listen({host: 'localhost', port: 0}); + 12 | const app = new Server(); + 13 | + > 14 | app.listen({host: 'localhost', port: 0}); | ^ - 10 | + 15 | - at Object.listen (server.js:9:5) - at Object.require (__tests__/outside.js:3:1) + at Object.listen (server.js:14:5) + at Object.require (__tests__/outside.js:8:1) `; exports[`prints out info about open handlers from inside tests 1`] = ` @@ -28,13 +28,13 @@ Jest has detected the following 1 open handle potentially keeping Jest from exit ● Timeout - 2 | - 3 | test('something', () => { - > 4 | setTimeout(() => {}, 30000); - | ^ - 5 | expect(true).toBe(true); - 6 | }); - 7 | + 7 | + 8 | test('something', () => { + > 9 | setTimeout(() => {}, 30000); + | ^ + 10 | expect(true).toBe(true); + 11 | }); + 12 | - at Object.setTimeout (__tests__/inside.js:4:3) + at Object.setTimeout (__tests__/inside.js:9:3) `; diff --git a/e2e/__tests__/__snapshots__/failures.test.ts.snap b/e2e/__tests__/__snapshots__/failures.test.ts.snap index 6e2ea6c5dafd..a9ad9ea74cf2 100644 --- a/e2e/__tests__/__snapshots__/failures.test.ts.snap +++ b/e2e/__tests__/__snapshots__/failures.test.ts.snap @@ -126,43 +126,43 @@ FAIL __tests__/duringTests.test.js thrown: Promise {} - 7 | }; - 8 | - > 9 | test('Promise thrown during test', () => { + 12 | }; + 13 | + > 14 | test('Promise thrown during test', () => { | ^ - 10 | throw Promise.resolve(5); - 11 | }); - 12 | + 15 | throw Promise.resolve(5); + 16 | }); + 17 | - at Object.test (__tests__/duringTests.test.js:9:1) + at Object.test (__tests__/duringTests.test.js:14:1) ● Boolean thrown during test thrown: false - 11 | }); - 12 | - > 13 | test('Boolean thrown during test', () => { - | ^ - 14 | // eslint-disable-next-line no-throw-literal - 15 | throw false; 16 | }); + 17 | + > 18 | test('Boolean thrown during test', () => { + | ^ + 19 | // eslint-disable-next-line no-throw-literal + 20 | throw false; + 21 | }); - at Object.test (__tests__/duringTests.test.js:13:1) + at Object.test (__tests__/duringTests.test.js:18:1) ● undefined thrown during test thrown: undefined - 16 | }); - 17 | - > 18 | test('undefined thrown during test', () => { - | ^ - 19 | // eslint-disable-next-line no-throw-literal - 20 | throw undefined; 21 | }); + 22 | + > 23 | test('undefined thrown during test', () => { + | ^ + 24 | // eslint-disable-next-line no-throw-literal + 25 | throw undefined; + 26 | }); - at Object.test (__tests__/duringTests.test.js:18:1) + at Object.test (__tests__/duringTests.test.js:23:1) ● Object thrown during test @@ -175,43 +175,43 @@ FAIL __tests__/duringTests.test.js ], } - 21 | }); - 22 | - > 23 | test('Object thrown during test', () => { + 26 | }); + 27 | + > 28 | test('Object thrown during test', () => { | ^ - 24 | throw deepObject; - 25 | }); - 26 | + 29 | throw deepObject; + 30 | }); + 31 | - at Object.test (__tests__/duringTests.test.js:23:1) + at Object.test (__tests__/duringTests.test.js:28:1) ● Error during test ReferenceError: doesNotExist is not defined - 27 | test('Error during test', () => { - 28 | // eslint-disable-next-line no-undef - > 29 | doesNotExist.alsoThisNot; + 32 | test('Error during test', () => { + 33 | // eslint-disable-next-line no-undef + > 34 | doesNotExist.alsoThisNot; | ^ - 30 | }); - 31 | - 32 | test('done(Error)', done => { + 35 | }); + 36 | + 37 | test('done(Error)', done => { - at Object.doesNotExist (__tests__/duringTests.test.js:29:3) + at Object.doesNotExist (__tests__/duringTests.test.js:34:3) ● done(Error) this is an error - 31 | - 32 | test('done(Error)', done => { - > 33 | done(new Error('this is an error')); + 36 | + 37 | test('done(Error)', done => { + > 38 | done(new Error('this is an error')); | ^ - 34 | }); - 35 | - 36 | test('done(non-error)', done => { + 39 | }); + 40 | + 41 | test('done(non-error)', done => { - at Object..done (__tests__/duringTests.test.js:33:8) + at Object..done (__tests__/duringTests.test.js:38:8) ● done(non-error) @@ -224,15 +224,15 @@ FAIL __tests__/duringTests.test.js ], } - 35 | - 36 | test('done(non-error)', done => { - > 37 | done(deepObject); + 40 | + 41 | test('done(non-error)', done => { + > 42 | done(deepObject); | ^ - 38 | }); - 39 | - 40 | test('returned promise rejection', () => Promise.reject(deepObject)); + 43 | }); + 44 | + 45 | test('returned promise rejection', () => Promise.reject(deepObject)); - at Object.done (__tests__/duringTests.test.js:37:3) + at Object.done (__tests__/duringTests.test.js:42:3) ● returned promise rejection @@ -245,13 +245,13 @@ FAIL __tests__/duringTests.test.js ], } - 38 | }); - 39 | - > 40 | test('returned promise rejection', () => Promise.reject(deepObject)); + 43 | }); + 44 | + > 45 | test('returned promise rejection', () => Promise.reject(deepObject)); | ^ - 41 | + 46 | - at Object.test (__tests__/duringTests.test.js:40:1) + at Object.test (__tests__/duringTests.test.js:45:1) `; exports[`works with assertions in separate files 1`] = ` diff --git a/e2e/__tests__/__snapshots__/processExit.test.ts.snap b/e2e/__tests__/__snapshots__/processExit.test.ts.snap index 13915892b8dc..bebf5dc22ee6 100644 --- a/e2e/__tests__/__snapshots__/processExit.test.ts.snap +++ b/e2e/__tests__/__snapshots__/processExit.test.ts.snap @@ -3,14 +3,14 @@ exports[`prints stack trace pointing to process.exit call 1`] = ` ● process.exit called with "1" - 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - 2 | - > 3 | process.exit(1); - | ^ - 4 | - 5 | test('something', () => { - 6 | expect(true).toBe(true); + 6 | */ + 7 | + > 8 | process.exit(1); + | ^ + 9 | + 10 | test('something', () => { + 11 | expect(true).toBe(true); - at Object.exit (__tests__/test.js:3:9) + at Object.exit (__tests__/test.js:8:9) `; diff --git a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap index 7a66f6098b01..bdde57ca78a5 100644 --- a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap @@ -27,12 +27,12 @@ FAIL __tests__/test.js See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string - 1 | // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - 2 | - > 3 | module.exports = require('./some-json-file'); + 6 | */ + 7 | + > 8 | module.exports = require('./some-json-file'); | ^ - 4 | + 9 | at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:259:17) - at Object.require (index.js:3:18) + at Object.require (index.js:8:18) `; diff --git a/e2e/async-regenerator/__tests__/test.js b/e2e/async-regenerator/__tests__/test.js index 16444c6fc0b5..84928a477e29 100644 --- a/e2e/async-regenerator/__tests__/test.js +++ b/e2e/async-regenerator/__tests__/test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('dummy test', async () => { const value = await Promise.resolve(1); diff --git a/e2e/async-regenerator/babel.config.js b/e2e/async-regenerator/babel.config.js index 756b4d62f681..0ac60b8feb3f 100644 --- a/e2e/async-regenerator/babel.config.js +++ b/e2e/async-regenerator/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { plugins: [ diff --git a/e2e/babel-plugin-jest-hoist/babel.config.js b/e2e/babel-plugin-jest-hoist/babel.config.js index 5650b39d7303..eb10f8afde70 100644 --- a/e2e/babel-plugin-jest-hoist/babel.config.js +++ b/e2e/babel-plugin-jest-hoist/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { overrides: [ diff --git a/e2e/before-all-filtered/__tests__/beforeAllFiltered.test.js b/e2e/before-all-filtered/__tests__/beforeAllFiltered.test.js index 5534a95a213c..a37ae43a74c2 100644 --- a/e2e/before-all-filtered/__tests__/beforeAllFiltered.test.js +++ b/e2e/before-all-filtered/__tests__/beforeAllFiltered.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ describe('test_1', () => { beforeAll(() => { diff --git a/e2e/before-each-queue/__tests__/beforeEachQueue.test.js b/e2e/before-each-queue/__tests__/beforeEachQueue.test.js index 017c6095ddf4..84016d82d6b1 100644 --- a/e2e/before-each-queue/__tests__/beforeEachQueue.test.js +++ b/e2e/before-each-queue/__tests__/beforeEachQueue.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ describe('test', () => { beforeEach(() => { diff --git a/e2e/compare-dom-nodes/__tests__/failedAssertion.js b/e2e/compare-dom-nodes/__tests__/failedAssertion.js index 1399fd78965d..01d4476728b7 100644 --- a/e2e/compare-dom-nodes/__tests__/failedAssertion.js +++ b/e2e/compare-dom-nodes/__tests__/failedAssertion.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ /* global document */ diff --git a/e2e/coverage-remapping/__tests__/coveredTest.ts b/e2e/coverage-remapping/__tests__/coveredTest.ts index b430bb59db14..a0c3843d9f91 100644 --- a/e2e/coverage-remapping/__tests__/coveredTest.ts +++ b/e2e/coverage-remapping/__tests__/coveredTest.ts @@ -1,4 +1,10 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ + const difference = require('../covered.ts'); it('subtracts correctly', () => { diff --git a/e2e/coverage-remapping/covered.ts b/e2e/coverage-remapping/covered.ts index 84b8f7ab9c2e..36ba129fd3b2 100644 --- a/e2e/coverage-remapping/covered.ts +++ b/e2e/coverage-remapping/covered.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ /* eslint-disable @typescript-eslint/no-unused-vars */ diff --git a/e2e/coverage-report/babel.config.js b/e2e/coverage-report/babel.config.js index 245aa3fd79db..186d686670e3 100644 --- a/e2e/coverage-report/babel.config.js +++ b/e2e/coverage-report/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { presets: ['@babel/preset-flow'], diff --git a/e2e/custom-resolver/__mocks__/manualMock.js b/e2e/custom-resolver/__mocks__/manualMock.js index 296873363119..86c07dcd7260 100644 --- a/e2e/custom-resolver/__mocks__/manualMock.js +++ b/e2e/custom-resolver/__mocks__/manualMock.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('bar'); diff --git a/e2e/custom-resolver/bar.js b/e2e/custom-resolver/bar.js index 026703fbe530..39f347478b2a 100644 --- a/e2e/custom-resolver/bar.js +++ b/e2e/custom-resolver/bar.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = 'bar'; diff --git a/e2e/custom-resolver/foo.js b/e2e/custom-resolver/foo.js index 08cb1c0206ab..3f40dc0d6bd1 100644 --- a/e2e/custom-resolver/foo.js +++ b/e2e/custom-resolver/foo.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = () => {}; diff --git a/e2e/custom-resolver/manualMock.js b/e2e/custom-resolver/manualMock.js index a67507b66494..a94d175d3b59 100644 --- a/e2e/custom-resolver/manualMock.js +++ b/e2e/custom-resolver/manualMock.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ throw new Error('Must be mocked'); diff --git a/e2e/custom-resolver/resolver.js b/e2e/custom-resolver/resolver.js index 4db6cbf41c39..99a078297896 100644 --- a/e2e/custom-resolver/resolver.js +++ b/e2e/custom-resolver/resolver.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const { default: defaultResolver, diff --git a/e2e/deprecated-cli-options/__tests__/dummy.js b/e2e/deprecated-cli-options/__tests__/dummy.js index af73fbfafd1b..1925b3756db7 100644 --- a/e2e/deprecated-cli-options/__tests__/dummy.js +++ b/e2e/deprecated-cli-options/__tests__/dummy.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('Dummy', () => { expect(2).toBe(2); diff --git a/e2e/detect-open-handles/__tests__/inside.js b/e2e/detect-open-handles/__tests__/inside.js index d8f499a5e71a..477db0e30e7c 100644 --- a/e2e/detect-open-handles/__tests__/inside.js +++ b/e2e/detect-open-handles/__tests__/inside.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('something', () => { setTimeout(() => {}, 30000); diff --git a/e2e/detect-open-handles/__tests__/outside.js b/e2e/detect-open-handles/__tests__/outside.js index 586e5252202b..6a332cca6005 100644 --- a/e2e/detect-open-handles/__tests__/outside.js +++ b/e2e/detect-open-handles/__tests__/outside.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ require('../server'); diff --git a/e2e/detect-open-handles/__tests__/promise.js b/e2e/detect-open-handles/__tests__/promise.js index 38c56b37d218..615f6017d91c 100644 --- a/e2e/detect-open-handles/__tests__/promise.js +++ b/e2e/detect-open-handles/__tests__/promise.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('something', () => { // eslint-disable-next-line no-new diff --git a/e2e/detect-open-handles/babel.config.js b/e2e/detect-open-handles/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/detect-open-handles/babel.config.js +++ b/e2e/detect-open-handles/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/detect-open-handles/server.js b/e2e/detect-open-handles/server.js index 624352c5fe9e..29bcd69ed5fb 100644 --- a/e2e/detect-open-handles/server.js +++ b/e2e/detect-open-handles/server.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/expect-async-matcher/babel.config.js b/e2e/expect-async-matcher/babel.config.js index bf18fc5ce74e..9f54b3667a03 100644 --- a/e2e/expect-async-matcher/babel.config.js +++ b/e2e/expect-async-matcher/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const baseConfig = require('../../babel.config'); diff --git a/e2e/failures/__tests__/duringTests.test.js b/e2e/failures/__tests__/duringTests.test.js index c315f5aa7cdc..679fefada8d5 100644 --- a/e2e/failures/__tests__/duringTests.test.js +++ b/e2e/failures/__tests__/duringTests.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/failures/babel.config.js b/e2e/failures/babel.config.js index bf18fc5ce74e..9f54b3667a03 100644 --- a/e2e/failures/babel.config.js +++ b/e2e/failures/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const baseConfig = require('../../babel.config'); diff --git a/e2e/filter/my-broken-filter.js b/e2e/filter/my-broken-filter.js index a1faac8150a9..42d16cfc4fbe 100644 --- a/e2e/filter/my-broken-filter.js +++ b/e2e/filter/my-broken-filter.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/filter/my-broken-setup-filter.js b/e2e/filter/my-broken-setup-filter.js index 3a7651c0ccb9..887cc8b63e5a 100644 --- a/e2e/filter/my-broken-setup-filter.js +++ b/e2e/filter/my-broken-setup-filter.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/filter/my-clowny-filter.js b/e2e/filter/my-clowny-filter.js index aa59e1556f32..f716b38d690d 100644 --- a/e2e/filter/my-clowny-filter.js +++ b/e2e/filter/my-clowny-filter.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/filter/my-filter.js b/e2e/filter/my-filter.js index dc30f54e3d51..33db34218a63 100644 --- a/e2e/filter/my-filter.js +++ b/e2e/filter/my-filter.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/filter/my-secondary-filter.js b/e2e/filter/my-secondary-filter.js index 34ce10d06bfb..70b3fb8c352f 100644 --- a/e2e/filter/my-secondary-filter.js +++ b/e2e/filter/my-secondary-filter.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/filter/my-setup-filter.js b/e2e/filter/my-setup-filter.js index 62861b832114..d9ce620f0405 100644 --- a/e2e/filter/my-setup-filter.js +++ b/e2e/filter/my-setup-filter.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/global-setup-custom-transform/index.js b/e2e/global-setup-custom-transform/index.js index f45215d7460d..4454b7f7bf58 100644 --- a/e2e/global-setup-custom-transform/index.js +++ b/e2e/global-setup-custom-transform/index.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = 'hello!'; diff --git a/e2e/global-setup-custom-transform/transformer.js b/e2e/global-setup-custom-transform/transformer.js index ba92f92952f0..178565a491e2 100644 --- a/e2e/global-setup-custom-transform/transformer.js +++ b/e2e/global-setup-custom-transform/transformer.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/global-setup/babel.config.js b/e2e/global-setup/babel.config.js index 443b08450adb..8b285c15ba0b 100644 --- a/e2e/global-setup/babel.config.js +++ b/e2e/global-setup/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { presets: ['@babel/preset-env', '@babel/preset-flow'], diff --git a/e2e/global-setup/custom-tests-dir/pass.test.js b/e2e/global-setup/custom-tests-dir/pass.test.js index 9b0c9ebdfaa1..0bc632c00f3a 100644 --- a/e2e/global-setup/custom-tests-dir/pass.test.js +++ b/e2e/global-setup/custom-tests-dir/pass.test.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('should pass', () => {}); diff --git a/e2e/global-setup/invalidSetup.js b/e2e/global-setup/invalidSetup.js index 064a0512c573..3b8006bd8afc 100644 --- a/e2e/global-setup/invalidSetup.js +++ b/e2e/global-setup/invalidSetup.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ console.log('there is no exported function'); diff --git a/e2e/global-teardown/babel.config.js b/e2e/global-teardown/babel.config.js index 443b08450adb..8b285c15ba0b 100644 --- a/e2e/global-teardown/babel.config.js +++ b/e2e/global-teardown/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { presets: ['@babel/preset-env', '@babel/preset-flow'], diff --git a/e2e/global-teardown/custom-tests-dir/pass.test.js b/e2e/global-teardown/custom-tests-dir/pass.test.js index 9b0c9ebdfaa1..0bc632c00f3a 100644 --- a/e2e/global-teardown/custom-tests-dir/pass.test.js +++ b/e2e/global-teardown/custom-tests-dir/pass.test.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('should pass', () => {}); diff --git a/e2e/global-teardown/invalidTeardown.js b/e2e/global-teardown/invalidTeardown.js index 064a0512c573..3b8006bd8afc 100644 --- a/e2e/global-teardown/invalidTeardown.js +++ b/e2e/global-teardown/invalidTeardown.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ console.log('there is no exported function'); diff --git a/e2e/jasmine-async/__tests__/pendingInPromise.test.js b/e2e/jasmine-async/__tests__/pendingInPromise.test.js index 23f523cf1b28..b88200bef52b 100644 --- a/e2e/jasmine-async/__tests__/pendingInPromise.test.js +++ b/e2e/jasmine-async/__tests__/pendingInPromise.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/multi-project-config-root/bar/__tests__/boggusBar.test.js b/e2e/multi-project-config-root/bar/__tests__/boggusBar.test.js index 9e036fd7b5ef..153a6a45192f 100644 --- a/e2e/multi-project-config-root/bar/__tests__/boggusBar.test.js +++ b/e2e/multi-project-config-root/bar/__tests__/boggusBar.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ describe('Bar', () => { it('fail', () => { diff --git a/e2e/multi-project-config-root/foo/__tests__/boggusFoo.test.js b/e2e/multi-project-config-root/foo/__tests__/boggusFoo.test.js index 4e5f416981e1..6d4f3095a3c6 100644 --- a/e2e/multi-project-config-root/foo/__tests__/boggusFoo.test.js +++ b/e2e/multi-project-config-root/foo/__tests__/boggusFoo.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ describe('Foo', () => { it('fail', () => { diff --git a/e2e/native-async-mock/Native.js b/e2e/native-async-mock/Native.js index dbf8a192f850..40600a495a2e 100644 --- a/e2e/native-async-mock/Native.js +++ b/e2e/native-async-mock/Native.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/native-async-mock/__tests__/nativeAsyncMock.test.js b/e2e/native-async-mock/__tests__/nativeAsyncMock.test.js index f6b00f38947b..c61b94f420f9 100644 --- a/e2e/native-async-mock/__tests__/nativeAsyncMock.test.js +++ b/e2e/native-async-mock/__tests__/nativeAsyncMock.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/override-globals/babel.config.js b/e2e/override-globals/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/override-globals/babel.config.js +++ b/e2e/override-globals/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/presets/js/node_modules/jest-preset-js/jest-preset.js b/e2e/presets/js/node_modules/jest-preset-js/jest-preset.js index 2d040723a3e1..6bc332577a33 100644 --- a/e2e/presets/js/node_modules/jest-preset-js/jest-preset.js +++ b/e2e/presets/js/node_modules/jest-preset-js/jest-preset.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { moduleNameMapper: { diff --git a/e2e/presets/js/node_modules/jest-preset-js/mapper.js b/e2e/presets/js/node_modules/jest-preset-js/mapper.js index da42adcd7cc0..ddedd1efe52c 100644 --- a/e2e/presets/js/node_modules/jest-preset-js/mapper.js +++ b/e2e/presets/js/node_modules/jest-preset-js/mapper.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = 42; diff --git a/e2e/presets/json/node_modules/jest-preset-json/mapper.js b/e2e/presets/json/node_modules/jest-preset-json/mapper.js index da42adcd7cc0..ddedd1efe52c 100644 --- a/e2e/presets/json/node_modules/jest-preset-json/mapper.js +++ b/e2e/presets/json/node_modules/jest-preset-json/mapper.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = 42; diff --git a/e2e/process-exit/__tests__/test.js b/e2e/process-exit/__tests__/test.js index 7e550feb2c82..8b6ba35f4658 100644 --- a/e2e/process-exit/__tests__/test.js +++ b/e2e/process-exit/__tests__/test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ process.exit(1); diff --git a/e2e/process-exit/babel.config.js b/e2e/process-exit/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/process-exit/babel.config.js +++ b/e2e/process-exit/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/require-main/babel.config.js b/e2e/require-main/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/require-main/babel.config.js +++ b/e2e/require-main/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/resolve-get-paths/babel.config.js b/e2e/resolve-get-paths/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/resolve-get-paths/babel.config.js +++ b/e2e/resolve-get-paths/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/resolve-no-extensions/__tests__/test.js b/e2e/resolve-no-extensions/__tests__/test.js index 9d92296a25e0..6e48707f45ef 100644 --- a/e2e/resolve-no-extensions/__tests__/test.js +++ b/e2e/resolve-no-extensions/__tests__/test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const m = require('../'); diff --git a/e2e/resolve-no-extensions/babel.config.js b/e2e/resolve-no-extensions/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/resolve-no-extensions/babel.config.js +++ b/e2e/resolve-no-extensions/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/resolve-no-extensions/index.js b/e2e/resolve-no-extensions/index.js index 8296759e00c0..e25f4c0e8f08 100644 --- a/e2e/resolve-no-extensions/index.js +++ b/e2e/resolve-no-extensions/index.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('./some-json-file'); diff --git a/e2e/resolve-with-paths/babel.config.js b/e2e/resolve-with-paths/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/resolve-with-paths/babel.config.js +++ b/e2e/resolve-with-paths/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/run-programmatically/babel.config.js b/e2e/run-programmatically/babel.config.js index 60a2a5c5a434..ba4e1529c3d4 100644 --- a/e2e/run-programmatically/babel.config.js +++ b/e2e/run-programmatically/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { presets: ['@babel/preset-env'], diff --git a/e2e/snapshot-resolver/__tests__/snapshot.test.js b/e2e/snapshot-resolver/__tests__/snapshot.test.js index a37cdafb6f5d..d1bc86b0996d 100644 --- a/e2e/snapshot-resolver/__tests__/snapshot.test.js +++ b/e2e/snapshot-resolver/__tests__/snapshot.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('snapshots are written to custom location', () => { expect('foobar').toMatchSnapshot(); diff --git a/e2e/snapshot-resolver/customSnapshotResolver.js b/e2e/snapshot-resolver/customSnapshotResolver.js index c55bdd7f45c1..6b2dfc60c11e 100644 --- a/e2e/snapshot-resolver/customSnapshotResolver.js +++ b/e2e/snapshot-resolver/customSnapshotResolver.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { resolveSnapshotPath: (testPath, snapshotExtension) => diff --git a/e2e/test-environment-async/TestEnvironment.js b/e2e/test-environment-async/TestEnvironment.js index c33865fe673d..550bb3f4eb79 100644 --- a/e2e/test-environment-async/TestEnvironment.js +++ b/e2e/test-environment-async/TestEnvironment.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/test-environment-circus/CircusHandleTestEventEnvironment.js b/e2e/test-environment-circus/CircusHandleTestEventEnvironment.js index f06dc57e368a..6bd6f2191adf 100644 --- a/e2e/test-environment-circus/CircusHandleTestEventEnvironment.js +++ b/e2e/test-environment-circus/CircusHandleTestEventEnvironment.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/test-environment-circus/__tests__/circusHandleTestEvent.test.js b/e2e/test-environment-circus/__tests__/circusHandleTestEvent.test.js index 6f90232e4c55..0ac805527147 100644 --- a/e2e/test-environment-circus/__tests__/circusHandleTestEvent.test.js +++ b/e2e/test-environment-circus/__tests__/circusHandleTestEvent.test.js @@ -1,6 +1,9 @@ /** * 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. + * * @jest-environment ./CircusHandleTestEventEnvironment.js */ diff --git a/e2e/test-environment/DocblockPragmasEnvironment.js b/e2e/test-environment/DocblockPragmasEnvironment.js index 6868bc3d4093..d32bbacba041 100644 --- a/e2e/test-environment/DocblockPragmasEnvironment.js +++ b/e2e/test-environment/DocblockPragmasEnvironment.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/e2e/test-environment/__tests__/docblockPragmas.test.js b/e2e/test-environment/__tests__/docblockPragmas.test.js index 213e5c22a273..262a754606a2 100644 --- a/e2e/test-environment/__tests__/docblockPragmas.test.js +++ b/e2e/test-environment/__tests__/docblockPragmas.test.js @@ -1,6 +1,9 @@ /** * 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. + * * @jest-environment ./DocblockPragmasEnvironment.js * @my-custom-pragma pragma-value */ diff --git a/e2e/timer-reset-mocks/after-reset-all-mocks/timerAndMock.test.js b/e2e/timer-reset-mocks/after-reset-all-mocks/timerAndMock.test.js index c87e267c8e2e..ab26793f5589 100644 --- a/e2e/timer-reset-mocks/after-reset-all-mocks/timerAndMock.test.js +++ b/e2e/timer-reset-mocks/after-reset-all-mocks/timerAndMock.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ describe('timers', () => { it('should work before calling resetAllMocks', () => { diff --git a/e2e/timer-reset-mocks/with-reset-mocks/timerWithMock.test.js b/e2e/timer-reset-mocks/with-reset-mocks/timerWithMock.test.js index e2f349869304..7d7cc8b75a58 100644 --- a/e2e/timer-reset-mocks/with-reset-mocks/timerWithMock.test.js +++ b/e2e/timer-reset-mocks/with-reset-mocks/timerWithMock.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ describe('timers', () => { it('should work before calling resetAllMocks', () => { diff --git a/e2e/timer-use-real-timers/__tests__/useRealTimers.test.js b/e2e/timer-use-real-timers/__tests__/useRealTimers.test.js index 0e845f325f6a..a50c55be2f31 100644 --- a/e2e/timer-use-real-timers/__tests__/useRealTimers.test.js +++ b/e2e/timer-use-real-timers/__tests__/useRealTimers.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ jest.useRealTimers(); diff --git a/e2e/to-match-inline-snapshot/babel.config.js b/e2e/to-match-inline-snapshot/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/to-match-inline-snapshot/babel.config.js +++ b/e2e/to-match-inline-snapshot/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/to-throw-error-matching-inline-snapshot/babel.config.js b/e2e/to-throw-error-matching-inline-snapshot/babel.config.js index 7ec52588d4a4..9be036106918 100644 --- a/e2e/to-throw-error-matching-inline-snapshot/babel.config.js +++ b/e2e/to-throw-error-matching-inline-snapshot/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = require('../../babel.config'); diff --git a/e2e/transform-linked-modules/__tests__/linkedModules.test.js b/e2e/transform-linked-modules/__tests__/linkedModules.test.js index f770785bd7c0..12de8bbfffe0 100644 --- a/e2e/transform-linked-modules/__tests__/linkedModules.test.js +++ b/e2e/transform-linked-modules/__tests__/linkedModules.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ test('normal file', () => { const normal = require('../ignored/normal'); diff --git a/e2e/transform-linked-modules/ignored/normal.js b/e2e/transform-linked-modules/ignored/normal.js index 3ab48a8a759f..a2aea770ad9e 100644 --- a/e2e/transform-linked-modules/ignored/normal.js +++ b/e2e/transform-linked-modules/ignored/normal.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = 'ignored/normal'; diff --git a/e2e/transform-linked-modules/package/index.js b/e2e/transform-linked-modules/package/index.js index 1dc611b6d180..17dd5c4e430e 100644 --- a/e2e/transform-linked-modules/package/index.js +++ b/e2e/transform-linked-modules/package/index.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = 'package/index'; diff --git a/e2e/transform-linked-modules/preprocessor.js b/e2e/transform-linked-modules/preprocessor.js index 0538a0fe943d..acf4723313d1 100644 --- a/e2e/transform-linked-modules/preprocessor.js +++ b/e2e/transform-linked-modules/preprocessor.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { process() { diff --git a/e2e/transform/babel-jest-ignored/babel.config.js b/e2e/transform/babel-jest-ignored/babel.config.js index ef0850effc4a..7178989f46c0 100644 --- a/e2e/transform/babel-jest-ignored/babel.config.js +++ b/e2e/transform/babel-jest-ignored/babel.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = {only: ['blablabla']}; diff --git a/e2e/transform/babel-jest/babel.config.js b/e2e/transform/babel-jest/babel.config.js index 245aa3fd79db..186d686670e3 100644 --- a/e2e/transform/babel-jest/babel.config.js +++ b/e2e/transform/babel-jest/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { presets: ['@babel/preset-flow'], diff --git a/e2e/transform/ecmascript-modules-support/babel.config.js b/e2e/transform/ecmascript-modules-support/babel.config.js index a602a8e053dd..b8ec7376a9b2 100644 --- a/e2e/transform/ecmascript-modules-support/babel.config.js +++ b/e2e/transform/ecmascript-modules-support/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { presets: [ diff --git a/e2e/transform/ecmascript-modules-support/src/index.mjs b/e2e/transform/ecmascript-modules-support/src/index.mjs index 92c7b3ac79f5..bc5d38f2d152 100644 --- a/e2e/transform/ecmascript-modules-support/src/index.mjs +++ b/e2e/transform/ecmascript-modules-support/src/index.mjs @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 {foo} from './module'; diff --git a/e2e/transform/ecmascript-modules-support/src/module.mjs b/e2e/transform/ecmascript-modules-support/src/module.mjs index aa42904a031a..3734db4222cb 100644 --- a/e2e/transform/ecmascript-modules-support/src/module.mjs +++ b/e2e/transform/ecmascript-modules-support/src/module.mjs @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ export const foo = () => 'a'; diff --git a/e2e/transform/multiple-transformers/babel.config.js b/e2e/transform/multiple-transformers/babel.config.js index a77cf94fd9c7..e52b556ea6c5 100644 --- a/e2e/transform/multiple-transformers/babel.config.js +++ b/e2e/transform/multiple-transformers/babel.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { presets: ['@babel/preset-env', '@babel/preset-react'], diff --git a/e2e/typescript-coverage/__tests__/coveredTest.ts b/e2e/typescript-coverage/__tests__/coveredTest.ts index 46a4b2f9227f..35e342140437 100644 --- a/e2e/typescript-coverage/__tests__/coveredTest.ts +++ b/e2e/typescript-coverage/__tests__/coveredTest.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ it('adds 1 + 2 to equal 3 in TScript', () => { const sum = require('../covered.ts'); diff --git a/e2e/typescript-coverage/covered.ts b/e2e/typescript-coverage/covered.ts index 342a123d1a7f..fca70ba8c3f6 100644 --- a/e2e/typescript-coverage/covered.ts +++ b/e2e/typescript-coverage/covered.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ export = function sum(a: number, b: number): number { return a + b; diff --git a/e2e/typescript-coverage/typescriptPreprocessor.js b/e2e/typescript-coverage/typescriptPreprocessor.js index c6ee5ebed469..f70981612673 100644 --- a/e2e/typescript-coverage/typescriptPreprocessor.js +++ b/e2e/typescript-coverage/typescriptPreprocessor.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const tsc = require('typescript'); diff --git a/jest.config.ci.js b/jest.config.ci.js index 9c4d3a3e706a..ecf98bc0bb54 100644 --- a/jest.config.ci.js +++ b/jest.config.ci.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/jest.config.js b/jest.config.js index fb70f4d04d3b..a39a9f4789f5 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/packages/jest-circus/runner.js b/packages/jest-circus/runner.js index 9dd2221862f9..cb1360dae2d9 100644 --- a/packages/jest-circus/runner.js +++ b/packages/jest-circus/runner.js @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ // Allow people to use `jest-circus/runner` as a runner. diff --git a/packages/jest-circus/src/__mocks__/testEventHandler.ts b/packages/jest-circus/src/__mocks__/testEventHandler.ts index 6ae7ab7fa2be..23dfe2bed22f 100644 --- a/packages/jest-circus/src/__mocks__/testEventHandler.ts +++ b/packages/jest-circus/src/__mocks__/testEventHandler.ts @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ import {Circus} from '@jest/types'; diff --git a/packages/jest-circus/src/__mocks__/testUtils.ts b/packages/jest-circus/src/__mocks__/testUtils.ts index 1353fcd09fda..0c53412e25b9 100644 --- a/packages/jest-circus/src/__mocks__/testUtils.ts +++ b/packages/jest-circus/src/__mocks__/testUtils.ts @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ import fs from 'fs'; diff --git a/packages/jest-circus/src/__tests__/afterAll.test.ts b/packages/jest-circus/src/__tests__/afterAll.test.ts index 386e6263e3ed..c96d93ff289c 100644 --- a/packages/jest-circus/src/__tests__/afterAll.test.ts +++ b/packages/jest-circus/src/__tests__/afterAll.test.ts @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ import {runTest} from '../__mocks__/testUtils'; diff --git a/packages/jest-circus/src/__tests__/baseTest.test.ts b/packages/jest-circus/src/__tests__/baseTest.test.ts index 66d743f5c434..429edbb39d43 100644 --- a/packages/jest-circus/src/__tests__/baseTest.test.ts +++ b/packages/jest-circus/src/__tests__/baseTest.test.ts @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ import {runTest} from '../__mocks__/testUtils'; diff --git a/packages/jest-circus/src/__tests__/hooks.test.ts b/packages/jest-circus/src/__tests__/hooks.test.ts index 02b54ae8e515..3d5f7f1af59e 100644 --- a/packages/jest-circus/src/__tests__/hooks.test.ts +++ b/packages/jest-circus/src/__tests__/hooks.test.ts @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ import {runTest} from '../__mocks__/testUtils'; diff --git a/packages/jest-cli/src/init/__tests__/fixtures/has_jest_config_file/jest.config.js b/packages/jest-cli/src/init/__tests__/fixtures/has_jest_config_file/jest.config.js index 8b2cfad40edb..54e6c946a5f7 100644 --- a/packages/jest-cli/src/init/__tests__/fixtures/has_jest_config_file/jest.config.js +++ b/packages/jest-cli/src/init/__tests__/fixtures/has_jest_config_file/jest.config.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = {}; diff --git a/packages/jest-config/src/__tests__/Defaults.test.ts b/packages/jest-config/src/__tests__/Defaults.test.ts index 2036e74e1085..31eda54e2efe 100644 --- a/packages/jest-config/src/__tests__/Defaults.test.ts +++ b/packages/jest-config/src/__tests__/Defaults.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 {defaults} from '../index'; diff --git a/packages/jest-config/src/__tests__/readConfig.test.ts b/packages/jest-config/src/__tests__/readConfig.test.ts index 58ff3551430b..63d81ce7e751 100644 --- a/packages/jest-config/src/__tests__/readConfig.test.ts +++ b/packages/jest-config/src/__tests__/readConfig.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 {readConfig} from '../index'; diff --git a/packages/jest-config/src/__tests__/readConfigs.test.ts b/packages/jest-config/src/__tests__/readConfigs.test.ts index e08204487c07..298f0f29625a 100644 --- a/packages/jest-config/src/__tests__/readConfigs.test.ts +++ b/packages/jest-config/src/__tests__/readConfigs.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 {readConfigs} from '../index'; diff --git a/packages/jest-core/src/SnapshotInteractiveMode.ts b/packages/jest-core/src/SnapshotInteractiveMode.ts index f1a662f99525..03aaf6ac9866 100644 --- a/packages/jest-core/src/SnapshotInteractiveMode.ts +++ b/packages/jest-core/src/SnapshotInteractiveMode.ts @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ import chalk from 'chalk'; diff --git a/packages/jest-core/src/__tests__/FailedTestsCache.test.js b/packages/jest-core/src/__tests__/FailedTestsCache.test.js index a94cd4150913..da58776da4bd 100644 --- a/packages/jest-core/src/__tests__/FailedTestsCache.test.js +++ b/packages/jest-core/src/__tests__/FailedTestsCache.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 FailedTestsCache from '../FailedTestsCache'; diff --git a/packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws.js b/packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws.js index 076596c2837d..5d723c5c522a 100644 --- a/packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws.js +++ b/packages/jest-core/src/__tests__/__fixtures__/watch_plugin_throws.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ throw new Error('initialization error'); diff --git a/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap b/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap index be0c72787eaa..18af264cdf5f 100644 --- a/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap +++ b/packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap @@ -57,7 +57,7 @@ exports[`Watch mode flows makes watch plugin initialization errors look nice 1`] initialization error - at Object. (__fixtures__/watch_plugin_throws.js:3:7) + at Object. (__fixtures__/watch_plugin_throws.js:8:7) ] `; diff --git a/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.js b/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.js index cb726cf292ee..217e6196bcea 100644 --- a/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.js +++ b/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 getNoTestsFoundMessage from '../getNoTestsFoundMessage'; diff --git a/packages/jest-core/src/__tests__/run_jest.test.js b/packages/jest-core/src/__tests__/run_jest.test.js index 3293dd4fbcbc..842407438f0c 100644 --- a/packages/jest-core/src/__tests__/run_jest.test.js +++ b/packages/jest-core/src/__tests__/run_jest.test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 runJest from '../runJest'; diff --git a/packages/jest-core/src/__tests__/test_root/__testtests__/test.foobar b/packages/jest-core/src/__tests__/test_root/__testtests__/test.foobar index e064b16a86ac..d89ff1cc33a9 100644 --- a/packages/jest-core/src/__tests__/test_root/__testtests__/test.foobar +++ b/packages/jest-core/src/__tests__/test_root/__testtests__/test.foobar @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // test.foobar diff --git a/packages/jest-core/src/__tests__/test_root/__testtests__/test.js b/packages/jest-core/src/__tests__/test_root/__testtests__/test.js index 2c6a37c44995..4c43c5b1b051 100644 --- a/packages/jest-core/src/__tests__/test_root/__testtests__/test.js +++ b/packages/jest-core/src/__tests__/test_root/__testtests__/test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // test.js diff --git a/packages/jest-core/src/__tests__/test_root/__testtests__/test.jsx b/packages/jest-core/src/__tests__/test_root/__testtests__/test.jsx index 45157b447533..d529f0d553fa 100644 --- a/packages/jest-core/src/__tests__/test_root/__testtests__/test.jsx +++ b/packages/jest-core/src/__tests__/test_root/__testtests__/test.jsx @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // test.jsx diff --git a/packages/jest-core/src/__tests__/test_root/module.foobar b/packages/jest-core/src/__tests__/test_root/module.foobar index e8aeaf03a0db..ccd3fe919e1c 100644 --- a/packages/jest-core/src/__tests__/test_root/module.foobar +++ b/packages/jest-core/src/__tests__/test_root/module.foobar @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // module.foobar diff --git a/packages/jest-core/src/__tests__/test_root/module.jsx b/packages/jest-core/src/__tests__/test_root/module.jsx index 156cd35bec71..d9d2a3f4bca3 100644 --- a/packages/jest-core/src/__tests__/test_root/module.jsx +++ b/packages/jest-core/src/__tests__/test_root/module.jsx @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // module.jsx diff --git a/packages/jest-core/src/__tests__/test_root/no_tests.js b/packages/jest-core/src/__tests__/test_root/no_tests.js index 6813d94ff8fa..26299e28a9be 100644 --- a/packages/jest-core/src/__tests__/test_root/no_tests.js +++ b/packages/jest-core/src/__tests__/test_root/no_tests.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // no tests for this one diff --git a/packages/jest-core/src/__tests__/test_root_with_(parentheses)/__testtests__/test.js b/packages/jest-core/src/__tests__/test_root_with_(parentheses)/__testtests__/test.js index 2c6a37c44995..4c43c5b1b051 100644 --- a/packages/jest-core/src/__tests__/test_root_with_(parentheses)/__testtests__/test.js +++ b/packages/jest-core/src/__tests__/test_root_with_(parentheses)/__testtests__/test.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // test.js diff --git a/packages/jest-core/src/__tests__/test_root_with_(parentheses)/module.jsx b/packages/jest-core/src/__tests__/test_root_with_(parentheses)/module.jsx index 156cd35bec71..d9d2a3f4bca3 100644 --- a/packages/jest-core/src/__tests__/test_root_with_(parentheses)/module.jsx +++ b/packages/jest-core/src/__tests__/test_root_with_(parentheses)/module.jsx @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ // module.jsx diff --git a/packages/jest-core/src/getNoTestFoundFailed.ts b/packages/jest-core/src/getNoTestFoundFailed.ts index 3b0b6d9cc70c..b36bb8ea659a 100644 --- a/packages/jest-core/src/getNoTestFoundFailed.ts +++ b/packages/jest-core/src/getNoTestFoundFailed.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 chalk from 'chalk'; diff --git a/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts b/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts index f05c16ff78c3..fc404021d624 100644 --- a/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts +++ b/packages/jest-core/src/getNoTestFoundPassWithNoTests.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 chalk from 'chalk'; diff --git a/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts b/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts index 4c3ecb74a56b..6efd4a40adaf 100644 --- a/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts +++ b/packages/jest-core/src/getNoTestFoundRelatedToChangedFiles.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 chalk from 'chalk'; import {Config} from '@jest/types'; diff --git a/packages/jest-core/src/getNoTestFoundVerbose.ts b/packages/jest-core/src/getNoTestFoundVerbose.ts index 80c8db9a6994..0b26e8927985 100644 --- a/packages/jest-core/src/getNoTestFoundVerbose.ts +++ b/packages/jest-core/src/getNoTestFoundVerbose.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 chalk from 'chalk'; import {Config} from '@jest/types'; diff --git a/packages/jest-core/src/pluralize.ts b/packages/jest-core/src/pluralize.ts index 029884669aed..bda5b9a328bc 100644 --- a/packages/jest-core/src/pluralize.ts +++ b/packages/jest-core/src/pluralize.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ export default function pluralize(word: string, count: number, ending: string) { return `${count} ${word}${count === 1 ? '' : ending}`; diff --git a/packages/jest-docblock/src/__tests__/index.test.ts b/packages/jest-docblock/src/__tests__/index.test.ts index 5df6ce09c552..db1dc61bc4c5 100644 --- a/packages/jest-docblock/src/__tests__/index.test.ts +++ b/packages/jest-docblock/src/__tests__/index.test.ts @@ -1,6 +1,5 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * 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. diff --git a/packages/jest-haste-map/src/lib/__tests__/fast_path.test.js b/packages/jest-haste-map/src/lib/__tests__/fast_path.test.js index fd76610eca4a..454500a823df 100644 --- a/packages/jest-haste-map/src/lib/__tests__/fast_path.test.js +++ b/packages/jest-haste-map/src/lib/__tests__/fast_path.test.js @@ -1,10 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * 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 path from 'path'; diff --git a/packages/jest-haste-map/src/lib/__tests__/getPlatformExtension.test.js b/packages/jest-haste-map/src/lib/__tests__/getPlatformExtension.test.js index 6541ac0e16a2..916b2387ad08 100644 --- a/packages/jest-haste-map/src/lib/__tests__/getPlatformExtension.test.js +++ b/packages/jest-haste-map/src/lib/__tests__/getPlatformExtension.test.js @@ -1,10 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * 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 getPlatformExtension from '../getPlatformExtension'; diff --git a/packages/jest-haste-map/src/lib/__tests__/normalizePathSep.test.js b/packages/jest-haste-map/src/lib/__tests__/normalizePathSep.test.js index d7e6ff64e490..8c89f63ee392 100644 --- a/packages/jest-haste-map/src/lib/__tests__/normalizePathSep.test.js +++ b/packages/jest-haste-map/src/lib/__tests__/normalizePathSep.test.js @@ -1,10 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * 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'; diff --git a/packages/jest-leak-detector/src/__tests__/index.test.ts b/packages/jest-leak-detector/src/__tests__/index.test.ts index a135b1637ad8..6a017162021e 100644 --- a/packages/jest-leak-detector/src/__tests__/index.test.ts +++ b/packages/jest-leak-detector/src/__tests__/index.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/packages/jest-regex-util/src/__tests__/index.test.ts b/packages/jest-regex-util/src/__tests__/index.test.ts index 828d6601c194..48d9af12f133 100644 --- a/packages/jest-regex-util/src/__tests__/index.test.ts +++ b/packages/jest-regex-util/src/__tests__/index.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ jest.mock('path'); diff --git a/packages/jest-repl/src/cli/repl.ts b/packages/jest-repl/src/cli/repl.ts index 66f5725ecbed..583cb0f5ff2e 100644 --- a/packages/jest-repl/src/cli/repl.ts +++ b/packages/jest-repl/src/cli/repl.ts @@ -1,10 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * 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. - * */ declare const jestGlobalConfig: Config.GlobalConfig; diff --git a/packages/jest-resolve/src/__tests__/isBuiltinModule.test.ts b/packages/jest-resolve/src/__tests__/isBuiltinModule.test.ts index 0bbbb84d732b..7ddbd2d390f5 100644 --- a/packages/jest-resolve/src/__tests__/isBuiltinModule.test.ts +++ b/packages/jest-resolve/src/__tests__/isBuiltinModule.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 isBuiltinModule from '../isBuiltinModule'; diff --git a/packages/jest-runtime/src/__tests__/defaultResolver.js b/packages/jest-runtime/src/__tests__/defaultResolver.js index cbcdd6cf4cf3..7e75ee1606be 100644 --- a/packages/jest-runtime/src/__tests__/defaultResolver.js +++ b/packages/jest-runtime/src/__tests__/defaultResolver.js @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ + import resolver from 'jest-resolve/build/defaultResolver.js'; module.exports = resolver; diff --git a/packages/jest-runtime/src/__tests__/test_root/__mocks__/nested1/nested2/nested3.js b/packages/jest-runtime/src/__tests__/test_root/__mocks__/nested1/nested2/nested3.js index 65f811c6911d..bb13c0a6e08c 100644 --- a/packages/jest-runtime/src/__tests__/test_root/__mocks__/nested1/nested2/nested3.js +++ b/packages/jest-runtime/src/__tests__/test_root/__mocks__/nested1/nested2/nested3.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/packages/jest-runtime/src/__tests__/test_root/dep_on_mapped_module.js b/packages/jest-runtime/src/__tests__/test_root/dep_on_mapped_module.js index 4f6720933c54..f5a1d4e3f693 100644 --- a/packages/jest-runtime/src/__tests__/test_root/dep_on_mapped_module.js +++ b/packages/jest-runtime/src/__tests__/test_root/dep_on_mapped_module.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/packages/jest-runtime/src/__tests__/test_root/mapped_dir/moduleInMapped.js b/packages/jest-runtime/src/__tests__/test_root/mapped_dir/moduleInMapped.js index dfeab362a879..53ddc44eb095 100644 --- a/packages/jest-runtime/src/__tests__/test_root/mapped_dir/moduleInMapped.js +++ b/packages/jest-runtime/src/__tests__/test_root/mapped_dir/moduleInMapped.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/packages/jest-runtime/src/__tests__/test_root/nested1/nested2/nested3.js b/packages/jest-runtime/src/__tests__/test_root/nested1/nested2/nested3.js index faa5d0519a4b..df9e61efb4d8 100644 --- a/packages/jest-runtime/src/__tests__/test_root/nested1/nested2/nested3.js +++ b/packages/jest-runtime/src/__tests__/test_root/nested1/nested2/nested3.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/browser.js b/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/browser.js index 769c88956e3c..4f06a53fd70c 100644 --- a/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/browser.js +++ b/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/browser.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports.isBrowser = true; diff --git a/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/node.js b/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/node.js index ea7308992019..793651797e0a 100644 --- a/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/node.js +++ b/packages/jest-runtime/src/__tests__/test_root/node_modules/jest-resolve-test/node.js @@ -1,3 +1,8 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports.isBrowser = false; diff --git a/packages/jest-runtime/src/__tests__/test_root/sourcemaps/out/throwing-mapped-fn.js b/packages/jest-runtime/src/__tests__/test_root/sourcemaps/out/throwing-mapped-fn.js index 9fcffa4995ba..811ef31e587b 100644 --- a/packages/jest-runtime/src/__tests__/test_root/sourcemaps/out/throwing-mapped-fn.js +++ b/packages/jest-runtime/src/__tests__/test_root/sourcemaps/out/throwing-mapped-fn.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; @@ -9,9 +14,8 @@ exports.sum = sum; /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ function sum() { diff --git a/packages/jest-runtime/src/__tests__/test_root/sourcemaps/throwing-mapped-fn.js b/packages/jest-runtime/src/__tests__/test_root/sourcemaps/throwing-mapped-fn.js index 314356572fd5..a8796aa19072 100644 --- a/packages/jest-runtime/src/__tests__/test_root/sourcemaps/throwing-mapped-fn.js +++ b/packages/jest-runtime/src/__tests__/test_root/sourcemaps/throwing-mapped-fn.js @@ -1,9 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ export function sum() { diff --git a/packages/jest-runtime/src/helpers.ts b/packages/jest-runtime/src/helpers.ts index 5b12d3aeb3aa..395b271a3939 100644 --- a/packages/jest-runtime/src/helpers.ts +++ b/packages/jest-runtime/src/helpers.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 path from 'path'; import slash from 'slash'; diff --git a/packages/jest-snapshot/src/__mocks__/prettier.js b/packages/jest-snapshot/src/__mocks__/prettier.js index 717891860829..38a398821537 100644 --- a/packages/jest-snapshot/src/__mocks__/prettier.js +++ b/packages/jest-snapshot/src/__mocks__/prettier.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const prettier = jest.requireActual('prettier'); diff --git a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-inconsistent-fns.js b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-inconsistent-fns.js index 6734678afaec..538cf1cb6b23 100644 --- a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-inconsistent-fns.js +++ b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-inconsistent-fns.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { resolveSnapshotPath: (testPath, snapshotExtension) => diff --git a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveSnapshotPath.js b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveSnapshotPath.js index 20db98c2b1a6..e9d2d80c8a5f 100644 --- a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveSnapshotPath.js +++ b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveSnapshotPath.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { resolveTestPath: () => {}, diff --git a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveTestPath.js b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveTestPath.js index 46db466ec5b0..cb50b9dc5c2a 100644 --- a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveTestPath.js +++ b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-resolveTestPath.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { resolveSnapshotPath: () => {}, diff --git a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-test-path-for-consistency-check.js b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-test-path-for-consistency-check.js index 4e58ae8c5697..9ebe61479c70 100644 --- a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-test-path-for-consistency-check.js +++ b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver-missing-test-path-for-consistency-check.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { resolveSnapshotPath: (testPath, snapshotExtension) => {}, diff --git a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver.js b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver.js index c55bdd7f45c1..6b2dfc60c11e 100644 --- a/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver.js +++ b/packages/jest-snapshot/src/__tests__/fixtures/customSnapshotResolver.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ module.exports = { resolveSnapshotPath: (testPath, snapshotExtension) => diff --git a/packages/jest-snapshot/src/__tests__/snapshot_resolver.test.ts b/packages/jest-snapshot/src/__tests__/snapshot_resolver.test.ts index 5afee9699182..0ff74858b8f5 100644 --- a/packages/jest-snapshot/src/__tests__/snapshot_resolver.test.ts +++ b/packages/jest-snapshot/src/__tests__/snapshot_resolver.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 path from 'path'; import {Config} from '@jest/types'; diff --git a/packages/jest-source-map/src/__tests__/getCallsite.test.ts b/packages/jest-source-map/src/__tests__/getCallsite.test.ts index ecd017476e47..3a96bc2e57e9 100644 --- a/packages/jest-source-map/src/__tests__/getCallsite.test.ts +++ b/packages/jest-source-map/src/__tests__/getCallsite.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 fs from 'fs'; import SourceMap from 'source-map'; diff --git a/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts b/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts index e16129fe7c95..0b5e3661d1c5 100644 --- a/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts +++ b/packages/jest-transform/src/enhanceUnexpectedTokenMessage.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 chalk from 'chalk'; diff --git a/packages/jest-util/src/__tests__/isInteractive.test.ts b/packages/jest-util/src/__tests__/isInteractive.test.ts index 79201ed801b6..a86c4e9575c9 100644 --- a/packages/jest-util/src/__tests__/isInteractive.test.ts +++ b/packages/jest-util/src/__tests__/isInteractive.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ let oldIsTTY: typeof process.stdout.isTTY; let oldTERM: string | undefined; diff --git a/packages/jest-util/src/isInteractive.ts b/packages/jest-util/src/isInteractive.ts index 0dca9ee48f88..c81d5a8a98a1 100644 --- a/packages/jest-util/src/isInteractive.ts +++ b/packages/jest-util/src/isInteractive.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 isCI from 'is-ci'; diff --git a/packages/jest-watcher/src/lib/__tests__/scroll.test.ts b/packages/jest-watcher/src/lib/__tests__/scroll.test.ts index e500b371a95d..b18b6a2d6e08 100644 --- a/packages/jest-watcher/src/lib/__tests__/scroll.test.ts +++ b/packages/jest-watcher/src/lib/__tests__/scroll.test.ts @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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 scroll from '../scroll'; diff --git a/scripts/checkCopyrightHeaders.js b/scripts/checkCopyrightHeaders.js index fe9682e93324..4d1b7e09962f 100755 --- a/scripts/checkCopyrightHeaders.js +++ b/scripts/checkCopyrightHeaders.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved + * 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. @@ -117,10 +117,22 @@ const INCLUDED_PATTERNS = [ const COPYRIGHT_HEADER = 'Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.'; +const LICENSE1 = + 'This source code is licensed under the MIT license found in the'; +const LICENSE2 = 'LICENSE file in the root directory of this source tree.'; function needsCopyrightHeader(file) { const contents = getFileContents(file); - return contents.trim().length > 0 && !contents.includes(COPYRIGHT_HEADER); + + // Match lines individually to avoid false positive for: + // comment block versus lines + // line ending LF versus CRLF + return ( + contents.trim().length > 0 && + (!contents.includes(COPYRIGHT_HEADER) || + !contents.includes(LICENSE1) || + !contents.includes(LICENSE2)) + ); } function check() { diff --git a/scripts/remove-postinstall.js b/scripts/remove-postinstall.js index a4b10c50f6b5..f85bbafda5c3 100644 --- a/scripts/remove-postinstall.js +++ b/scripts/remove-postinstall.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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'; diff --git a/website/fetchSupporters.js b/website/fetchSupporters.js index 35dfeddcf0ac..83b2e254a31b 100644 --- a/website/fetchSupporters.js +++ b/website/fetchSupporters.js @@ -1,6 +1,11 @@ #!/usr/bin/env node -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const fs = require('fs'); const request = require('request'); diff --git a/website/languages.js b/website/languages.js index dfe4d38e63d9..821e370929d8 100644 --- a/website/languages.js +++ b/website/languages.js @@ -1,7 +1,10 @@ /** * 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. */ + const languages = [ { enabled: true, diff --git a/website/pages/en/videos.js b/website/pages/en/videos.js index d5a465a0b70e..04d5401ca03f 100644 --- a/website/pages/en/videos.js +++ b/website/pages/en/videos.js @@ -1,4 +1,9 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +/** + * 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. + */ const React = require('react'); diff --git a/website/siteConfig.js b/website/siteConfig.js index 42ca63906008..0fa4fb20c98f 100644 --- a/website/siteConfig.js +++ b/website/siteConfig.js @@ -1,11 +1,10 @@ -/*eslint sort-keys: 0*/ /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. - * 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. */ +/*eslint sort-keys: 0*/ /* List of talks & videos */ diff --git a/website/static/css/custom.css b/website/static/css/custom.css index 6716435b6495..6faed714f994 100644 --- a/website/static/css/custom.css +++ b/website/static/css/custom.css @@ -1,4 +1,9 @@ -/* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. */ +/** + * 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. + */ .mainContainer a { text-decoration: underline; diff --git a/website/static/css/hljs-jest.css b/website/static/css/hljs-jest.css index bc43a2bda27a..5b176aec2c22 100644 --- a/website/static/css/hljs-jest.css +++ b/website/static/css/hljs-jest.css @@ -1,4 +1,9 @@ -/* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. */ +/** + * 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. + */ /* Jest's Color Scheme for Highlight JS diff --git a/website/static/css/jest.css b/website/static/css/jest.css index b49c6e5c26c2..351f114ca1f1 100644 --- a/website/static/css/jest.css +++ b/website/static/css/jest.css @@ -1,4 +1,9 @@ -/* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. */ +/** + * 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. + */ :root { --yellow: #c2a813; diff --git a/website/static/landing.js b/website/static/landing.js index 33a1a60c44f5..4cfdc9e62593 100644 --- a/website/static/landing.js +++ b/website/static/landing.js @@ -1,4 +1,9 @@ -/* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. */ +/** + * 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. + */ /* global document, window, localStorage */ From 53e964ca27f26c03138a5973b1fdca2aa4efef94 Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Fri, 9 Aug 2019 10:43:45 -0400 Subject: [PATCH 20/34] jest-matcher-utils: Add color options to matcherHint (#8795) * jest-matcher-utils: Add color options to matcherHint * Correct substringNegative in secondArgumentColor test * Add comment about Color type * Export type MatcherHintColor * Update CHANGELOG.md --- CHANGELOG.md | 1 + .../src/__tests__/index.test.ts | 48 +++++++++++++++++++ packages/jest-matcher-utils/src/index.ts | 14 ++++-- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6283466826be..e60cf5d47945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - `[@jest/core, @jest/test-sequencer]` Support async sort in custom `testSequencer` ([#8642](https://github.com/facebook/jest/pull/8642)) - `[jest-runtime, @jest/fake-timers]` Add `jest.advanceTimersToNextTimer` ([#8713](https://github.com/facebook/jest/pull/8713)) - `[@jest-transform]` Extract transforming require logic within `jest-core` into `@jest-transform` ([#8756](https://github.com/facebook/jest/pull/8756)) +- `[jest-matcher-utils]` Add color options to `matcherHint` ([#8795](https://github.com/facebook/jest/pull/8795)) ### Fixes diff --git a/packages/jest-matcher-utils/src/__tests__/index.test.ts b/packages/jest-matcher-utils/src/__tests__/index.test.ts index e5f0ad94cca1..22e8d24fb749 100644 --- a/packages/jest-matcher-utils/src/__tests__/index.test.ts +++ b/packages/jest-matcher-utils/src/__tests__/index.test.ts @@ -6,11 +6,13 @@ * */ +import chalk from 'chalk'; import { diff, ensureNumbers, ensureNoExpected, getLabelPrinter, + matcherHint, pluralize, stringify, MatcherHintOptions, @@ -286,3 +288,49 @@ describe('getLabelPrinter', () => { }).toThrow(); }); }); + +describe('matcherHint', () => { + test('expectedColor', () => { + const expectedColor = (arg: string): string => arg; // default (black) color + const expectedArgument = 'n'; + const received = matcherHint( + 'toHaveBeenNthCalledWith', + 'jest.fn()', + expectedArgument, + {expectedColor, secondArgument: '...expected'}, + ); + + const substringNegative = chalk.green(expectedArgument); + + expect(received).not.toMatch(substringNegative); + }); + + test('receivedColor', () => { + const receivedColor = chalk.cyan.bgAnsi256(158); + const receivedArgument = 'received'; + const received = matcherHint('toMatchSnapshot', receivedArgument, '', { + receivedColor, + }); + + const substringNegative = chalk.red(receivedArgument); + const substringPositive = receivedColor(receivedArgument); + + expect(received).not.toMatch(substringNegative); + expect(received).toMatch(substringPositive); + }); + + test('secondArgumentColor', () => { + const secondArgumentColor = chalk.bold; + const secondArgument = 'hint'; + const received = matcherHint('toMatchSnapshot', undefined, 'properties', { + secondArgument, + secondArgumentColor, + }); + + const substringNegative = chalk.green(secondArgument); + const substringPositive = secondArgumentColor(secondArgument); + + expect(received).not.toMatch(substringNegative); + expect(received).toMatch(substringPositive); + }); +}); diff --git a/packages/jest-matcher-utils/src/index.ts b/packages/jest-matcher-utils/src/index.ts index 682614aa31d8..984f031c871a 100644 --- a/packages/jest-matcher-utils/src/index.ts +++ b/packages/jest-matcher-utils/src/index.ts @@ -28,12 +28,17 @@ const PLUGINS = [ AsymmetricMatcher, ]; +type MatcherHintColor = (arg: string) => string; // subset of Chalk type + export type MatcherHintOptions = { comment?: string; + expectedColor?: MatcherHintColor; isDirectExpectCall?: boolean; isNot?: boolean; promise?: string; + receivedColor?: MatcherHintColor; secondArgument?: string; + secondArgumentColor?: MatcherHintColor; }; export {DiffOptions}; @@ -362,16 +367,19 @@ export const matcherHint = ( ) => { const { comment = '', + expectedColor = EXPECTED_COLOR, isDirectExpectCall = false, // seems redundant with received === '' isNot = false, promise = '', + receivedColor = RECEIVED_COLOR, secondArgument = '', + secondArgumentColor = EXPECTED_COLOR, } = options; let hint = ''; let dimString = 'expect'; // concatenate adjacent dim substrings if (!isDirectExpectCall && received !== '') { - hint += DIM_COLOR(dimString + '(') + RECEIVED_COLOR(received); + hint += DIM_COLOR(dimString + '(') + receivedColor(received); dimString = ')'; } @@ -398,9 +406,9 @@ export const matcherHint = ( if (expected === '') { dimString += '()'; } else { - hint += DIM_COLOR(dimString + '(') + EXPECTED_COLOR(expected); + hint += DIM_COLOR(dimString + '(') + expectedColor(expected); if (secondArgument) { - hint += DIM_COLOR(', ') + EXPECTED_COLOR(secondArgument); + hint += DIM_COLOR(', ') + secondArgumentColor(secondArgument); } dimString = ')'; } From fafaf893575000ca423dc77aa8aa44554cdb3f57 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sun, 11 Aug 2019 09:01:59 +1200 Subject: [PATCH 21/34] use babel-plugin-replace-ts-export-assignment package (#8805) --- babel.config.js | 4 +-- package.json | 1 + ...lugin-jest-replace-ts-export-assignment.js | 26 ------------------- yarn.lock | 5 ++++ 4 files changed, 7 insertions(+), 29 deletions(-) delete mode 100644 scripts/babel-plugin-jest-replace-ts-export-assignment.js diff --git a/babel.config.js b/babel.config.js index 7e1e2aeaf94d..d536e25277bc 100644 --- a/babel.config.js +++ b/babel.config.js @@ -11,9 +11,7 @@ module.exports = { { plugins: [ 'babel-plugin-typescript-strip-namespaces', - require.resolve( - './scripts/babel-plugin-jest-replace-ts-export-assignment.js' - ), + 'babel-plugin-replace-ts-export-assignment', ], presets: ['@babel/preset-typescript'], test: /\.tsx?$/, diff --git a/package.json b/package.json index 0a01255e6978..1d5fa1644a6f 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "ansi-styles": "^3.2.0", "babel-eslint": "^10.0.2", "babel-loader": "^8.0.5", + "babel-plugin-replace-ts-export-assignment": "^0.0.2", "babel-plugin-typescript-strip-namespaces": "^1.1.1", "camelcase": "^5.0.0", "chalk": "^2.0.1", diff --git a/scripts/babel-plugin-jest-replace-ts-export-assignment.js b/scripts/babel-plugin-jest-replace-ts-export-assignment.js deleted file mode 100644 index 65722500d5cc..000000000000 --- a/scripts/babel-plugin-jest-replace-ts-export-assignment.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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'; - -// Replace `export =` with `module.exports` which allows us to keep CJS semantics - -module.exports = ({template}) => { - const moduleExportsDeclaration = template(` - module.exports = ASSIGNMENT; - `); - return { - name: 'jest-replace-ts-export-assignment', - visitor: { - TSExportAssignment(path) { - path.replaceWith( - moduleExportsDeclaration({ASSIGNMENT: path.node.expression}) - ); - }, - }, - }; -}; diff --git a/yarn.lock b/yarn.lock index 18612e815ce4..e074adce1da1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3378,6 +3378,11 @@ babel-plugin-istanbul@^5.1.0: istanbul-lib-instrument "^3.0.0" test-exclude "^5.0.0" +babel-plugin-replace-ts-export-assignment@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/babel-plugin-replace-ts-export-assignment/-/babel-plugin-replace-ts-export-assignment-0.0.2.tgz#927a30ba303fcf271108980a8d4f80a693e1d53f" + integrity sha512-BiTEG2Ro+O1spuheL5nB289y37FFmz0ISE6GjpNCG2JuA/WNcuEHSYw01+vN8quGf208sID3FnZFDwVyqX18YQ== + babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" From 384fe4a57e6d923d6a940d6cbaeca35e4eef0fde Mon Sep 17 00:00:00 2001 From: Stuart Cook Date: Sun, 11 Aug 2019 07:31:18 +1000 Subject: [PATCH 22/34] Clearer messages for Node assert errors (#8792) --- CHANGELOG.md | 1 + .../__snapshots__/failures.test.ts.snap | 12 ++++----- .../jest-circus/src/formatNodeAssertErrors.ts | 20 +++++++-------- .../src/assertionErrorMessage.ts | 25 ++++++++++--------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e60cf5d47945..849150ef222b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - `[jest-runtime, @jest/fake-timers]` Add `jest.advanceTimersToNextTimer` ([#8713](https://github.com/facebook/jest/pull/8713)) - `[@jest-transform]` Extract transforming require logic within `jest-core` into `@jest-transform` ([#8756](https://github.com/facebook/jest/pull/8756)) - `[jest-matcher-utils]` Add color options to `matcherHint` ([#8795](https://github.com/facebook/jest/pull/8795)) +- `[jest-circus/jest-jasmine2]` Give clearer output for Node assert errors ([#8792](https://github.com/facebook/jest/pull/8792)) ### Fixes diff --git a/e2e/__tests__/__snapshots__/failures.test.ts.snap b/e2e/__tests__/__snapshots__/failures.test.ts.snap index a9ad9ea74cf2..058132cbe250 100644 --- a/e2e/__tests__/__snapshots__/failures.test.ts.snap +++ b/e2e/__tests__/__snapshots__/failures.test.ts.snap @@ -399,7 +399,7 @@ FAIL __tests__/assertionError.test.js ● assert - assert.equal(received, expected) or assert(received) + assert(received) Expected value to be equal to: true @@ -418,7 +418,7 @@ FAIL __tests__/assertionError.test.js ● assert with a message - assert.equal(received, expected) or assert(received) + assert(received) Expected value to be equal to: true @@ -440,7 +440,7 @@ FAIL __tests__/assertionError.test.js ● assert.ok - assert.equal(received, expected) or assert(received) + assert(received) Expected value to be equal to: true @@ -459,7 +459,7 @@ FAIL __tests__/assertionError.test.js ● assert.ok with a message - assert.equal(received, expected) or assert(received) + assert(received) Expected value to be equal to: true @@ -481,7 +481,7 @@ FAIL __tests__/assertionError.test.js ● assert.equal - assert.equal(received, expected) or assert(received) + assert.equal(received, expected) Expected value to be equal to: 2 @@ -747,7 +747,7 @@ FAIL __tests__/assertionError.test.js ● async - assert.equal(received, expected) or assert(received) + assert.equal(received, expected) Expected value to be equal to: "hello" diff --git a/packages/jest-circus/src/formatNodeAssertErrors.ts b/packages/jest-circus/src/formatNodeAssertErrors.ts index 2d086e7a2558..498688538195 100644 --- a/packages/jest-circus/src/formatNodeAssertErrors.ts +++ b/packages/jest-circus/src/formatNodeAssertErrors.ts @@ -101,10 +101,17 @@ const assertThrowingMatcherHint = (operatorName: string) => const assertMatcherHint = ( operator: string | undefined | null, operatorName: string, + expected: unknown, ) => { let message = ''; - if (operatorName) { + if (operator === '==' && expected === true) { + message = + chalk.dim('assert') + + chalk.dim('(') + + chalk.red('received') + + chalk.dim(')'); + } else if (operatorName) { message = chalk.dim('assert') + chalk.dim('.' + operatorName + '(') + @@ -114,15 +121,6 @@ const assertMatcherHint = ( chalk.dim(')'); } - if (operator === '==') { - message += - ' or ' + - chalk.dim('assert') + - chalk.dim('(') + - chalk.red('received') + - chalk.dim(') '); - } - return message; }; @@ -160,7 +158,7 @@ function assertionErrorMessage( } return ( - buildHintString(assertMatcherHint(operator, operatorName)) + + buildHintString(assertMatcherHint(operator, operatorName, expected)) + chalk.reset(`Expected value ${operatorMessage(operator)}`) + ` ${printExpected(expected)}\n` + chalk.reset(`Received:\n`) + diff --git a/packages/jest-jasmine2/src/assertionErrorMessage.ts b/packages/jest-jasmine2/src/assertionErrorMessage.ts index 1cb63a9ecb20..6dbb8959654f 100644 --- a/packages/jest-jasmine2/src/assertionErrorMessage.ts +++ b/packages/jest-jasmine2/src/assertionErrorMessage.ts @@ -62,10 +62,20 @@ const assertThrowingMatcherHint = (operatorName: string) => chalk.dim(')') : ''; -const assertMatcherHint = (operator: string | null, operatorName: string) => { +const assertMatcherHint = ( + operator: string | null, + operatorName: string, + expected: unknown, +) => { let message = ''; - if (operatorName) { + if (operator === '==' && expected === true) { + message = + chalk.dim('assert') + + chalk.dim('(') + + chalk.red('received') + + chalk.dim(')'); + } else if (operatorName) { message = chalk.dim('assert') + chalk.dim('.' + operatorName + '(') + @@ -75,15 +85,6 @@ const assertMatcherHint = (operator: string | null, operatorName: string) => { chalk.dim(')'); } - if (operator === '==') { - message += - ' or ' + - chalk.dim('assert') + - chalk.dim('(') + - chalk.red('received') + - chalk.dim(') '); - } - return message; }; @@ -121,7 +122,7 @@ function assertionErrorMessage( } return ( - buildHintString(assertMatcherHint(operator, operatorName)) + + buildHintString(assertMatcherHint(operator, operatorName, expected)) + chalk.reset(`Expected value ${operatorMessage(operator)}`) + ` ${printExpected(expected)}\n` + chalk.reset(`Received:\n`) + From 9a15d46823bb612786aee9d3d09970a99836ad6d Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Sat, 10 Aug 2019 18:49:31 -0400 Subject: [PATCH 23/34] expect: Display equal values for ReturnedWith similar to CalledWith (#8791) * expect: Display equal values for ReturnedWith similar to CalledWith * Update CHANGELOG.md --- CHANGELOG.md | 1 + .../__snapshots__/spyMatchers.test.js.snap | 24 +++++++++---------- packages/expect/src/spyMatchers.ts | 20 +++++++++++----- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 849150ef222b..119fa802697d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - `[expect]` Throw matcher error when received cannot be jasmine spy ([#8747](https://github.com/facebook/jest/pull/8747)) - `[expect]` Improve report when negative CalledWith assertion fails ([#8755](https://github.com/facebook/jest/pull/8755)) - `[expect]` Improve report when positive CalledWith assertion fails ([#8771](https://github.com/facebook/jest/pull/8771)) +- `[expect]` Display equal values for ReturnedWith similar to CalledWith ([#8791](https://github.com/facebook/jest/pull/8791)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) - `[jest-core]` Improve report when snapshots are obsolete ([#8448](https://github.com/facebook/jest/pull/8665)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) diff --git a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap index c22e8bdf327e..1fa46b12f5ea 100644 --- a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap @@ -175,7 +175,7 @@ exports[`lastReturnedWith lastReturnedWith works with three calls 1`] = ` Expected: not \\"foo3\\" Received 2: \\"foo2\\" --> 3: \\"foo3\\" +-> 3: \\"foo3\\" Number of returns: 3" `; @@ -493,7 +493,7 @@ n: 3 Expected: not 1 Received 2: function call has not returned yet --> 3: 1 +-> 3: 1 4: 0 Number of returns: 2 @@ -507,7 +507,7 @@ n: 4 Expected: not 0 Received 3: 1 --> 4: 0 +-> 4: 0 Number of returns: 2 Number of calls: 4" @@ -545,7 +545,7 @@ exports[`nthReturnedWith nthReturnedWith should reject nth value greater than nu n: 4 Expected: \\"foo\\" Received - 3: \\"foo\\" + 3: \\"foo\\" Number of returns: 3" `; @@ -568,7 +568,7 @@ exports[`nthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first n: 1 Expected: not \\"foo1\\" Received --> 1: \\"foo1\\" +-> 1: \\"foo1\\" 2: \\"foo2\\" Number of returns: 3" @@ -580,7 +580,7 @@ exports[`nthReturnedWith nthReturnedWith works with three calls 1`] = ` n: 1 Expected: not \\"foo1\\" Received --> 1: \\"foo1\\" +-> 1: \\"foo1\\" 2: \\"foo2\\" Number of returns: 3" @@ -1669,7 +1669,7 @@ exports[`toHaveLastReturnedWith lastReturnedWith works with three calls 1`] = ` Expected: not \\"foo3\\" Received 2: \\"foo2\\" --> 3: \\"foo3\\" +-> 3: \\"foo3\\" Number of returns: 3" `; @@ -1831,7 +1831,7 @@ n: 3 Expected: not 1 Received 2: function call has not returned yet --> 3: 1 +-> 3: 1 4: 0 Number of returns: 2 @@ -1845,7 +1845,7 @@ n: 4 Expected: not 0 Received 3: 1 --> 4: 0 +-> 4: 0 Number of returns: 2 Number of calls: 4" @@ -1883,7 +1883,7 @@ exports[`toHaveNthReturnedWith nthReturnedWith should reject nth value greater t n: 4 Expected: \\"foo\\" Received - 3: \\"foo\\" + 3: \\"foo\\" Number of returns: 3" `; @@ -1906,7 +1906,7 @@ exports[`toHaveNthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with n: 1 Expected: not \\"foo1\\" Received --> 1: \\"foo1\\" +-> 1: \\"foo1\\" 2: \\"foo2\\" Number of returns: 3" @@ -1918,7 +1918,7 @@ exports[`toHaveNthReturnedWith nthReturnedWith works with three calls 1`] = ` n: 1 Expected: not \\"foo1\\" Received --> 1: \\"foo1\\" +-> 1: \\"foo1\\" 2: \\"foo2\\" Number of returns: 3" diff --git a/packages/expect/src/spyMatchers.ts b/packages/expect/src/spyMatchers.ts index 890dfce1f18b..0a37636fc64a 100644 --- a/packages/expect/src/spyMatchers.ts +++ b/packages/expect/src/spyMatchers.ts @@ -61,11 +61,10 @@ const isEqualValue = (expected: unknown, received: unknown): boolean => const isEqualCall = ( expected: Array, received: Array, -): boolean => equals(expected, received, [iterableEquality]); +): boolean => isEqualValue(expected, received); const isEqualReturn = (expected: unknown, result: any): boolean => - result.type === 'return' && - equals(expected, result.value, [iterableEquality]); + result.type === 'return' && isEqualValue(expected, result.value); const countReturns = (results: Array): number => results.reduce( @@ -313,11 +312,13 @@ const isLineDiffableArg = (expected: unknown, received: unknown): boolean => { return true; }; -const printResult = (result: any) => +const printResult = (result: any, expected: unknown) => result.type === 'throw' ? 'function call threw an error' : result.type === 'incomplete' ? 'function call has not returned yet' + : isEqualValue(expected, result.value) + ? printCommon(result.value) : printReceived(result.value); type IndexedResult = [number, any]; @@ -326,6 +327,7 @@ type IndexedResult = [number, any]; // so additional empty line can separate from `Number of returns` which follows. const printReceivedResults = ( label: string, + expected: unknown, indexedResults: Array, isOnlyCall: boolean, iExpectedCall?: number, @@ -335,7 +337,7 @@ const printReceivedResults = ( } if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) { - return label + printResult(indexedResults[0][1]) + '\n'; + return label + printResult(indexedResults[0][1], expected) + '\n'; } const printAligned = getRightAlignedPrinter(label); @@ -347,7 +349,7 @@ const printReceivedResults = ( (printed: string, [i, result]: IndexedResult) => printed + printAligned(String(i + 1), i === iExpectedCall) + - printResult(result) + + printResult(result, expected) + '\n', '', ) @@ -656,6 +658,7 @@ const createToReturnWithMatcher = (matcherName: string) => ? '' : printReceivedResults( 'Received: ', + expected, indexedResults, results.length === 1, )) + @@ -677,6 +680,7 @@ const createToReturnWithMatcher = (matcherName: string) => `Expected: ${printExpected(expected)}\n` + printReceivedResults( 'Received: ', + expected, indexedResults, results.length === 1, ) + @@ -809,6 +813,7 @@ const createLastReturnedMatcher = (matcherName: string) => ? '' : printReceivedResults( 'Received: ', + expected, indexedResults, results.length === 1, iLast, @@ -841,6 +846,7 @@ const createLastReturnedMatcher = (matcherName: string) => `Expected: ${printExpected(expected)}\n` + printReceivedResults( 'Received: ', + expected, indexedResults, results.length === 1, iLast, @@ -1037,6 +1043,7 @@ const createNthReturnedWithMatcher = (matcherName: string) => ? '' : printReceivedResults( 'Received: ', + expected, indexedResults, results.length === 1, iNth, @@ -1097,6 +1104,7 @@ const createNthReturnedWithMatcher = (matcherName: string) => `Expected: ${printExpected(expected)}\n` + printReceivedResults( 'Received: ', + expected, indexedResults, results.length === 1, iNth, From 867b518e25f1c0f68bbe3d1a5d920348d653a9f4 Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Sun, 11 Aug 2019 14:01:45 -0300 Subject: [PATCH 24/34] =?UTF-8?q?Docs:=20Fix=20WatchPlugins=20`jestHooks.s?= =?UTF-8?q?houldRunTestSuite`=20example=20t=E2=80=A6=20(#8784)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update CHANGELOG.md * Fix WatchPlugins jestHooks.shouldRunTestSuite docs * Update CHANGELOG.md --- CHANGELOG.md | 4 +++- docs/WatchPlugins.md | 10 +++++----- website/versioned_docs/version-23.x/WatchPlugins.md | 10 +++++----- website/versioned_docs/version-24.0/WatchPlugins.md | 10 +++++----- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 119fa802697d..6e6072e0ac8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,9 @@ - `[docs]` Updated react tutorial to refer to new package of react-testing-library (@testing-library/react) ([#8753](https://github.com/facebook/jest/pull/8753)) - `[docs]` Updated imports of react-testing-library to @testing-library/react in website ([#8757](https://github.com/facebook/jest/pull/8757)) - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) -- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783)) +- `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) +- `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783)) +- `[docs]` Fix WatchPlugins `jestHooks.shouldRunTestSuite` example that receives an object ([#8784](https://github.com/facebook/jest/pull/8784)) ### Performance diff --git a/docs/WatchPlugins.md b/docs/WatchPlugins.md index 6047382eefc0..abf4ad118d28 100644 --- a/docs/WatchPlugins.md +++ b/docs/WatchPlugins.md @@ -46,7 +46,7 @@ class MyWatchPlugin { Below are the hooks available in Jest. -#### `jestHooks.shouldRunTestSuite(testPath)` +#### `jestHooks.shouldRunTestSuite(testSuiteInfo)` Returns a boolean (or `Promise` for handling asynchronous operations) to specify if a test should be run or not. @@ -55,13 +55,13 @@ For example: ```javascript class MyWatchPlugin { apply(jestHooks) { - jestHooks.shouldRunTestSuite(testPath => { - return testPath.includes('my-keyword'); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return testSuiteInfo.testPath.includes('my-keyword'); }); // or a promise - jestHooks.shouldRunTestSuite(testPath => { - return Promise.resolve(testPath.includes('my-keyword')); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword')); }); } } diff --git a/website/versioned_docs/version-23.x/WatchPlugins.md b/website/versioned_docs/version-23.x/WatchPlugins.md index 56a2208d2e59..529a6f5977eb 100644 --- a/website/versioned_docs/version-23.x/WatchPlugins.md +++ b/website/versioned_docs/version-23.x/WatchPlugins.md @@ -47,7 +47,7 @@ class MyWatchPlugin { Below are the hooks available in Jest. -#### `jestHooks.shouldRunTestSuite(testPath)` +#### `jestHooks.shouldRunTestSuite(testSuiteInfo)` Returns a boolean (or `Promise` for handling asynchronous operations) to specify if a test should be run or not. @@ -56,13 +56,13 @@ For example: ```javascript class MyWatchPlugin { apply(jestHooks) { - jestHooks.shouldRunTestSuite(testPath => { - return testPath.includes('my-keyword'); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return testSuiteInfo.testPath.includes('my-keyword'); }); // or a promise - jestHooks.shouldRunTestSuite(testPath => { - return Promise.resolve(testPath.includes('my-keyword')); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword')); }); } } diff --git a/website/versioned_docs/version-24.0/WatchPlugins.md b/website/versioned_docs/version-24.0/WatchPlugins.md index 8b6acd192ed7..d43935a82c04 100644 --- a/website/versioned_docs/version-24.0/WatchPlugins.md +++ b/website/versioned_docs/version-24.0/WatchPlugins.md @@ -47,7 +47,7 @@ class MyWatchPlugin { Below are the hooks available in Jest. -#### `jestHooks.shouldRunTestSuite(testPath)` +#### `jestHooks.shouldRunTestSuite(testSuiteInfo)` Returns a boolean (or `Promise` for handling asynchronous operations) to specify if a test should be run or not. @@ -56,13 +56,13 @@ For example: ```javascript class MyWatchPlugin { apply(jestHooks) { - jestHooks.shouldRunTestSuite(testPath => { - return testPath.includes('my-keyword'); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return testSuiteInfo.testPath.includes('my-keyword'); }); // or a promise - jestHooks.shouldRunTestSuite(testPath => { - return Promise.resolve(testPath.includes('my-keyword')); + jestHooks.shouldRunTestSuite(testSuiteInfo => { + return Promise.resolve(testSuiteInfo.testPath.includes('my-keyword')); }); } } From d9b43a88bf9c5d4eb3e12b88edad60ac1ee30609 Mon Sep 17 00:00:00 2001 From: Tim Seckinger Date: Sun, 11 Aug 2019 19:39:08 +0200 Subject: [PATCH 25/34] remove unreleased `--testTimeout` feature from versioned_docs (#8811) --- website/versioned_docs/version-24.8/CLI.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/website/versioned_docs/version-24.8/CLI.md b/website/versioned_docs/version-24.8/CLI.md index da78d52957b7..305d01ca66c3 100644 --- a/website/versioned_docs/version-24.8/CLI.md +++ b/website/versioned_docs/version-24.8/CLI.md @@ -302,10 +302,6 @@ Lets you specify a custom test runner. Lets you specify a custom test sequencer. Please refer to the documentation of the corresponding configuration property for details. -### `--testTimeout=` - -Default timeout of a test in milliseconds. Default value: 5000. - ### `--updateSnapshot` Alias: `-u`. Use this flag to re-record every snapshot that fails during this test run. Can be used together with a test suite pattern or with `--testNamePattern` to re-record snapshots. From 86e73f5b22e8a02b5233af78c68ef7318c59e1b3 Mon Sep 17 00:00:00 2001 From: Tim Seckinger Date: Sun, 11 Aug 2019 20:49:53 +0200 Subject: [PATCH 26/34] chore: enforce LF line endings (#8809) * chore: enforce LF line endings * Update CHANGELOG.md * Update .editorconfig --- .circleci/config.yml | 2 +- .editorconfig | 10 +- CHANGELOG.md | 1 + package.json | 4 +- .../__arbitraries__/sharedSettings.ts | 48 ++++---- .../matchers-toContain.property.test.ts | 96 +++++++-------- .../matchers-toContainEqual.property.test.ts | 92 +++++++------- .../matchers-toEqual.property.test.ts | 116 +++++++++--------- .../matchers-toStrictEqual.property.test.ts | 98 +++++++-------- 9 files changed, 238 insertions(+), 229 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b00c42135d9..cb4fb65c20cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,7 +27,7 @@ jobs: - restore-cache: *restore-cache - run: yarn --no-progress --frozen-lockfile - save-cache: *save-cache - - run: yarn lint --format junit -o reports/junit/js-lint-results.xml && yarn lint-es5-build --format junit -o reports/junit/js-es5-lint-results.xml && yarn lint:md:ci && yarn check-copyright-headers + - run: yarn lint --format junit -o reports/junit/js-lint-results.xml && yarn lint-es5-build --format junit -o reports/junit/js-es5-lint-results.xml && yarn lint:prettier:ci && yarn check-copyright-headers - store_test_results: path: reports/junit diff --git a/.editorconfig b/.editorconfig index a124324a1532..63a501ede3a9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,19 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org +# +# Some of these options are also respected by Prettier + root = true [*] indent_style = space indent_size = 2 + +end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[{*.md,*.snap}] +[*.{md,snap}] trim_trailing_whitespace = false diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6072e0ac8d..3a39c5e145e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ - `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) - `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783)) - `[docs]` Fix WatchPlugins `jestHooks.shouldRunTestSuite` example that receives an object ([#8784](https://github.com/facebook/jest/pull/8784)) +- `[*]` Enforce LF line endings ([#8809](https://github.com/facebook/jest/pull/8809)) ### Performance diff --git a/package.json b/package.json index 1d5fa1644a6f..4cb7378f3ac4 100644 --- a/package.json +++ b/package.json @@ -86,8 +86,8 @@ "jest-coverage": "yarn jest --coverage", "lint": "eslint . --cache --report-unused-disable-directives --ext js,jsx,ts,tsx,md", "lint-es5-build": "eslint --no-eslintrc --no-ignore --env=browser packages/*/build-es5", - "lint:md": "yarn --silent lint:md:ci --fix", - "lint:md:ci": "prettylint '**/*.{md,yml,yaml}' --ignore-path .gitignore", + "lint:prettier": "yarn --silent lint:prettier:ci --fix", + "lint:prettier:ci": "prettylint '**/*.{md,yml,yaml}' --ignore-path .gitignore", "postinstall": "opencollective postinstall && yarn build", "publish": "yarn build-clean && yarn build && lerna publish --silent", "test-ci-es5-build-in-browser": "karma start --single-run", diff --git a/packages/expect/src/__tests__/__arbitraries__/sharedSettings.ts b/packages/expect/src/__tests__/__arbitraries__/sharedSettings.ts index ed8092112bf5..c9c85274bfd4 100644 --- a/packages/expect/src/__tests__/__arbitraries__/sharedSettings.ts +++ b/packages/expect/src/__tests__/__arbitraries__/sharedSettings.ts @@ -1,24 +1,24 @@ -/** - * 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 fc from 'fast-check'; - -// settings for anything arbitrary -export const anythingSettings = { - key: fc.oneof(fc.string(), fc.constantFrom('k1', 'k2', 'k3')), - maxDepth: 2, // Limit object depth (default: 2) - maxKeys: 5, // Limit number of keys per object (default: 5) - withBoxedValues: true, - // Issue #7975 have to be fixed before enabling the generation of Map - withMap: false, - // Issue #7975 have to be fixed before enabling the generation of Set - withSet: false, -}; - -// assertion settings -export const assertSettings = {}; // eg.: {numRuns: 10000} +/** + * 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 fc from 'fast-check'; + +// settings for anything arbitrary +export const anythingSettings = { + key: fc.oneof(fc.string(), fc.constantFrom('k1', 'k2', 'k3')), + maxDepth: 2, // Limit object depth (default: 2) + maxKeys: 5, // Limit number of keys per object (default: 5) + withBoxedValues: true, + // Issue #7975 have to be fixed before enabling the generation of Map + withMap: false, + // Issue #7975 have to be fixed before enabling the generation of Set + withSet: false, +}; + +// assertion settings +export const assertSettings = {}; // eg.: {numRuns: 10000} diff --git a/packages/expect/src/__tests__/matchers-toContain.property.test.ts b/packages/expect/src/__tests__/matchers-toContain.property.test.ts index 29e9b4c1d4e5..6cdcf3a907e0 100644 --- a/packages/expect/src/__tests__/matchers-toContain.property.test.ts +++ b/packages/expect/src/__tests__/matchers-toContain.property.test.ts @@ -1,48 +1,48 @@ -/** - * 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 fc from 'fast-check'; -import { - anythingSettings, - assertSettings, -} from './__arbitraries__/sharedSettings'; - -describe('toContain', () => { - it('should always find the value when inside the array', () => { - fc.assert( - fc.property( - fc.array(fc.anything(anythingSettings)), - fc.array(fc.anything(anythingSettings)), - fc.anything(anythingSettings).filter(v => !Number.isNaN(v)), - (startValues, endValues, v) => { - // Given: startValues, endValues arrays and v value (not NaN) - expect([...startValues, v, ...endValues]).toContain(v); - }, - ), - assertSettings, - ); - }); - - it('should not find the value if it has been cloned into the array', () => { - fc.assert( - fc.property( - fc.array(fc.anything(anythingSettings)), - fc.array(fc.anything(anythingSettings)), - fc.dedup(fc.anything(anythingSettings), 2), - (startValues, endValues, [a, b]) => { - // Given: startValues, endValues arrays - // and [a, b] equal, but not the same values - // with `typeof a === 'object && a !== null` - fc.pre(typeof a === 'object' && a !== null); - expect([...startValues, a, ...endValues]).not.toContain(b); - }, - ), - assertSettings, - ); - }); -}); +/** + * 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 fc from 'fast-check'; +import { + anythingSettings, + assertSettings, +} from './__arbitraries__/sharedSettings'; + +describe('toContain', () => { + it('should always find the value when inside the array', () => { + fc.assert( + fc.property( + fc.array(fc.anything(anythingSettings)), + fc.array(fc.anything(anythingSettings)), + fc.anything(anythingSettings).filter(v => !Number.isNaN(v)), + (startValues, endValues, v) => { + // Given: startValues, endValues arrays and v value (not NaN) + expect([...startValues, v, ...endValues]).toContain(v); + }, + ), + assertSettings, + ); + }); + + it('should not find the value if it has been cloned into the array', () => { + fc.assert( + fc.property( + fc.array(fc.anything(anythingSettings)), + fc.array(fc.anything(anythingSettings)), + fc.dedup(fc.anything(anythingSettings), 2), + (startValues, endValues, [a, b]) => { + // Given: startValues, endValues arrays + // and [a, b] equal, but not the same values + // with `typeof a === 'object && a !== null` + fc.pre(typeof a === 'object' && a !== null); + expect([...startValues, a, ...endValues]).not.toContain(b); + }, + ), + assertSettings, + ); + }); +}); diff --git a/packages/expect/src/__tests__/matchers-toContainEqual.property.test.ts b/packages/expect/src/__tests__/matchers-toContainEqual.property.test.ts index ab6145a645f7..33edfed6a40c 100644 --- a/packages/expect/src/__tests__/matchers-toContainEqual.property.test.ts +++ b/packages/expect/src/__tests__/matchers-toContainEqual.property.test.ts @@ -1,46 +1,46 @@ -/** - * 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 fc from 'fast-check'; -import { - anythingSettings, - assertSettings, -} from './__arbitraries__/sharedSettings'; - -describe('toContainEqual', () => { - it('should always find the value when inside the array', () => { - fc.assert( - fc.property( - fc.array(fc.anything(anythingSettings)), - fc.array(fc.anything(anythingSettings)), - fc.anything(anythingSettings), - (startValues, endValues, v) => { - // Given: startValues, endValues arrays and v any value - expect([...startValues, v, ...endValues]).toContainEqual(v); - }, - ), - assertSettings, - ); - }); - - it('should always find the value when cloned inside the array', () => { - fc.assert( - fc.property( - fc.array(fc.anything(anythingSettings)), - fc.array(fc.anything(anythingSettings)), - fc.dedup(fc.anything(anythingSettings), 2), - (startValues, endValues, [a, b]) => { - // Given: startValues, endValues arrays - // and [a, b] identical values - expect([...startValues, a, ...endValues]).toContainEqual(b); - }, - ), - assertSettings, - ); - }); -}); +/** + * 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 fc from 'fast-check'; +import { + anythingSettings, + assertSettings, +} from './__arbitraries__/sharedSettings'; + +describe('toContainEqual', () => { + it('should always find the value when inside the array', () => { + fc.assert( + fc.property( + fc.array(fc.anything(anythingSettings)), + fc.array(fc.anything(anythingSettings)), + fc.anything(anythingSettings), + (startValues, endValues, v) => { + // Given: startValues, endValues arrays and v any value + expect([...startValues, v, ...endValues]).toContainEqual(v); + }, + ), + assertSettings, + ); + }); + + it('should always find the value when cloned inside the array', () => { + fc.assert( + fc.property( + fc.array(fc.anything(anythingSettings)), + fc.array(fc.anything(anythingSettings)), + fc.dedup(fc.anything(anythingSettings), 2), + (startValues, endValues, [a, b]) => { + // Given: startValues, endValues arrays + // and [a, b] identical values + expect([...startValues, a, ...endValues]).toContainEqual(b); + }, + ), + assertSettings, + ); + }); +}); diff --git a/packages/expect/src/__tests__/matchers-toEqual.property.test.ts b/packages/expect/src/__tests__/matchers-toEqual.property.test.ts index ca7d88ef7390..3ebefa5f3bd0 100644 --- a/packages/expect/src/__tests__/matchers-toEqual.property.test.ts +++ b/packages/expect/src/__tests__/matchers-toEqual.property.test.ts @@ -1,58 +1,58 @@ -/** - * 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 fc from 'fast-check'; -import { - anythingSettings, - assertSettings, -} from './__arbitraries__/sharedSettings'; - -describe('toEqual', () => { - it('should be reflexive', () => { - fc.assert( - fc.property(fc.dedup(fc.anything(anythingSettings), 2), ([a, b]) => { - // Given: a and b identical values - expect(a).toEqual(b); - }), - assertSettings, - ); - }); - - it('should be symmetric', () => { - const safeExpectEqual = (a, b) => { - try { - expect(a).toEqual(b); - return true; - } catch (err) { - return false; - } - }; - fc.assert( - fc.property( - fc.anything(anythingSettings), - fc.anything(anythingSettings), - (a, b) => { - // Given: a and b values - // Assert: We expect `expect(a).toEqual(b)` - // to be equivalent to `expect(b).toEqual(a)` - expect(safeExpectEqual(a, b)).toBe(safeExpectEqual(b, a)); - }, - ), - { - ...assertSettings, - examples: [ - [0, 5e-324], // Issue #7941 - // [ - // new Set([false, true]), - // new Set([new Boolean(true), new Boolean(true)]), - // ], // Issue #7975 - ], - }, - ); - }); -}); +/** + * 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 fc from 'fast-check'; +import { + anythingSettings, + assertSettings, +} from './__arbitraries__/sharedSettings'; + +describe('toEqual', () => { + it('should be reflexive', () => { + fc.assert( + fc.property(fc.dedup(fc.anything(anythingSettings), 2), ([a, b]) => { + // Given: a and b identical values + expect(a).toEqual(b); + }), + assertSettings, + ); + }); + + it('should be symmetric', () => { + const safeExpectEqual = (a, b) => { + try { + expect(a).toEqual(b); + return true; + } catch (err) { + return false; + } + }; + fc.assert( + fc.property( + fc.anything(anythingSettings), + fc.anything(anythingSettings), + (a, b) => { + // Given: a and b values + // Assert: We expect `expect(a).toEqual(b)` + // to be equivalent to `expect(b).toEqual(a)` + expect(safeExpectEqual(a, b)).toBe(safeExpectEqual(b, a)); + }, + ), + { + ...assertSettings, + examples: [ + [0, 5e-324], // Issue #7941 + // [ + // new Set([false, true]), + // new Set([new Boolean(true), new Boolean(true)]), + // ], // Issue #7975 + ], + }, + ); + }); +}); diff --git a/packages/expect/src/__tests__/matchers-toStrictEqual.property.test.ts b/packages/expect/src/__tests__/matchers-toStrictEqual.property.test.ts index 70dcd4e5cd1b..82b776cb175f 100644 --- a/packages/expect/src/__tests__/matchers-toStrictEqual.property.test.ts +++ b/packages/expect/src/__tests__/matchers-toStrictEqual.property.test.ts @@ -1,49 +1,49 @@ -/** - * 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 fc from 'fast-check'; -import { - anythingSettings, - assertSettings, -} from './__arbitraries__/sharedSettings'; - -describe('toStrictEqual', () => { - it('should be reflexive', () => { - fc.assert( - fc.property(fc.dedup(fc.anything(anythingSettings), 2), ([a, b]) => { - // Given: a and b identical values - expect(a).toStrictEqual(b); - }), - assertSettings, - ); - }); - - it('should be symmetric', () => { - const safeExpectStrictEqual = (a, b) => { - try { - expect(a).toStrictEqual(b); - return true; - } catch (err) { - return false; - } - }; - fc.assert( - fc.property( - fc.anything(anythingSettings), - fc.anything(anythingSettings), - (a, b) => { - // Given: a and b values - // Assert: We expect `expect(a).toStrictEqual(b)` - // to be equivalent to `expect(b).toStrictEqual(a)` - expect(safeExpectStrictEqual(a, b)).toBe(safeExpectStrictEqual(b, a)); - }, - ), - assertSettings, - ); - }); -}); +/** + * 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 fc from 'fast-check'; +import { + anythingSettings, + assertSettings, +} from './__arbitraries__/sharedSettings'; + +describe('toStrictEqual', () => { + it('should be reflexive', () => { + fc.assert( + fc.property(fc.dedup(fc.anything(anythingSettings), 2), ([a, b]) => { + // Given: a and b identical values + expect(a).toStrictEqual(b); + }), + assertSettings, + ); + }); + + it('should be symmetric', () => { + const safeExpectStrictEqual = (a, b) => { + try { + expect(a).toStrictEqual(b); + return true; + } catch (err) { + return false; + } + }; + fc.assert( + fc.property( + fc.anything(anythingSettings), + fc.anything(anythingSettings), + (a, b) => { + // Given: a and b values + // Assert: We expect `expect(a).toStrictEqual(b)` + // to be equivalent to `expect(b).toStrictEqual(a)` + expect(safeExpectStrictEqual(a, b)).toBe(safeExpectStrictEqual(b, a)); + }, + ), + assertSettings, + ); + }); +}); From 94067089dd25c77463e24e981fe979fb6cc0b2fb Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Mon, 12 Aug 2019 13:22:29 -0400 Subject: [PATCH 27/34] expect, jest-snapshot: Change color from green for some args in matcher hints (#8812) * expect, jest-snapshot: Change color from green for some args in matcher hints * Update CHANGELOG.md --- CHANGELOG.md | 1 + .../__snapshots__/matchers.test.js.snap | 40 ++-- .../__snapshots__/spyMatchers.test.js.snap | 208 +++++++++--------- packages/expect/src/matchers.ts | 5 +- packages/expect/src/spyMatchers.ts | 10 +- packages/jest-snapshot/src/index.ts | 11 +- 6 files changed, 144 insertions(+), 131 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a39c5e145e7..00522ef3dbc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - `[expect]` Improve report when negative CalledWith assertion fails ([#8755](https://github.com/facebook/jest/pull/8755)) - `[expect]` Improve report when positive CalledWith assertion fails ([#8771](https://github.com/facebook/jest/pull/8771)) - `[expect]` Display equal values for ReturnedWith similar to CalledWith ([#8791](https://github.com/facebook/jest/pull/8791)) +- `[expect, jest-snapshot]` Change color from green for some args in matcher hints ([#8812](https://github.com/facebook/jest/pull/8812)) - `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569)) - `[jest-core]` Improve report when snapshots are obsolete ([#8448](https://github.com/facebook/jest/pull/8665)) - `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454)) diff --git a/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap index e50e796cb05f..45aa734410be 100644 --- a/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap @@ -475,7 +475,7 @@ exports[`.toBeCloseTo() {pass: false} expect(-Infinity)toBeCloseTo( -1.23) 1`] = Expected: -1.23 Received: -Infinity -Expected precision: 2 +Expected precision: 2 Expected difference: < 0.005 Received difference: Infinity" `; @@ -486,7 +486,7 @@ exports[`.toBeCloseTo() {pass: false} expect(Infinity)toBeCloseTo( -Infinity) 1` Expected: -Infinity Received: Infinity -Expected precision: 2 +Expected precision: 2 Expected difference: < 0.005 Received difference: Infinity" `; @@ -497,7 +497,7 @@ exports[`.toBeCloseTo() {pass: false} expect(Infinity)toBeCloseTo( 1.23) 1`] = ` Expected: 1.23 Received: Infinity -Expected precision: 2 +Expected precision: 2 Expected difference: < 0.005 Received difference: Infinity" `; @@ -522,7 +522,7 @@ exports[`.toBeCloseTo() {pass: true} expect(0)toBeCloseTo( 0.001) 1`] = ` Expected: not 0.001 Received: 0 -Expected precision: 2 +Expected precision: 2 Expected difference: not < 0.005 Received difference: 0.001" `; @@ -533,7 +533,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.225) 1`] = ` Expected: not 1.225 Received: 1.23 -Expected precision: 2 +Expected precision: 2 Expected difference: not < 0.005 Received difference: 0.004999999999999893" `; @@ -544,7 +544,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.226) 1`] = ` Expected: not 1.226 Received: 1.23 -Expected precision: 2 +Expected precision: 2 Expected difference: not < 0.005 Received difference: 0.0040000000000000036" `; @@ -555,7 +555,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.229) 1`] = ` Expected: not 1.229 Received: 1.23 -Expected precision: 2 +Expected precision: 2 Expected difference: not < 0.005 Received difference: 0.0009999999999998899" `; @@ -566,7 +566,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.234) 1`] = ` Expected: not 1.234 Received: 1.23 -Expected precision: 2 +Expected precision: 2 Expected difference: not < 0.005 Received difference: 0.0040000000000000036" `; @@ -579,34 +579,34 @@ Expected: not Infinity `; exports[`.toBeCloseTo() accepts an optional precision argument: [0, 0.000004, 5] 1`] = ` -"expect(received).not.toBeCloseTo(expected, precision) +"expect(received).not.toBeCloseTo(expected, precision) Expected: not 0.000004 Received: 0 -Expected precision: 5 +Expected precision: 5 Expected difference: not < 0.000005 Received difference: 0.000004" `; exports[`.toBeCloseTo() accepts an optional precision argument: [0, 0.0001, 3] 1`] = ` -"expect(received).not.toBeCloseTo(expected, precision) +"expect(received).not.toBeCloseTo(expected, precision) Expected: not 0.0001 Received: 0 -Expected precision: 3 +Expected precision: 3 Expected difference: not < 0.0005 Received difference: 0.0001" `; exports[`.toBeCloseTo() accepts an optional precision argument: [0, 0.1, 0] 1`] = ` -"expect(received).not.toBeCloseTo(expected, precision) +"expect(received).not.toBeCloseTo(expected, precision) Expected: not 0.1 Received: 0 -Expected precision: 0 +Expected precision: 0 Expected difference: not < 0.5 Received difference: 0.1" `; @@ -617,7 +617,7 @@ exports[`.toBeCloseTo() throws: [0, 0.01] 1`] = ` Expected: 0.01 Received: 0 -Expected precision: 2 +Expected precision: 2 Expected difference: < 0.005 Received difference: 0.01" `; @@ -628,7 +628,7 @@ exports[`.toBeCloseTo() throws: [1, 1.23] 1`] = ` Expected: 1.23 Received: 1 -Expected precision: 2 +Expected precision: 2 Expected difference: < 0.005 Received difference: 0.22999999999999998" `; @@ -639,13 +639,13 @@ exports[`.toBeCloseTo() throws: [1.23, 1.2249999] 1`] = ` Expected: 1.2249999 Received: 1.23 -Expected precision: 2 +Expected precision: 2 Expected difference: < 0.005 Received difference: 0.005000099999999952" `; exports[`.toBeCloseTo() throws: Matcher error promise empty isNot false received 1`] = ` -"expect(received).toBeCloseTo(expected, precision) +"expect(received).toBeCloseTo(expected, precision) Matcher error: received value must be a number @@ -680,7 +680,7 @@ Received has value: Symbol(0.1)" `; exports[`.toBeCloseTo() throws: Matcher error promise resolves isNot false received 1`] = ` -"expect(received).resolves.toBeCloseTo(expected, precision) +"expect(received).resolves.toBeCloseTo(expected, precision) Matcher error: received value must be a number @@ -689,7 +689,7 @@ Received has value: false" `; exports[`.toBeCloseTo() throws: Matcher error promise resolves isNot true expected 1`] = ` -"expect(received).resolves.not.toBeCloseTo(expected, precision) +"expect(received).resolves.not.toBeCloseTo(expected, precision) Matcher error: expected value must be a number diff --git a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap index 1fa46b12f5ea..1bf242fcd488 100644 --- a/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/spyMatchers.test.js.snap @@ -273,7 +273,7 @@ Number of returns: 1" `; exports[`nthCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.nthCalledWith(n, ...expected) +"expect(named-mock).not.nthCalledWith(n, ...expected) n: 1 Expected: not \\"foo\\", \\"bar\\" @@ -282,34 +282,34 @@ Number of calls: 1" `; exports[`nthCalledWith negative throw matcher error for n that is not integer 1`] = ` -"expect(received).not.nthCalledWith(n, ...expected) +"expect(received).not.nthCalledWith(n, ...expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: Infinity" +n has value: Infinity" `; exports[`nthCalledWith positive throw matcher error for n that is not integer 1`] = ` -"expect(received).nthCalledWith(n, ...expected) +"expect(received).nthCalledWith(n, ...expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0.1" +n has value: 0.1" `; exports[`nthCalledWith positive throw matcher error for n that is not positive integer 1`] = ` -"expect(received).nthCalledWith(n, ...expected) +"expect(received).nthCalledWith(n, ...expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0" +n has value: 0" `; exports[`nthCalledWith works only on spies or jest.fn 1`] = ` -"expect(received).nthCalledWith(n, ...expected) +"expect(received).nthCalledWith(n, ...expected) Matcher error: received value must be a mock or spy function @@ -318,7 +318,7 @@ Received has value: [Function fn]" `; exports[`nthCalledWith works when not called 1`] = ` -"expect(jest.fn()).nthCalledWith(n, ...expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) n: 1 Expected: \\"foo\\", \\"bar\\" @@ -327,7 +327,7 @@ Number of calls: 0" `; exports[`nthCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.nthCalledWith(n, ...expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) n: 1 Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} @@ -336,7 +336,7 @@ Number of calls: 1" `; exports[`nthCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.nthCalledWith(n, ...expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) n: 1 Expected: not Map {1 => 2, 2 => 1} @@ -345,7 +345,7 @@ Number of calls: 1" `; exports[`nthCalledWith works with Map 2`] = ` -"expect(jest.fn()).nthCalledWith(n, ...expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) n: 1 - Expected @@ -362,7 +362,7 @@ Number of calls: 1" `; exports[`nthCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.nthCalledWith(n, ...expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) n: 1 Expected: not Set {1, 2} @@ -371,7 +371,7 @@ Number of calls: 1" `; exports[`nthCalledWith works with Set 2`] = ` -"expect(jest.fn()).nthCalledWith(n, ...expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) n: 1 - Expected @@ -388,7 +388,7 @@ Number of calls: 1" `; exports[`nthCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).nthCalledWith(n, ...expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) n: 1 Expected: \\"foo\\", \\"bar\\" @@ -398,7 +398,7 @@ Number of calls: 1" `; exports[`nthCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.nthCalledWith(n, ...expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) n: 1 Expected: not \\"foo\\", \\"bar\\" @@ -407,7 +407,7 @@ Number of calls: 1" `; exports[`nthCalledWith works with three calls 1`] = ` -"expect(jest.fn()).not.nthCalledWith(n, ...expected) +"expect(jest.fn()).not.nthCalledWith(n, ...expected) n: 1 Expected: not \\"foo1\\", \\"bar\\" @@ -419,7 +419,7 @@ Number of calls: 3" `; exports[`nthCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).nthCalledWith(n, ...expected) +"expect(jest.fn()).nthCalledWith(n, ...expected) n: 1 Expected: \\"foo\\" @@ -429,7 +429,7 @@ Number of calls: 1" `; exports[`nthReturnedWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: undefined @@ -440,7 +440,7 @@ Number of calls: 1" `; exports[`nthReturnedWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: undefined @@ -451,7 +451,7 @@ Number of calls: 1" `; exports[`nthReturnedWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).nthReturnedWith(n, expected) +"expect(named-mock).nthReturnedWith(n, expected) n: 1 Expected: \\"foo\\" @@ -460,7 +460,7 @@ Number of returns: 0" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: 6 @@ -473,7 +473,7 @@ Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 2`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 2 Expected: 3 @@ -487,7 +487,7 @@ Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 3`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 3 Expected: not 1 @@ -501,7 +501,7 @@ Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 4`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 4 Expected: not 0 @@ -514,33 +514,33 @@ Number of calls: 4" `; exports[`nthReturnedWith nthReturnedWith negative throw matcher error for n that is not number 1`] = ` -"expect(received).not.nthReturnedWith(n, expected) +"expect(received).not.nthReturnedWith(n, expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer -n has value: undefined" +n has value: undefined" `; exports[`nthReturnedWith nthReturnedWith positive throw matcher error for n that is not integer 1`] = ` -"expect(received).nthReturnedWith(n, expected) +"expect(received).nthReturnedWith(n, expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0.1" +n has value: 0.1" `; exports[`nthReturnedWith nthReturnedWith positive throw matcher error for n that is not positive integer 1`] = ` -"expect(received).nthReturnedWith(n, expected) +"expect(received).nthReturnedWith(n, expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0" +n has value: 0" `; exports[`nthReturnedWith nthReturnedWith should reject nth value greater than number of calls 1`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 4 Expected: \\"foo\\" @@ -551,7 +551,7 @@ Number of returns: 3" `; exports[`nthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 1`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: \\"bar1\\" @@ -563,7 +563,7 @@ Number of returns: 3" `; exports[`nthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 2`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not \\"foo1\\" @@ -575,7 +575,7 @@ Number of returns: 3" `; exports[`nthReturnedWith nthReturnedWith works with three calls 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not \\"foo1\\" @@ -587,7 +587,7 @@ Number of returns: 3" `; exports[`nthReturnedWith works only on spies or jest.fn 1`] = ` -"expect(received).nthReturnedWith(n, expected) +"expect(received).nthReturnedWith(n, expected) Matcher error: received value must be a mock function @@ -596,7 +596,7 @@ Received has value: [Function fn]" `; exports[`nthReturnedWith works when not called 1`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: \\"foo\\" @@ -605,7 +605,7 @@ Number of returns: 0" `; exports[`nthReturnedWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} @@ -614,7 +614,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} @@ -623,7 +623,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with Map 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not Map {1 => 2, 2 => 1} @@ -632,7 +632,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with Map 2`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} @@ -642,7 +642,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with Set 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not Set {1, 2} @@ -651,7 +651,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with Set 2`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: Set {3, 4} @@ -661,7 +661,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not \\"foo\\" @@ -670,7 +670,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with argument that does not match 1`] = ` -"expect(jest.fn()).nthReturnedWith(n, expected) +"expect(jest.fn()).nthReturnedWith(n, expected) n: 1 Expected: \\"bar\\" @@ -680,7 +680,7 @@ Number of returns: 1" `; exports[`nthReturnedWith works with undefined 1`] = ` -"expect(jest.fn()).not.nthReturnedWith(n, expected) +"expect(jest.fn()).not.nthReturnedWith(n, expected) n: 1 Expected: not undefined @@ -1468,7 +1468,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).not.toHaveBeenNthCalledWith(n, ...expected) +"expect(named-mock).not.toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: not \\"foo\\", \\"bar\\" @@ -1477,34 +1477,34 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith negative throw matcher error for n that is not integer 1`] = ` -"expect(received).not.toHaveBeenNthCalledWith(n, ...expected) +"expect(received).not.toHaveBeenNthCalledWith(n, ...expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: Infinity" +n has value: Infinity" `; exports[`toHaveBeenNthCalledWith positive throw matcher error for n that is not integer 1`] = ` -"expect(received).toHaveBeenNthCalledWith(n, ...expected) +"expect(received).toHaveBeenNthCalledWith(n, ...expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0.1" +n has value: 0.1" `; exports[`toHaveBeenNthCalledWith positive throw matcher error for n that is not positive integer 1`] = ` -"expect(received).toHaveBeenNthCalledWith(n, ...expected) +"expect(received).toHaveBeenNthCalledWith(n, ...expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0" +n has value: 0" `; exports[`toHaveBeenNthCalledWith works only on spies or jest.fn 1`] = ` -"expect(received).toHaveBeenNthCalledWith(n, ...expected) +"expect(received).toHaveBeenNthCalledWith(n, ...expected) Matcher error: received value must be a mock or spy function @@ -1513,7 +1513,7 @@ Received has value: [Function fn]" `; exports[`toHaveBeenNthCalledWith works when not called 1`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: \\"foo\\", \\"bar\\" @@ -1522,7 +1522,7 @@ Number of calls: 0" `; exports[`toHaveBeenNthCalledWith works with Immutable.js objects 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}}, Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} @@ -1531,7 +1531,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: not Map {1 => 2, 2 => 1} @@ -1540,7 +1540,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Map 2`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) n: 1 - Expected @@ -1557,7 +1557,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: not Set {1, 2} @@ -1566,7 +1566,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with Set 2`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) n: 1 - Expected @@ -1583,7 +1583,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with arguments that don't match 1`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: \\"foo\\", \\"bar\\" @@ -1593,7 +1593,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with arguments that match 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: not \\"foo\\", \\"bar\\" @@ -1602,7 +1602,7 @@ Number of calls: 1" `; exports[`toHaveBeenNthCalledWith works with three calls 1`] = ` -"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).not.toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: not \\"foo1\\", \\"bar\\" @@ -1614,7 +1614,7 @@ Number of calls: 3" `; exports[`toHaveBeenNthCalledWith works with trailing undefined arguments 1`] = ` -"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) +"expect(jest.fn()).toHaveBeenNthCalledWith(n, ...expected) n: 1 Expected: \\"foo\\" @@ -1767,7 +1767,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith a call that throws is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: undefined @@ -1778,7 +1778,7 @@ Number of calls: 1" `; exports[`toHaveNthReturnedWith a call that throws undefined is not considered to have returned 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: undefined @@ -1789,7 +1789,7 @@ Number of calls: 1" `; exports[`toHaveNthReturnedWith includes the custom mock name in the error message 1`] = ` -"expect(named-mock).toHaveNthReturnedWith(n, expected) +"expect(named-mock).toHaveNthReturnedWith(n, expected) n: 1 Expected: \\"foo\\" @@ -1798,7 +1798,7 @@ Number of returns: 0" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: 6 @@ -1811,7 +1811,7 @@ Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 2`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 2 Expected: 3 @@ -1825,7 +1825,7 @@ Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 3`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 3 Expected: not 1 @@ -1839,7 +1839,7 @@ Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith incomplete recursive calls are handled properly 4`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 4 Expected: not 0 @@ -1852,33 +1852,33 @@ Number of calls: 4" `; exports[`toHaveNthReturnedWith nthReturnedWith negative throw matcher error for n that is not number 1`] = ` -"expect(received).not.toHaveNthReturnedWith(n, expected) +"expect(received).not.toHaveNthReturnedWith(n, expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer -n has value: undefined" +n has value: undefined" `; exports[`toHaveNthReturnedWith nthReturnedWith positive throw matcher error for n that is not integer 1`] = ` -"expect(received).toHaveNthReturnedWith(n, expected) +"expect(received).toHaveNthReturnedWith(n, expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0.1" +n has value: 0.1" `; exports[`toHaveNthReturnedWith nthReturnedWith positive throw matcher error for n that is not positive integer 1`] = ` -"expect(received).toHaveNthReturnedWith(n, expected) +"expect(received).toHaveNthReturnedWith(n, expected) -Matcher error: n must be a positive integer +Matcher error: n must be a positive integer n has type: number -n has value: 0" +n has value: 0" `; exports[`toHaveNthReturnedWith nthReturnedWith should reject nth value greater than number of calls 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 4 Expected: \\"foo\\" @@ -1889,7 +1889,7 @@ Number of returns: 3" `; exports[`toHaveNthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: \\"bar1\\" @@ -1901,7 +1901,7 @@ Number of returns: 3" `; exports[`toHaveNthReturnedWith nthReturnedWith should replace 1st, 2nd, 3rd with first, second, third 2`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not \\"foo1\\" @@ -1913,7 +1913,7 @@ Number of returns: 3" `; exports[`toHaveNthReturnedWith nthReturnedWith works with three calls 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not \\"foo1\\" @@ -1925,7 +1925,7 @@ Number of returns: 3" `; exports[`toHaveNthReturnedWith works only on spies or jest.fn 1`] = ` -"expect(received).toHaveNthReturnedWith(n, expected) +"expect(received).toHaveNthReturnedWith(n, expected) Matcher error: received value must be a mock function @@ -1934,7 +1934,7 @@ Received has value: [Function fn]" `; exports[`toHaveNthReturnedWith works when not called 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: \\"foo\\" @@ -1943,7 +1943,7 @@ Number of returns: 0" `; exports[`toHaveNthReturnedWith works with Immutable.js objects directly created 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} @@ -1952,7 +1952,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Immutable.js objects indirectly created 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not Immutable.Map {\\"a\\": {\\"b\\": \\"c\\"}} @@ -1961,7 +1961,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Map 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not Map {1 => 2, 2 => 1} @@ -1970,7 +1970,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Map 2`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: Map {\\"a\\" => \\"b\\", \\"b\\" => \\"a\\"} @@ -1980,7 +1980,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Set 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not Set {1, 2} @@ -1989,7 +1989,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with Set 2`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: Set {3, 4} @@ -1999,7 +1999,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with argument that does match 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not \\"foo\\" @@ -2008,7 +2008,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with argument that does not match 1`] = ` -"expect(jest.fn()).toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).toHaveNthReturnedWith(n, expected) n: 1 Expected: \\"bar\\" @@ -2018,7 +2018,7 @@ Number of returns: 1" `; exports[`toHaveNthReturnedWith works with undefined 1`] = ` -"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) +"expect(jest.fn()).not.toHaveNthReturnedWith(n, expected) n: 1 Expected: not undefined diff --git a/packages/expect/src/matchers.ts b/packages/expect/src/matchers.ts index 52a8c9fe7e4f..828d6b2c64d4 100644 --- a/packages/expect/src/matchers.ts +++ b/packages/expect/src/matchers.ts @@ -133,6 +133,7 @@ const matchers: MatchersObject = { isNot: this.isNot, promise: this.promise, secondArgument, + secondArgumentColor: (arg: string) => arg, }; ensureNumbers(received, expected, matcherName, options); @@ -159,7 +160,7 @@ const matchers: MatchersObject = { ? '' : `Received: ${printReceived(received)}\n` + '\n' + - `Expected precision: ${printExpected(precision)}\n` + + `Expected precision: ${stringify(precision)}\n` + `Expected difference: not < ${printExpected(expectedDiff)}\n` + `Received difference: ${printReceived(receivedDiff)}`) : () => @@ -168,7 +169,7 @@ const matchers: MatchersObject = { `Expected: ${printExpected(expected)}\n` + `Received: ${printReceived(received)}\n` + '\n' + - `Expected precision: ${printExpected(precision)}\n` + + `Expected precision: ${stringify(precision)}\n` + `Expected difference: < ${printExpected(expectedDiff)}\n` + `Received difference: ${printReceived(receivedDiff)}`; diff --git a/packages/expect/src/spyMatchers.ts b/packages/expect/src/spyMatchers.ts index 0a37636fc64a..86425155357d 100644 --- a/packages/expect/src/spyMatchers.ts +++ b/packages/expect/src/spyMatchers.ts @@ -867,6 +867,7 @@ const createNthCalledWithMatcher = (matcherName: string) => ): SyncExpectationResult { const expectedArgument = 'n'; const options: MatcherHintOptions = { + expectedColor: (arg: string) => arg, isNot: this.isNot, promise: this.promise, secondArgument: '...expected', @@ -877,8 +878,8 @@ const createNthCalledWithMatcher = (matcherName: string) => throw new Error( matcherErrorMessage( matcherHint(matcherName, undefined, expectedArgument, options), - `${EXPECTED_COLOR(expectedArgument)} must be a positive integer`, - printWithType(expectedArgument, nth, printExpected), + `${expectedArgument} must be a positive integer`, + printWithType(expectedArgument, nth, stringify), ), ); } @@ -996,6 +997,7 @@ const createNthReturnedWithMatcher = (matcherName: string) => ): SyncExpectationResult { const expectedArgument = 'n'; const options: MatcherHintOptions = { + expectedColor: (arg: string) => arg, isNot: this.isNot, promise: this.promise, secondArgument: 'expected', @@ -1006,8 +1008,8 @@ const createNthReturnedWithMatcher = (matcherName: string) => throw new Error( matcherErrorMessage( matcherHint(matcherName, undefined, expectedArgument, options), - `${EXPECTED_COLOR(expectedArgument)} must be a positive integer`, - printWithType(expectedArgument, nth, printExpected), + `${expectedArgument} must be a positive integer`, + printWithType(expectedArgument, nth, stringify), ), ); } diff --git a/packages/jest-snapshot/src/index.ts b/packages/jest-snapshot/src/index.ts index a6de3a1a9ddd..6745dc99658c 100644 --- a/packages/jest-snapshot/src/index.ts +++ b/packages/jest-snapshot/src/index.ts @@ -47,7 +47,8 @@ const NOT_SNAPSHOT_MATCHERS = `.${BOLD_WEIGHT( 'not', )} cannot be used with snapshot matchers`; -const HINT_ARG = BOLD_WEIGHT('hint'); +const HINT_ARG = 'hint'; +const HINT_COLOR = BOLD_WEIGHT; const INLINE_SNAPSHOT_ARG = 'snapshot'; const PROPERTY_MATCHERS_ARG = 'properties'; const INDENTATION_REGEX = /^([^\S\n]*)\S/m; @@ -186,6 +187,13 @@ const toMatchSnapshot = function( secondArgument, }; + if (expectedArgument === HINT_ARG) { + options.expectedColor = HINT_COLOR; + } + if (secondArgument === HINT_ARG) { + options.secondArgumentColor = HINT_COLOR; + } + if (arguments.length === 3 && !propertyMatchers) { throw new Error( 'Property matchers must be an object.\n\nTo provide a snapshot test name without property matchers, use: toMatchSnapshot("name")', @@ -385,6 +393,7 @@ const toThrowErrorMatchingSnapshot = function( const expectedArgument = typeof hint === 'string' && hint.length !== 0 ? HINT_ARG : ''; const options = { + expectedColor: HINT_COLOR, isNot: this.isNot, promise: this.promise, secondArgument: '', From 0d4834427f66091f403964c9be86a71d50a9f965 Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Tue, 13 Aug 2019 18:53:12 -0400 Subject: [PATCH 28/34] chore: Check copyright and license as one joined substring (#8815) * chore: Check copyright and license as one joined substring * Update CHANGELOG.md * Delete misleading comment --- CHANGELOG.md | 1 + scripts/checkCopyrightHeaders.js | 22 +++++++--------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00522ef3dbc5..462ef8d981c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ - `[jest-core]` Add `getVersion` (moved from `jest-cli`) ([#8706](https://github.com/facebook/jest/pull/8706)) - `[docs]` Fix MockFunctions example that was using toContain instead of toContainEqual ([#8765](https://github.com/facebook/jest/pull/8765)) - `[*]` Make sure copyright header comment includes license ([#8783](https://github.com/facebook/jest/pull/8783)) +- `[*]` Check copyright and license as one joined substring ([#8815](https://github.com/facebook/jest/pull/8815)) - `[docs]` Fix WatchPlugins `jestHooks.shouldRunTestSuite` example that receives an object ([#8784](https://github.com/facebook/jest/pull/8784)) - `[*]` Enforce LF line endings ([#8809](https://github.com/facebook/jest/pull/8809)) diff --git a/scripts/checkCopyrightHeaders.js b/scripts/checkCopyrightHeaders.js index 4d1b7e09962f..af68d4c78723 100755 --- a/scripts/checkCopyrightHeaders.js +++ b/scripts/checkCopyrightHeaders.js @@ -115,24 +115,16 @@ const INCLUDED_PATTERNS = [ /\.[^/]+$/, ]; -const COPYRIGHT_HEADER = - 'Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.'; -const LICENSE1 = - 'This source code is licensed under the MIT license found in the'; -const LICENSE2 = 'LICENSE file in the root directory of this source tree.'; +const COPYRIGHT_LICENSE = [ + ' * 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.', +].join('\n'); function needsCopyrightHeader(file) { const contents = getFileContents(file); - - // Match lines individually to avoid false positive for: - // comment block versus lines - // line ending LF versus CRLF - return ( - contents.trim().length > 0 && - (!contents.includes(COPYRIGHT_HEADER) || - !contents.includes(LICENSE1) || - !contents.includes(LICENSE2)) - ); + return contents.trim().length > 0 && !contents.includes(COPYRIGHT_LICENSE); } function check() { From abb760a2614d29a39a6dd062288c847a5776f493 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Wed, 14 Aug 2019 10:33:25 +0200 Subject: [PATCH 29/34] feat: add sync way of requiring and transpiling module (#8808) --- .../jest-transform/src/ScriptTransformer.ts | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index aafff4c113fe..1f7506b7af0e 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -9,7 +9,7 @@ import crypto from 'crypto'; import path from 'path'; import vm from 'vm'; import {Config} from '@jest/types'; -import {createDirectory} from 'jest-util'; +import {createDirectory, isPromise} from 'jest-util'; import fs from 'graceful-fs'; import {transformSync as babelTransform} from '@babel/core'; // @ts-ignore: should just be `require.resolve`, but the tests mess that up @@ -51,6 +51,17 @@ const projectCaches: WeakMap< // To reset the cache for specific changesets (rather than package version). const CACHE_VERSION = '1'; +async function waitForPromiseWithCleanup( + promise: Promise, + cleanup: () => void, +) { + try { + await promise; + } finally { + cleanup(); + } +} + export default class ScriptTransformer { static EVAL_RESULT_VARIABLE: 'Object.'; private _cache: ProjectCache; @@ -435,10 +446,18 @@ export default class ScriptTransformer { return fileSource; } - async requireAndTranspileModule( + requireAndTranspileModule( + moduleName: string, + callback?: (module: ModuleType) => void, + ): ModuleType; + requireAndTranspileModule( + moduleName: string, + callback?: (module: ModuleType) => Promise, + ): Promise; + requireAndTranspileModule( moduleName: string, callback?: (module: ModuleType) => void | Promise, - ): Promise { + ): ModuleType | Promise { // Load the transformer to avoid a cycle where we need to load a // transformer in order to transform it in the require hooks this.preloadTransformer(moduleName); @@ -467,9 +486,19 @@ export default class ScriptTransformer { ); const module: ModuleType = require(moduleName); + if (!callback) { + revertHook(); + + return module; + } + try { - if (callback) { - await callback(module); + const cbResult = callback(module); + + if (isPromise(cbResult)) { + return waitForPromiseWithCleanup(cbResult, revertHook).then( + () => module, + ); } } finally { revertHook(); From d610c9a00f5b9ca608ff9a7fb1e0a2b21f5f9027 Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Wed, 14 Aug 2019 17:13:57 -0400 Subject: [PATCH 30/34] chore: Delete obsolete link and simplify structure in pretty-format README (#8824) --- CHANGELOG.md | 1 + packages/pretty-format/README.md | 17 ++++------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 462ef8d981c9..94723846dfd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ - `[*]` Check copyright and license as one joined substring ([#8815](https://github.com/facebook/jest/pull/8815)) - `[docs]` Fix WatchPlugins `jestHooks.shouldRunTestSuite` example that receives an object ([#8784](https://github.com/facebook/jest/pull/8784)) - `[*]` Enforce LF line endings ([#8809](https://github.com/facebook/jest/pull/8809)) +- `[pretty-format]` Delete obsolete link and simplify structure in README ([#8824](https://github.com/facebook/jest/pull/8824)) ### Performance diff --git a/packages/pretty-format/README.md b/packages/pretty-format/README.md index dc7ad51fa156..4d0ce3acb2c9 100755 --- a/packages/pretty-format/README.md +++ b/packages/pretty-format/README.md @@ -1,18 +1,9 @@ # pretty-format -> Stringify any JavaScript value. - -- Supports all built-in JavaScript types - - primitive types: `Boolean`, `null`, `Number`, `String`, `Symbol`, `undefined` - - other non-collection types: `Date`, `Error`, `Function`, `RegExp` - - collection types: - - `arguments`, `Array`, `ArrayBuffer`, `DataView`, `Float32Array`, `Float64Array`, `Int8Array`, `Int16Array`, `Int32Array`, `Uint8Array`, `Uint8ClampedArray`, `Uint16Array`, `Uint32Array`, - - `Map`, `Set`, `WeakMap`, `WeakSet` - - `Object` -- [Blazingly fast](https://gist.github.com/thejameskyle/2b04ffe4941aafa8f970de077843a8fd) - - similar performance to `JSON.stringify` in v8 - - significantly faster than `util.format` in Node.js -- Serialize application-specific data types with built-in or user-defined plugins +Stringify any JavaScript value. + +- Serialize built-in JavaScript types. +- Serialize application-specific data types with built-in or user-defined plugins. ## Installation From 3ab2fc1b0ae3542bb8cdc927bf5459ba16a6420c Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 15 Aug 2019 12:38:46 +0530 Subject: [PATCH 31/34] chore: export types from jest-runner (#8825) --- CHANGELOG.md | 1 + packages/jest-runner/src/index.ts | 51 ++++++++++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94723846dfd4..5a7c2c569001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - `[@jest-transform]` Extract transforming require logic within `jest-core` into `@jest-transform` ([#8756](https://github.com/facebook/jest/pull/8756)) - `[jest-matcher-utils]` Add color options to `matcherHint` ([#8795](https://github.com/facebook/jest/pull/8795)) - `[jest-circus/jest-jasmine2]` Give clearer output for Node assert errors ([#8792](https://github.com/facebook/jest/pull/8792)) +- `[jest-runner]` Export all types in the type signature of `jest-runner` ([#8825](https://github.com/facebook/jest/pull/8825))` ### Fixes diff --git a/packages/jest-runner/src/index.ts b/packages/jest-runner/src/index.ts index 7cfdbc1fc7c7..c64e658bae98 100644 --- a/packages/jest-runner/src/index.ts +++ b/packages/jest-runner/src/index.ts @@ -13,13 +13,13 @@ import Worker from 'jest-worker'; import runTest from './runTest'; import {worker, SerializableResolver} from './testWorker'; import { - OnTestFailure, - OnTestStart, - OnTestSuccess, + OnTestFailure as JestOnTestFailure, + OnTestStart as JestOnTestStart, + OnTestSuccess as JestOnTestSuccess, Test as JestTest, - TestRunnerContext, - TestRunnerOptions, - TestWatcher, + TestRunnerContext as JestTestRunnerContext, + TestRunnerOptions as JestTestRunnerOptions, + TestWatcher as JestTestWatcher, WatcherState, } from './types'; @@ -31,25 +31,34 @@ interface WorkerInterface extends Worker { namespace TestRunner { export type Test = JestTest; + export type OnTestFailure = JestOnTestFailure; + export type OnTestStart = JestOnTestStart; + export type OnTestSuccess = JestOnTestSuccess; + export type TestWatcher = JestTestWatcher; + export type TestRunnerContext = JestTestRunnerContext; + export type TestRunnerOptions = JestTestRunnerOptions; } /* eslint-disable-next-line no-redeclare */ class TestRunner { private _globalConfig: Config.GlobalConfig; - private _context: TestRunnerContext; + private _context: JestTestRunnerContext; - constructor(globalConfig: Config.GlobalConfig, context?: TestRunnerContext) { + constructor( + globalConfig: Config.GlobalConfig, + context?: JestTestRunnerContext, + ) { this._globalConfig = globalConfig; this._context = context || {}; } async runTests( tests: Array, - watcher: TestWatcher, - onStart: OnTestStart, - onResult: OnTestSuccess, - onFailure: OnTestFailure, - options: TestRunnerOptions, + watcher: JestTestWatcher, + onStart: JestOnTestStart, + onResult: JestOnTestSuccess, + onFailure: JestOnTestFailure, + options: JestTestRunnerOptions, ): Promise { return await (options.serial ? this._createInBandTestRun(tests, watcher, onStart, onResult, onFailure) @@ -64,10 +73,10 @@ class TestRunner { private async _createInBandTestRun( tests: Array, - watcher: TestWatcher, - onStart: OnTestStart, - onResult: OnTestSuccess, - onFailure: OnTestFailure, + watcher: JestTestWatcher, + onStart: JestOnTestStart, + onResult: JestOnTestSuccess, + onFailure: JestOnTestFailure, ) { process.env.JEST_WORKER_ID = '1'; const mutex = throat(1); @@ -98,10 +107,10 @@ class TestRunner { private async _createParallelTestRun( tests: Array, - watcher: TestWatcher, - onStart: OnTestStart, - onResult: OnTestSuccess, - onFailure: OnTestFailure, + watcher: JestTestWatcher, + onStart: JestOnTestStart, + onResult: JestOnTestSuccess, + onFailure: JestOnTestFailure, ) { const resolvers: Map = new Map(); for (const test of tests) { From 4df00708c4b522dcb759a6d5723a11ee9580f081 Mon Sep 17 00:00:00 2001 From: Jack Kinsella Date: Thu, 15 Aug 2019 12:25:26 +0200 Subject: [PATCH 32/34] Add timeout to prevent notifier from locking CPU on MacOS (#8831) --- CHANGELOG.md | 1 + packages/jest-reporters/package.json | 2 +- .../jest-reporters/src/notify_reporter.ts | 1 + yarn.lock | 58 ++++++------------- 4 files changed, 21 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a7c2c569001..9e707b90b69d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ ### Performance - `[jest-watcher]` Minor optimization for JestHook ([#8746](https://github.com/facebook/jest/pull/8746) +- `[@jest/reporters]` Prevent runaway CPU useage with `--notify` on macOS ([#8830](https://github.com/facebook/jest/issues/8830)) ## 24.8.0 diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index 6ab2ddd048dc..f078862af7f6 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -22,7 +22,7 @@ "jest-runtime": "^24.8.0", "jest-util": "^24.8.0", "jest-worker": "^24.6.0", - "node-notifier": "^5.2.1", + "node-notifier": "^5.4.2", "slash": "^2.0.0", "source-map": "^0.6.0", "string-length": "^2.0.0" diff --git a/packages/jest-reporters/src/notify_reporter.ts b/packages/jest-reporters/src/notify_reporter.ts index 13659ddda373..1cbc4f362f65 100644 --- a/packages/jest-reporters/src/notify_reporter.ts +++ b/packages/jest-reporters/src/notify_reporter.ts @@ -118,6 +118,7 @@ export default class NotifyReporter extends BaseReporter { closeLabel: 'Close', icon, message, + timeout: 10, title, }, (err, _, metadata) => { diff --git a/yarn.lock b/yarn.lock index e074adce1da1..a8ec8423f9f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4033,12 +4033,7 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000984: - version "1.0.30000984" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000984.tgz#dc96c3c469e9bcfc6ad5bdd24c77ec918ea76fe0" - integrity sha512-n5tKOjMaZ1fksIpQbjERuqCyfgec/m9pferkFQbLmWtqLUdmt12hNhjSwsmPdqeiG2NkITOQhr1VYIwWSAceiA== - -caniuse-lite@^1.0.30000955: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000955, caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000984: version "1.0.30000985" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000985.tgz#0eb40f6c8a8c219155cbe43c4975c0efb4a0f77f" integrity sha512-1ngiwkgqAYPG0JSSUp3PUDGPKKY59EK7NrGGX+VOxaKCNzRbNc7uXMny+c3VJfZxtoK3wSImTvG9T9sXiTw2+w== @@ -5558,16 +5553,11 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -electron-to-chromium@^1.3.122: +electron-to-chromium@^1.3.122, electron-to-chromium@^1.3.191: version "1.3.200" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.200.tgz#78fb858b466269e8eb46d31a52562f00c865127f" integrity sha512-PUurrpyDA74MuAjJRD+79ss5BqJlU3mdArRbuu4wO/dt6jc3Ic/6BDmFJxkdwbfq39cHf/XKm2vW98XSvut9Dg== -electron-to-chromium@^1.3.191: - version "1.3.191" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.191.tgz#c451b422cd8b2eab84dedabab5abcae1eaefb6f0" - integrity sha512-jasjtY5RUy/TOyiUYM2fb4BDaPZfm6CXRFeJDMfFsXYADGxUN49RBqtgB7EL2RmJXeIRUk9lM1U6A5yk2YJMPQ== - elliptic@^6.0.0: version "6.5.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.0.tgz#2b8ed4c891b7de3200e14412a5b8248c7af505ca" @@ -8253,6 +8243,11 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= +is-wsl@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.1.0.tgz#94369bbeb2249ef07b831b1b08590e686330ccbb" + integrity sha512-pFTjpv/x5HRj8kbZ/Msxi9VrvtOMRBqaDi3OIcbwPI3OuH+r3lLxVWukLITBaOGJIbA/w2+M1eVmVa4XNQlAmQ== + is2@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is2/-/is2-2.0.1.tgz#8ac355644840921ce435d94f05d3a94634d3481a" @@ -9032,12 +9027,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1, lodash@~4.17.10: - version "4.17.14" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" - integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== - -lodash@^4.17.13: +lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1, lodash@~4.17.10: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -10015,16 +10005,16 @@ node-modules-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^5.2.1: - version "5.4.0" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.0.tgz#7b455fdce9f7de0c63538297354f3db468426e6a" - integrity sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ== +node-notifier@^5.2.1, node-notifier@^5.4.2: + version "5.4.2" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.2.tgz#a1111b8c1a4c3eb68d98815cc04a899456b03f1a" + integrity sha512-85nkTziazE2dR4pyoLxMwz0b9MmxFQPVXYs/WlWI7CPtBkARJOV+89khdNjpbclXIJDECQYnTvh1xuZV3WHkCA== dependencies: growly "^1.3.0" - is-wsl "^1.1.0" - semver "^5.5.0" + is-wsl "^2.1.0" + semver "^6.3.0" shellwords "^0.1.1" - which "^1.3.0" + which "^1.3.1" node-pre-gyp@^0.12.0: version "0.12.0" @@ -10042,20 +10032,13 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.13: +node-releases@^1.1.13, node-releases@^1.1.25: version "1.1.26" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.26.tgz#f30563edc5c7dc20cf524cc8652ffa7be0762937" integrity sha512-fZPsuhhUHMTlfkhDLGtfY80DSJTjOcx+qD1j5pqPkuhUHVS7xHZIg9EE4DHK8O3f0zTxXHX5VIkDG8pu98/wfQ== dependencies: semver "^5.3.0" -node-releases@^1.1.25: - version "1.1.25" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.25.tgz#0c2d7dbc7fed30fbe02a9ee3007b8c90bf0133d3" - integrity sha512-fI5BXuk83lKEoZDdH3gRhtsNgh05/wZacuXkgbiYkceE7+QIMXOg98n9ZV7mz27B+kFHnqHcUpscZZlGRSmTpQ== - dependencies: - semver "^5.3.0" - "nopt@2 || 3": version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" @@ -12476,12 +12459,7 @@ semver@5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== -semver@^6.0.0, semver@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" - integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== - -semver@^6.1.1: +semver@^6.0.0, semver@^6.1.1, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -14200,7 +14178,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@1.3.1, which@^1.2.1, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@1.3.1, which@^1.2.1, which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== From 9ad0f4bc6b8bdd94989804226c28c9960d9da7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brz=C3=B3ska?= Date: Fri, 16 Aug 2019 07:44:27 +0200 Subject: [PATCH 33/34] Workaround a node >=12.5.0 bug that causes the process not to exit after tests have completed and cancerous memory growth (#8787) --- CHANGELOG.md | 1 + packages/jest-haste-map/src/index.ts | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e707b90b69d..470c7ddb9862 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - `[jest-snapshots]` Fix test retries that contain snapshots ([#8629](https://github.com/facebook/jest/pull/8629)) - `[jest-mock]` Fix incorrect assignments when restoring mocks in instances where they originally didn't exist ([#8631](https://github.com/facebook/jest/pull/8631)) - `[expect]` Fix stack overflow when matching objects with circular references ([#8687](https://github.com/facebook/jest/pull/8687)) +- `[jest-haste-map]` Workaround a node >=12.5.0 bug that causes the process not to exit after tests have completed and cancerous memory growth ([#8787](https://github.com/facebook/jest/pull/8787)) ### Chore & Maintenance diff --git a/packages/jest-haste-map/src/index.ts b/packages/jest-haste-map/src/index.ts index 70965909d79d..4a14bebc2eee 100644 --- a/packages/jest-haste-map/src/index.ts +++ b/packages/jest-haste-map/src/index.ts @@ -642,7 +642,7 @@ class HasteMap extends EventEmitter { .then(workerReply, workerError); } - private async _buildHasteMap(data: { + private _buildHasteMap(data: { removedFiles: FileData; changedFiles?: FileData; hasteMap: InternalHasteMap; @@ -687,16 +687,18 @@ class HasteMap extends EventEmitter { } } - try { - await Promise.all(promises); - this._cleanup(); - hasteMap.map = map; - hasteMap.mocks = mocks; - return hasteMap; - } catch (error) { - this._cleanup(); - throw error; - } + return Promise.all(promises).then( + () => { + this._cleanup(); + hasteMap.map = map; + hasteMap.mocks = mocks; + return hasteMap; + }, + error => { + this._cleanup(); + throw error; + }, + ); } private _cleanup() { From 3cdbd556948b4974b2cc23178977eb159d343df8 Mon Sep 17 00:00:00 2001 From: Scott Hovestadt Date: Thu, 15 Aug 2019 23:31:44 -0700 Subject: [PATCH 34/34] Release 24.9.0 --- CHANGELOG.md | 12 +++++- lerna.json | 2 +- packages/babel-jest/package.json | 10 ++--- packages/babel-plugin-jest-hoist/package.json | 4 +- packages/babel-preset-jest/package.json | 6 +-- packages/diff-sequences/package.json | 4 +- packages/eslint-config-fb-strict/package.json | 4 +- packages/expect/package.json | 14 +++---- packages/jest-changed-files/package.json | 6 +-- packages/jest-circus/package.json | 26 ++++++------- packages/jest-cli/package.json | 16 ++++---- packages/jest-config/package.json | 26 ++++++------- packages/jest-console/package.json | 6 +-- packages/jest-core/package.json | 38 +++++++++---------- packages/jest-diff/package.json | 10 ++--- packages/jest-docblock/package.json | 4 +- packages/jest-each/package.json | 12 +++--- packages/jest-environment-jsdom/package.json | 14 +++---- packages/jest-environment-node/package.json | 14 +++---- packages/jest-environment/package.json | 12 +++--- packages/jest-fake-timers/package.json | 10 ++--- packages/jest-get-type/package.json | 4 +- packages/jest-haste-map/package.json | 12 +++--- packages/jest-jasmine2/package.json | 26 ++++++------- packages/jest-leak-detector/package.json | 8 ++-- packages/jest-matcher-utils/package.json | 10 ++--- packages/jest-message-util/package.json | 8 ++-- packages/jest-mock/package.json | 6 +-- packages/jest-phabricator/package.json | 6 +-- packages/jest-regex-util/package.json | 4 +- packages/jest-repl/package.json | 14 +++---- packages/jest-reporters/package.json | 20 +++++----- .../jest-resolve-dependencies/package.json | 14 +++---- packages/jest-resolve/package.json | 8 ++-- packages/jest-runner/package.json | 26 ++++++------- packages/jest-runtime/package.json | 28 +++++++------- packages/jest-serializer/package.json | 4 +- packages/jest-snapshot/package.json | 22 +++++------ packages/jest-source-map/package.json | 4 +- packages/jest-test-result/package.json | 8 ++-- packages/jest-test-sequencer/package.json | 12 +++--- packages/jest-transform/package.json | 12 +++--- packages/jest-types/package.json | 4 +- packages/jest-util/package.json | 14 +++---- packages/jest-validate/package.json | 10 ++--- packages/jest-watcher/package.json | 10 ++--- packages/jest-worker/package.json | 4 +- packages/jest/package.json | 6 +-- packages/pretty-format/package.json | 6 +-- 49 files changed, 285 insertions(+), 275 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 470c7ddb9862..5dd152ef8534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ### Features +### Fixes + +### Chore & Maintenance + +### Performance + +## 24.9.0 + +### Features + - `[expect]` Highlight substring differences when matcher fails, part 1 ([#8448](https://github.com/facebook/jest/pull/8448)) - `[expect]` Highlight substring differences when matcher fails, part 2 ([#8528](https://github.com/facebook/jest/pull/8528)) - `[expect]` Improve report when mock-spy matcher fails, part 1 ([#8640](https://github.com/facebook/jest/pull/8640)) @@ -39,7 +49,7 @@ - `[jest-snapshots]` Fix test retries that contain snapshots ([#8629](https://github.com/facebook/jest/pull/8629)) - `[jest-mock]` Fix incorrect assignments when restoring mocks in instances where they originally didn't exist ([#8631](https://github.com/facebook/jest/pull/8631)) - `[expect]` Fix stack overflow when matching objects with circular references ([#8687](https://github.com/facebook/jest/pull/8687)) -- `[jest-haste-map]` Workaround a node >=12.5.0 bug that causes the process not to exit after tests have completed and cancerous memory growth ([#8787](https://github.com/facebook/jest/pull/8787)) +- `[jest-haste-map]` Workaround a node >=12.5.0 bug that causes the process not to exit after tests have completed and cancerous memory growth ([#8787](https://github.com/facebook/jest/pull/8787)) ### Chore & Maintenance diff --git a/lerna.json b/lerna.json index 0e53903c291a..f5d97c1b1717 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "3.15.0", - "version": "24.8.0", + "version": "24.9.0", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index 16757f2240b8..95a195e78c81 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -1,7 +1,7 @@ { "name": "babel-jest", "description": "Jest plugin to use babel for transformation.", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,11 +11,11 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", "@types/babel__core": "^7.1.0", "babel-plugin-istanbul": "^5.1.0", - "babel-preset-jest": "^24.6.0", + "babel-preset-jest": "^24.9.0", "chalk": "^2.4.2", "slash": "^2.0.0" }, @@ -32,5 +32,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/babel-plugin-jest-hoist/package.json b/packages/babel-plugin-jest-hoist/package.json index 2995055ccc5b..741b642635f7 100644 --- a/packages/babel-plugin-jest-hoist/package.json +++ b/packages/babel-plugin-jest-hoist/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-jest-hoist", - "version": "24.6.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -21,5 +21,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "04e6a66d2ba8b18bee080bb28547db74a255d2c7" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/babel-preset-jest/package.json b/packages/babel-preset-jest/package.json index 3cab50f3b23f..f400d79539b7 100644 --- a/packages/babel-preset-jest/package.json +++ b/packages/babel-preset-jest/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-jest", - "version": "24.6.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,7 +10,7 @@ "main": "index.js", "dependencies": { "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "babel-plugin-jest-hoist": "^24.6.0" + "babel-plugin-jest-hoist": "^24.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0" @@ -21,5 +21,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "04e6a66d2ba8b18bee080bb28547db74a255d2c7" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/diff-sequences/package.json b/packages/diff-sequences/package.json index 7971c5046bda..21c5100b9a9f 100644 --- a/packages/diff-sequences/package.json +++ b/packages/diff-sequences/package.json @@ -1,6 +1,6 @@ { "name": "diff-sequences", - "version": "24.3.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -30,5 +30,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "3a7a4f3a3f5489ac8e07dcddf76bb949c482ec87" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/eslint-config-fb-strict/package.json b/packages/eslint-config-fb-strict/package.json index 923eac03cc5d..58f399a3669f 100644 --- a/packages/eslint-config-fb-strict/package.json +++ b/packages/eslint-config-fb-strict/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-fb-strict", - "version": "24.3.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -25,5 +25,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "3a7a4f3a3f5489ac8e07dcddf76bb949c482ec87" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/expect/package.json b/packages/expect/package.json index 28d5f670f282..8bd12ae7bd10 100644 --- a/packages/expect/package.json +++ b/packages/expect/package.json @@ -1,6 +1,6 @@ { "name": "expect", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,12 +11,12 @@ "types": "build/index.d.ts", "browser": "build-es5/index.js", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "ansi-styles": "^3.2.0", - "jest-get-type": "^24.8.0", - "jest-matcher-utils": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-regex-util": "^24.3.0" + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-regex-util": "^24.9.0" }, "devDependencies": { "@types/ansi-styles": "^3.2.1", @@ -28,5 +28,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-changed-files/package.json b/packages/jest-changed-files/package.json index 70bda8ac7a05..85fc45622bf1 100644 --- a/packages/jest-changed-files/package.json +++ b/packages/jest-changed-files/package.json @@ -1,6 +1,6 @@ { "name": "jest-changed-files", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,7 +10,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "execa": "^1.0.0", "throat": "^4.0.0" }, @@ -23,5 +23,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index e639199d1022..46062bc2bebe 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -1,6 +1,6 @@ { "name": "jest-circus", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,19 +11,19 @@ "types": "build/index.d.ts", "dependencies": { "@babel/traverse": "^7.1.0", - "@jest/environment": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", "co": "^4.6.0", - "expect": "^24.8.0", + "expect": "^24.9.0", "is-generator-fn": "^2.0.0", - "jest-each": "^24.8.0", - "jest-matcher-utils": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-snapshot": "^24.8.0", - "jest-util": "^24.8.0", - "pretty-format": "^24.8.0", + "jest-each": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0", "stack-utils": "^1.0.1", "throat": "^4.0.0" }, @@ -33,7 +33,7 @@ "@types/co": "^4.6.0", "@types/stack-utils": "^1.0.1", "execa": "^1.0.0", - "jest-runtime": "^24.8.0" + "jest-runtime": "^24.9.0" }, "engines": { "node": ">= 6" @@ -41,5 +41,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index b6034609d9f3..a42514728e5b 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -1,20 +1,20 @@ { "name": "jest-cli", "description": "Delightful JavaScript Testing.", - "version": "24.8.0", + "version": "24.9.0", "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/core": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/core": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", "exit": "^0.1.2", "import-local": "^2.0.0", "is-ci": "^2.0.0", - "jest-config": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", + "jest-config": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", "prompts": "^2.0.1", "realpath-native": "^1.1.0", "yargs": "^13.3.0" @@ -70,5 +70,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index ea49fd7dac0c..10f51322cd8c 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -1,6 +1,6 @@ { "name": "jest-config", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,21 +11,21 @@ "types": "build/index.d.ts", "dependencies": { "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^24.8.0", - "@jest/types": "^24.8.0", - "babel-jest": "^24.8.0", + "@jest/test-sequencer": "^24.9.0", + "@jest/types": "^24.9.0", + "babel-jest": "^24.9.0", "chalk": "^2.0.1", "glob": "^7.1.1", - "jest-environment-jsdom": "^24.8.0", - "jest-environment-node": "^24.8.0", - "jest-get-type": "^24.8.0", - "jest-jasmine2": "^24.8.0", + "jest-environment-jsdom": "^24.9.0", + "jest-environment-node": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-jasmine2": "^24.9.0", "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", + "jest-resolve": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", "micromatch": "^3.1.10", - "pretty-format": "^24.8.0", + "pretty-format": "^24.9.0", "realpath-native": "^1.1.0" }, "devDependencies": { @@ -39,5 +39,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index 8e7c75767e68..7e7277e86fc5 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -1,6 +1,6 @@ { "name": "@jest/console", - "version": "24.7.1", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,7 +10,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/source-map": "^24.3.0", + "@jest/source-map": "^24.9.0", "chalk": "^2.0.1", "slash": "^2.0.0" }, @@ -23,5 +23,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "0efb1d7809cb96ae87a7601e7802f1dab3774280" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 89a8a31d4177..8e118be75aa5 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -1,32 +1,32 @@ { "name": "@jest/core", "description": "Delightful JavaScript Testing.", - "version": "24.8.0", + "version": "24.9.0", "main": "build/jest.js", "types": "build/jest.d.ts", "dependencies": { "@jest/console": "^24.7.1", - "@jest/reporters": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/reporters": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", "ansi-escapes": "^3.0.0", "chalk": "^2.0.1", "exit": "^0.1.2", "graceful-fs": "^4.1.15", - "jest-changed-files": "^24.8.0", - "jest-config": "^24.8.0", - "jest-haste-map": "^24.8.0", - "jest-message-util": "^24.8.0", + "jest-changed-files": "^24.9.0", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.8.0", - "jest-resolve-dependencies": "^24.8.0", - "jest-runner": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-snapshot": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", - "jest-watcher": "^24.8.0", + "jest-resolve": "^24.9.0", + "jest-resolve-dependencies": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", + "jest-watcher": "^24.9.0", "micromatch": "^3.1.10", "p-each-series": "^1.0.0", "realpath-native": "^1.1.0", @@ -35,7 +35,7 @@ "strip-ansi": "^5.0.0" }, "devDependencies": { - "@jest/test-sequencer": "^24.8.0", + "@jest/test-sequencer": "^24.9.0", "@types/ansi-escapes": "^3.0.1", "@types/exit": "^0.1.30", "@types/graceful-fs": "^4.1.2", @@ -87,5 +87,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-diff/package.json b/packages/jest-diff/package.json index a45aa97b5a2f..f3dad2de2c52 100644 --- a/packages/jest-diff/package.json +++ b/packages/jest-diff/package.json @@ -1,6 +1,6 @@ { "name": "jest-diff", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,9 +11,9 @@ "types": "build/index.d.ts", "dependencies": { "chalk": "^2.0.1", - "diff-sequences": "^24.3.0", - "jest-get-type": "^24.8.0", - "pretty-format": "^24.8.0" + "diff-sequences": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" }, "devDependencies": { "@types/strip-ansi": "^3.0.0", @@ -25,5 +25,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-docblock/package.json b/packages/jest-docblock/package.json index 2490784a9d6a..09384731cd0f 100644 --- a/packages/jest-docblock/package.json +++ b/packages/jest-docblock/package.json @@ -1,6 +1,6 @@ { "name": "jest-docblock", - "version": "24.3.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -20,5 +20,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "3a7a4f3a3f5489ac8e07dcddf76bb949c482ec87" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-each/package.json b/packages/jest-each/package.json index 0ff3d4ad4178..ad803fda3eed 100644 --- a/packages/jest-each/package.json +++ b/packages/jest-each/package.json @@ -1,6 +1,6 @@ { "name": "jest-each", - "version": "24.8.0", + "version": "24.9.0", "description": "Parameterised tests for Jest", "main": "build/index.js", "types": "build/index.d.ts", @@ -18,11 +18,11 @@ "author": "Matt Phillips (mattphillips)", "license": "MIT", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", - "jest-get-type": "^24.8.0", - "jest-util": "^24.8.0", - "pretty-format": "^24.8.0" + "jest-get-type": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0" }, "engines": { "node": ">= 6" @@ -30,5 +30,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-environment-jsdom/package.json b/packages/jest-environment-jsdom/package.json index ac555014a5e8..b0bf311c1e83 100644 --- a/packages/jest-environment-jsdom/package.json +++ b/packages/jest-environment-jsdom/package.json @@ -1,6 +1,6 @@ { "name": "jest-environment-jsdom", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,11 +10,11 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/environment": "^24.8.0", - "@jest/fake-timers": "^24.8.0", - "@jest/types": "^24.8.0", - "jest-mock": "^24.8.0", - "jest-util": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0", "jsdom": "^11.5.1" }, "devDependencies": { @@ -26,5 +26,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-environment-node/package.json b/packages/jest-environment-node/package.json index 9fbbd3fc1232..0ab1a69ad6c7 100644 --- a/packages/jest-environment-node/package.json +++ b/packages/jest-environment-node/package.json @@ -1,6 +1,6 @@ { "name": "jest-environment-node", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,11 +10,11 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/environment": "^24.8.0", - "@jest/fake-timers": "^24.8.0", - "@jest/types": "^24.8.0", - "jest-mock": "^24.8.0", - "jest-util": "^24.8.0" + "@jest/environment": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0", + "jest-util": "^24.9.0" }, "engines": { "node": ">= 6" @@ -22,5 +22,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-environment/package.json b/packages/jest-environment/package.json index f1f606f78d57..b4a1e18d1e01 100644 --- a/packages/jest-environment/package.json +++ b/packages/jest-environment/package.json @@ -1,6 +1,6 @@ { "name": "@jest/environment", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,10 +10,10 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/fake-timers": "^24.8.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", - "jest-mock": "^24.8.0" + "@jest/fake-timers": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-mock": "^24.9.0" }, "engines": { "node": ">= 6" @@ -21,5 +21,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-fake-timers/package.json b/packages/jest-fake-timers/package.json index eb389a13f4ac..5f827aeba0b4 100644 --- a/packages/jest-fake-timers/package.json +++ b/packages/jest-fake-timers/package.json @@ -1,6 +1,6 @@ { "name": "@jest/fake-timers", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,9 +10,9 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/types": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-mock": "^24.8.0" + "@jest/types": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0" }, "engines": { "node": ">= 6" @@ -20,5 +20,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-get-type/package.json b/packages/jest-get-type/package.json index b9fff7b69d74..12bd091506c9 100644 --- a/packages/jest-get-type/package.json +++ b/packages/jest-get-type/package.json @@ -1,7 +1,7 @@ { "name": "jest-get-type", "description": "A utility function to get the type of a value", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -16,5 +16,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-haste-map/package.json b/packages/jest-haste-map/package.json index 4cd34891f540..26189086efc9 100644 --- a/packages/jest-haste-map/package.json +++ b/packages/jest-haste-map/package.json @@ -1,6 +1,6 @@ { "name": "jest-haste-map", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,14 +10,14 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "anymatch": "^2.0.0", "fb-watchman": "^2.0.0", "graceful-fs": "^4.1.15", "invariant": "^2.2.4", - "jest-serializer": "^24.4.0", - "jest-util": "^24.8.0", - "jest-worker": "^24.6.0", + "jest-serializer": "^24.9.0", + "jest-util": "^24.9.0", + "jest-worker": "^24.9.0", "micromatch": "^3.1.10", "sane": "^4.0.3", "walker": "^1.0.7" @@ -40,5 +40,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-jasmine2/package.json b/packages/jest-jasmine2/package.json index e7aeae88e9b0..06fc2dc035a7 100644 --- a/packages/jest-jasmine2/package.json +++ b/packages/jest-jasmine2/package.json @@ -1,6 +1,6 @@ { "name": "jest-jasmine2", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,20 +11,20 @@ "types": "build/index.d.ts", "dependencies": { "@babel/traverse": "^7.1.0", - "@jest/environment": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", "co": "^4.6.0", - "expect": "^24.8.0", + "expect": "^24.9.0", "is-generator-fn": "^2.0.0", - "jest-each": "^24.8.0", - "jest-matcher-utils": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-snapshot": "^24.8.0", - "jest-util": "^24.8.0", - "pretty-format": "^24.8.0", + "jest-each": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "pretty-format": "^24.9.0", "throat": "^4.0.0" }, "devDependencies": { @@ -36,5 +36,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-leak-detector/package.json b/packages/jest-leak-detector/package.json index e574057a8259..ad76f2c09fe5 100644 --- a/packages/jest-leak-detector/package.json +++ b/packages/jest-leak-detector/package.json @@ -1,6 +1,6 @@ { "name": "jest-leak-detector", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,8 +10,8 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "jest-get-type": "^24.8.0", - "pretty-format": "^24.8.0" + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" }, "devDependencies": { "@types/weak": "^1.0.0", @@ -23,5 +23,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-matcher-utils/package.json b/packages/jest-matcher-utils/package.json index 59e468f4632d..fe7f83c4a029 100644 --- a/packages/jest-matcher-utils/package.json +++ b/packages/jest-matcher-utils/package.json @@ -1,7 +1,7 @@ { "name": "jest-matcher-utils", "description": "A set of utility functions for expect and related packages", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -14,12 +14,12 @@ "main": "build/index.js", "dependencies": { "chalk": "^2.0.1", - "jest-diff": "^24.8.0", - "jest-get-type": "^24.8.0", - "pretty-format": "^24.8.0" + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "pretty-format": "^24.9.0" }, "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-message-util/package.json b/packages/jest-message-util/package.json index 425769551041..0d75a015624d 100644 --- a/packages/jest-message-util/package.json +++ b/packages/jest-message-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-message-util", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -14,8 +14,8 @@ "types": "build/index.d.ts", "dependencies": { "@babel/code-frame": "^7.0.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "@types/stack-utils": "^1.0.1", "chalk": "^2.0.1", "micromatch": "^3.1.10", @@ -30,5 +30,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-mock/package.json b/packages/jest-mock/package.json index f58092eaa714..5932c3599369 100644 --- a/packages/jest-mock/package.json +++ b/packages/jest-mock/package.json @@ -1,6 +1,6 @@ { "name": "jest-mock", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,7 +10,7 @@ "node": ">= 6" }, "dependencies": { - "@jest/types": "^24.8.0" + "@jest/types": "^24.9.0" }, "license": "MIT", "main": "build/index.js", @@ -19,5 +19,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-phabricator/package.json b/packages/jest-phabricator/package.json index 21561d2f173f..1214793061ed 100644 --- a/packages/jest-phabricator/package.json +++ b/packages/jest-phabricator/package.json @@ -1,6 +1,6 @@ { "name": "jest-phabricator", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -8,7 +8,7 @@ }, "types": "build/index.d.ts", "dependencies": { - "@jest/test-result": "^24.8.0" + "@jest/test-result": "^24.9.0" }, "engines": { "node": ">= 6" @@ -18,5 +18,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-regex-util/package.json b/packages/jest-regex-util/package.json index 3443f411c986..af0c74a57fc8 100644 --- a/packages/jest-regex-util/package.json +++ b/packages/jest-regex-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-regex-util", - "version": "24.3.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -15,5 +15,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "3a7a4f3a3f5489ac8e07dcddf76bb949c482ec87" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-repl/package.json b/packages/jest-repl/package.json index 508d9b79b0b4..fe1e13a4ccc9 100644 --- a/packages/jest-repl/package.json +++ b/packages/jest-repl/package.json @@ -1,6 +1,6 @@ { "name": "jest-repl", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,11 +10,11 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", - "jest-config": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-validate": "^24.8.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", + "jest-config": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-validate": "^24.9.0", "repl": "^0.1.3", "yargs": "^13.3.0" }, @@ -30,5 +30,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index f078862af7f6..8ef269ff7726 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -1,14 +1,14 @@ { "name": "@jest/reporters", "description": "Jest's reporters", - "version": "24.8.0", + "version": "24.9.0", "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/environment": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", "exit": "^0.1.2", "glob": "^7.1.2", @@ -17,10 +17,10 @@ "istanbul-lib-report": "^2.0.4", "istanbul-lib-source-maps": "^3.0.1", "istanbul-reports": "^2.2.6", - "jest-haste-map": "^24.8.0", - "jest-resolve": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-util": "^24.8.0", + "jest-haste-map": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", "jest-worker": "^24.6.0", "node-notifier": "^5.4.2", "slash": "^2.0.0", @@ -56,5 +56,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-resolve-dependencies/package.json b/packages/jest-resolve-dependencies/package.json index bdf51c5b263c..ffcdbe25aa35 100644 --- a/packages/jest-resolve-dependencies/package.json +++ b/packages/jest-resolve-dependencies/package.json @@ -1,6 +1,6 @@ { "name": "jest-resolve-dependencies", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,14 +10,14 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "jest-regex-util": "^24.3.0", - "jest-snapshot": "^24.8.0" + "jest-snapshot": "^24.9.0" }, "devDependencies": { - "jest-haste-map": "^24.8.0", - "jest-resolve": "^24.8.0", - "jest-runtime": "^24.8.0" + "jest-haste-map": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0" }, "engines": { "node": ">= 6" @@ -25,5 +25,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index 63dd2bb618ee..8deef2789497 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -1,6 +1,6 @@ { "name": "jest-resolve", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,7 +10,7 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "browser-resolve": "^1.11.3", "chalk": "^2.0.1", "jest-pnp-resolver": "^1.2.1", @@ -18,7 +18,7 @@ }, "devDependencies": { "@types/browser-resolve": "^0.0.5", - "jest-haste-map": "^24.8.0" + "jest-haste-map": "^24.9.0" }, "engines": { "node": ">= 6" @@ -26,5 +26,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index faf802db3bc1..42a56cebecdf 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -1,6 +1,6 @@ { "name": "jest-runner", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,21 +11,21 @@ "types": "build/index.d.ts", "dependencies": { "@jest/console": "^24.7.1", - "@jest/environment": "^24.8.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/environment": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "chalk": "^2.4.2", "exit": "^0.1.2", "graceful-fs": "^4.1.15", - "jest-config": "^24.8.0", + "jest-config": "^24.9.0", "jest-docblock": "^24.3.0", - "jest-haste-map": "^24.8.0", - "jest-jasmine2": "^24.8.0", - "jest-leak-detector": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-resolve": "^24.8.0", - "jest-runtime": "^24.8.0", - "jest-util": "^24.8.0", + "jest-haste-map": "^24.9.0", + "jest-jasmine2": "^24.9.0", + "jest-leak-detector": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", + "jest-runtime": "^24.9.0", + "jest-util": "^24.9.0", "jest-worker": "^24.6.0", "source-map-support": "^0.5.6", "throat": "^4.0.0" @@ -41,5 +41,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 78d682499e0d..1d21f281ff99 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -1,6 +1,6 @@ { "name": "jest-runtime", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,24 +11,24 @@ "types": "build/index.d.ts", "dependencies": { "@jest/console": "^24.7.1", - "@jest/environment": "^24.8.0", + "@jest/environment": "^24.9.0", "@jest/source-map": "^24.3.0", - "@jest/transform": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/transform": "^24.9.0", + "@jest/types": "^24.9.0", "@types/yargs": "^13.0.0", "chalk": "^2.0.1", "exit": "^0.1.2", "glob": "^7.1.3", "graceful-fs": "^4.1.15", - "jest-config": "^24.8.0", - "jest-haste-map": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-mock": "^24.8.0", + "jest-config": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-mock": "^24.9.0", "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.8.0", - "jest-snapshot": "^24.8.0", - "jest-util": "^24.8.0", - "jest-validate": "^24.8.0", + "jest-resolve": "^24.9.0", + "jest-snapshot": "^24.9.0", + "jest-util": "^24.9.0", + "jest-validate": "^24.9.0", "realpath-native": "^1.1.0", "slash": "^2.0.0", "strip-bom": "^3.0.0", @@ -40,7 +40,7 @@ "@types/graceful-fs": "^4.1.2", "@types/slash": "^2.0.0", "@types/strip-bom": "^3.0.0", - "jest-environment-node": "^24.8.0" + "jest-environment-node": "^24.9.0" }, "bin": { "jest-runtime": "./bin/jest-runtime.js" @@ -51,5 +51,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index 0cf33883fe63..6052e3d734b8 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -1,6 +1,6 @@ { "name": "jest-serializer", - "version": "24.4.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -15,5 +15,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "a018000fc162db3cfd0ebf9f23fdb734f05821a6" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-snapshot/package.json b/packages/jest-snapshot/package.json index 15bf88fd0340..c4562420da55 100644 --- a/packages/jest-snapshot/package.json +++ b/packages/jest-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "jest-snapshot", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -11,17 +11,17 @@ "types": "build/index.d.ts", "dependencies": { "@babel/types": "^7.0.0", - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "chalk": "^2.0.1", - "expect": "^24.8.0", - "jest-diff": "^24.8.0", - "jest-get-type": "^24.8.0", - "jest-matcher-utils": "^24.8.0", - "jest-message-util": "^24.8.0", - "jest-resolve": "^24.8.0", + "expect": "^24.9.0", + "jest-diff": "^24.9.0", + "jest-get-type": "^24.9.0", + "jest-matcher-utils": "^24.9.0", + "jest-message-util": "^24.9.0", + "jest-resolve": "^24.9.0", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "pretty-format": "^24.8.0", + "pretty-format": "^24.9.0", "semver": "^6.2.0" }, "devDependencies": { @@ -30,7 +30,7 @@ "@types/natural-compare": "^1.4.0", "@types/prettier": "^1.16.1", "@types/semver": "^6.0.1", - "jest-haste-map": "^24.8.0", + "jest-haste-map": "^24.9.0", "prettier": "^1.13.4" }, "engines": { @@ -39,5 +39,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-source-map/package.json b/packages/jest-source-map/package.json index 9c9b66dfa6e1..aac97df1ff90 100644 --- a/packages/jest-source-map/package.json +++ b/packages/jest-source-map/package.json @@ -1,6 +1,6 @@ { "name": "@jest/source-map", - "version": "24.3.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -23,5 +23,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "3a7a4f3a3f5489ac8e07dcddf76bb949c482ec87" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-test-result/package.json b/packages/jest-test-result/package.json index 01b480e5f718..5ebc8c995bd3 100644 --- a/packages/jest-test-result/package.json +++ b/packages/jest-test-result/package.json @@ -1,6 +1,6 @@ { "name": "@jest/test-result", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,8 +10,8 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/console": "^24.7.1", - "@jest/types": "^24.8.0", + "@jest/console": "^24.9.0", + "@jest/types": "^24.9.0", "@types/istanbul-lib-coverage": "^2.0.0" }, "engines": { @@ -20,5 +20,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-test-sequencer/package.json b/packages/jest-test-sequencer/package.json index d36ae05ba870..13f494ce38e6 100644 --- a/packages/jest-test-sequencer/package.json +++ b/packages/jest-test-sequencer/package.json @@ -1,6 +1,6 @@ { "name": "@jest/test-sequencer", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,10 +10,10 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/test-result": "^24.8.0", - "jest-haste-map": "^24.8.0", - "jest-runner": "^24.8.0", - "jest-runtime": "^24.8.0" + "@jest/test-result": "^24.9.0", + "jest-haste-map": "^24.9.0", + "jest-runner": "^24.9.0", + "jest-runtime": "^24.9.0" }, "engines": { "node": ">= 6" @@ -21,5 +21,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index bf3b6f14792f..a356f905b7d2 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -1,6 +1,6 @@ { "name": "@jest/transform", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,15 +10,15 @@ "main": "build/index.js", "dependencies": { "@babel/core": "^7.1.0", - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "babel-plugin-istanbul": "^5.1.0", "chalk": "^2.0.1", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.1.15", - "jest-haste-map": "^24.8.0", - "jest-regex-util": "^24.3.0", - "jest-util": "^24.8.0", + "jest-haste-map": "^24.9.0", + "jest-regex-util": "^24.9.0", + "jest-util": "^24.9.0", "micromatch": "^3.1.10", "pirates": "^4.0.1", "realpath-native": "^1.1.0", @@ -40,5 +40,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index cee1b9ab82b0..defa60c76d00 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -1,6 +1,6 @@ { "name": "@jest/types", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -20,5 +20,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index 3e0dc5a30c1a..31ba81f34bce 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -1,6 +1,6 @@ { "name": "jest-util", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,11 +10,11 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/console": "^24.7.1", - "@jest/fake-timers": "^24.8.0", - "@jest/source-map": "^24.3.0", - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/console": "^24.9.0", + "@jest/fake-timers": "^24.9.0", + "@jest/source-map": "^24.9.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "callsites": "^3.0.0", "chalk": "^2.0.1", "graceful-fs": "^4.1.15", @@ -35,5 +35,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-validate/package.json b/packages/jest-validate/package.json index 394bb462f904..fa4e8beb77d8 100644 --- a/packages/jest-validate/package.json +++ b/packages/jest-validate/package.json @@ -1,6 +1,6 @@ { "name": "jest-validate", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -10,12 +10,12 @@ "main": "build/index.js", "types": "build/index.d.ts", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "camelcase": "^5.3.1", "chalk": "^2.0.1", - "jest-get-type": "^24.8.0", + "jest-get-type": "^24.9.0", "leven": "^3.1.0", - "pretty-format": "^24.8.0" + "pretty-format": "^24.9.0" }, "engines": { "node": ">= 6" @@ -23,5 +23,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-watcher/package.json b/packages/jest-watcher/package.json index c2e5a818f1ea..eaca9b11f669 100644 --- a/packages/jest-watcher/package.json +++ b/packages/jest-watcher/package.json @@ -1,15 +1,15 @@ { "name": "jest-watcher", "description": "Delightful JavaScript Testing.", - "version": "24.8.0", + "version": "24.9.0", "main": "build/index.js", "dependencies": { - "@jest/test-result": "^24.8.0", - "@jest/types": "^24.8.0", + "@jest/test-result": "^24.9.0", + "@jest/types": "^24.9.0", "@types/yargs": "^13.0.0", "ansi-escapes": "^3.0.0", "chalk": "^2.0.1", - "jest-util": "^24.8.0", + "jest-util": "^24.9.0", "string-length": "^2.0.0" }, "devDependencies": { @@ -32,5 +32,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest-worker/package.json b/packages/jest-worker/package.json index 5c621fa6030d..ae906f007069 100644 --- a/packages/jest-worker/package.json +++ b/packages/jest-worker/package.json @@ -1,6 +1,6 @@ { "name": "jest-worker", - "version": "24.6.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -25,5 +25,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "04e6a66d2ba8b18bee080bb28547db74a255d2c7" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/jest/package.json b/packages/jest/package.json index f8460e5ab986..e631d0f78f3c 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -1,12 +1,12 @@ { "name": "jest", "description": "Delightful JavaScript Testing.", - "version": "24.8.0", + "version": "24.9.0", "main": "build/jest.js", "types": "build/jest.d.ts", "dependencies": { "import-local": "^2.0.0", - "jest-cli": "^24.8.0" + "jest-cli": "^24.9.0" }, "bin": { "jest": "./bin/jest.js" @@ -49,5 +49,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" } diff --git a/packages/pretty-format/package.json b/packages/pretty-format/package.json index ab1bd7712abd..086bbcf013a4 100644 --- a/packages/pretty-format/package.json +++ b/packages/pretty-format/package.json @@ -1,6 +1,6 @@ { "name": "pretty-format", - "version": "24.8.0", + "version": "24.9.0", "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -13,7 +13,7 @@ "browser": "build-es5/index.js", "author": "James Kyle ", "dependencies": { - "@jest/types": "^24.8.0", + "@jest/types": "^24.9.0", "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0", "react-is": "^16.8.4" @@ -35,5 +35,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4" + "gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1" }