From 8c61b5feecd272b3d30dafa44b8c9a5997dc965e Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Mon, 19 Aug 2019 15:14:54 -0700 Subject: [PATCH 1/5] Upgrade ESLint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 563f672..e569805 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "common-tags": "^1.4.0", "core-js": "^3.1.4", "dlv": "^1.1.0", - "eslint": "^5.0.0", + "eslint": "^6.2.0", "indent-string": "^4.0.0", "lodash.merge": "^4.6.0", "loglevel-colored-level-prefix": "^1.0.0", From 0d6b33f167d82df0f82c781840b8cb09c59a8d52 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Mon, 19 Aug 2019 15:15:00 -0700 Subject: [PATCH 2/5] Adjust test --- src/__tests__/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/__tests__/index.js b/src/__tests__/index.js index 6cc26eb..5ead42a 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -351,10 +351,11 @@ test('resolves to the local eslint module', () => { test('reads text from fs if filePath is provided but not text', () => { const filePath = '/blah-blah/some-file.js'; format({ filePath }); - // format({filePath}).catch(() => {}) - // one hit to get the file and one for the eslintignore - expect(fsMock.readFileSync).toHaveBeenCalledTimes(2); + expect(fsMock.readFileSync).toHaveBeenCalledWith(filePath, 'utf8'); + + // TODO: Make sense of need to call 5 times (4 for ESLint) + expect(fsMock.readFileSync).toHaveBeenCalledTimes(5); }); test('logs error if it cannot read the file from the filePath', () => { From 13a45560b11bff4e7011177caca3ff50ecea380f Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Sat, 21 Sep 2019 18:36:25 -0700 Subject: [PATCH 3/5] Spy mock instead of re-implementing another mock --- src/__tests__/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/__tests__/index.js b/src/__tests__/index.js index 5ead42a..d41a051 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -349,13 +349,15 @@ test('resolves to the local eslint module', () => { }); test('reads text from fs if filePath is provided but not text', () => { + const readFileSyncMockSpy = jest.spyOn(fsMock, 'readFileSync'); + const filePath = '/blah-blah/some-file.js'; format({ filePath }); - expect(fsMock.readFileSync).toHaveBeenCalledWith(filePath, 'utf8'); + expect(readFileSyncMockSpy).toHaveBeenCalledWith(filePath, 'utf8'); - // TODO: Make sense of need to call 5 times (4 for ESLint) - expect(fsMock.readFileSync).toHaveBeenCalledTimes(5); + // one hit to get the file and one for the eslintignore + expect(readFileSyncMockSpy).toHaveBeenCalledTimes(2); }); test('logs error if it cannot read the file from the filePath', () => { From c1d70a64314a1dce07fe9e8912c7295d2b6e8b6a Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Mon, 23 Sep 2019 22:31:34 -0700 Subject: [PATCH 4/5] Remove call count assertion from test --- src/__tests__/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/__tests__/index.js b/src/__tests__/index.js index d41a051..43cd765 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -355,9 +355,6 @@ test('reads text from fs if filePath is provided but not text', () => { format({ filePath }); expect(readFileSyncMockSpy).toHaveBeenCalledWith(filePath, 'utf8'); - - // one hit to get the file and one for the eslintignore - expect(readFileSyncMockSpy).toHaveBeenCalledTimes(2); }); test('logs error if it cannot read the file from the filePath', () => { From acaa3b5f7dec2bd1968e5fe5632ba68b1a922dde Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Mon, 23 Sep 2019 23:36:00 -0700 Subject: [PATCH 5/5] Upgrade to eslint@6.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e569805..ed7c653 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "common-tags": "^1.4.0", "core-js": "^3.1.4", "dlv": "^1.1.0", - "eslint": "^6.2.0", + "eslint": "^6.4.0", "indent-string": "^4.0.0", "lodash.merge": "^4.6.0", "loglevel-colored-level-prefix": "^1.0.0",