From ee6016ca6b562d73aebf70ffa483875be5f2a1df Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 12 Dec 2024 15:43:34 +0100 Subject: [PATCH] chore(node): Move a function out of `Yarn2Test` Prepare for reducing indentation of the tests. Signed-off-by: Sebastian Schuberth --- .../node/src/test/kotlin/yarn2/Yarn2Test.kt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/package-managers/node/src/test/kotlin/yarn2/Yarn2Test.kt b/plugins/package-managers/node/src/test/kotlin/yarn2/Yarn2Test.kt index 809bf853600bb..7922c9d2ed393 100644 --- a/plugins/package-managers/node/src/test/kotlin/yarn2/Yarn2Test.kt +++ b/plugins/package-managers/node/src/test/kotlin/yarn2/Yarn2Test.kt @@ -115,23 +115,23 @@ class Yarn2Test : WordSpec() { } } } +} - /** - * Check whether an executable defined in a `.yarnrc.yml` file is used when invoked with the given [workingDir] - * and [config]. This should be the case when Corepack is not enabled. - */ - private fun checkExecutableFromYarnRc(workingDir: File, config: AnalyzerConfiguration = AnalyzerConfiguration()) { - val executable = "yarn-wrapper.js" - workingDir.resolve(".yarnrc.yml").writeText("yarnPath: $executable") - val executableFile = workingDir.resolve(executable).apply { - writeText("#!/usr/bin/env node\nconsole.log('yarn')") - } +/** + * Check whether an executable defined in a `.yarnrc.yml` file is used when invoked with the given [workingDir] + * and [config]. This should be the case when Corepack is not enabled. + */ +private fun checkExecutableFromYarnRc(workingDir: File, config: AnalyzerConfiguration = AnalyzerConfiguration()) { + val executable = "yarn-wrapper.js" + workingDir.resolve(".yarnrc.yml").writeText("yarnPath: $executable") + val executableFile = workingDir.resolve(executable).apply { + writeText("#!/usr/bin/env node\nconsole.log('yarn')") + } - val yarn = Yarn2("Yarn2", workingDir, config, RepositoryConfiguration()) - val command = yarn.command(workingDir) + val yarn = Yarn2("Yarn2", workingDir, config, RepositoryConfiguration()) + val command = yarn.command(workingDir) - command shouldBe executableFile.absolutePath - } + command shouldBe executableFile.absolutePath } /**