From 4e7ac4f7a3083f44f5678fbe0dcc27270956d049 Mon Sep 17 00:00:00 2001 From: "Shahar \"Dawn\" Or" Date: Sat, 15 Jul 2023 13:48:17 +0700 Subject: [PATCH] build: rm redundant peerDep range test Co-authored-by: Rostislav Simonik --- src/index.test.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index b84dfc39..7991293b 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -303,17 +303,14 @@ test('Dependencies range types', async (t) => { t.deepEqual(Object.keys(ourDeps).sort(), ['@typescript-eslint/parser', 'eslint-config-standard']) t.true(isPinnedRange(ourDeps['eslint-config-standard']), 'eslint-config-standard is pinned') t.true(isSingleCaretRange(ourDeps['@typescript-eslint/parser']), '@typescript-eslint/parser is a single `^` range.') - - for (const [name, range] of Object.entries(ourPeerDeps as Record)) { - if (name === 'typescript') { - t.is(range, '*', 'Peer dependency typescript is `*`') - } else { - t.true( - isSingleCaretRange(range), - `Peer dependency \`${name}: ${range}\` is a single \`^\` range.` - ) - } - } + const typescriptValue = ourPeerDeps.typescript + t.is(typescriptValue, '*', 'Peer dependency typescript is `*`') + const typescriptEslintPluginValue = ourPeerDeps['@typescript-eslint/eslint-plugin'] + if (typescriptEslintPluginValue === undefined) throw new Error() + t.true( + isSingleCaretRange(typescriptEslintPluginValue), + `Peer dependency \`@typescript-eslint/eslint-plugin: ${typescriptEslintPluginValue}\` is a single \`^\` range.` + ) for (const [name, spec] of Object.entries(ourDevDeps)) { const range = name.startsWith(`${typescriptEslintBottom}/`) ? extractVersionSpec(spec) : spec t.true(isPinnedRange(range), `Dev dependency \`${name}: ${spec}\` is pinned`)