• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 20003978026

07 Dec 2025 12:09PM UTC coverage: 70.101% (+0.2%) from 69.903%
20003978026

push

github

web-flow
#39: refactoring to extract package-manager logic out of node/npm (#1638)

3892 of 6090 branches covered (63.91%)

Branch coverage included in aggregate %.

9955 of 13663 relevant lines covered (72.86%)

3.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
cli/src/main/java/com/devonfw/tools/ide/tool/node/Node.java
1
package com.devonfw.tools.ide.tool.node;
2

3
import java.util.Set;
4

5
import com.devonfw.tools.ide.common.Tag;
6
import com.devonfw.tools.ide.context.IdeContext;
7
import com.devonfw.tools.ide.nls.NlsBundle;
8
import com.devonfw.tools.ide.process.ProcessResult;
9
import com.devonfw.tools.ide.tool.LocalToolCommandlet;
10
import com.devonfw.tools.ide.tool.PackageManagerRequest;
11
import com.devonfw.tools.ide.tool.ToolCommandlet;
12
import com.devonfw.tools.ide.tool.ToolInstallRequest;
13
import com.devonfw.tools.ide.tool.npm.Npm;
14

15
/**
16
 * {@link ToolCommandlet} for <a href="https://nodejs.org/">node</a>.
17
 */
18
public class Node extends LocalToolCommandlet {
19

20
  /**
21
   * The constructor.
22
   *
23
   * @param context the {@link IdeContext}.
24
   */
25
  public Node(IdeContext context) {
26

27
    super(context, "node", Set.of(Tag.JAVA_SCRIPT, Tag.RUNTIME));
7✔
28
  }
1✔
29

30
  @Override
31
  protected void postInstallOnNewInstallation(ToolInstallRequest request) {
32

33
    super.postInstallOnNewInstallation(request);
3✔
34
    // this code is slightly dangerous: npm has a dependency to node, while here in node we call npm causing a cyclic dependency
35
    // the problem is that node package already comes with npm so we already have to configure npm properly here
36
    // inside npm we have to guarantee that we will not trigger an installation (again) causing an infinity loop
37
    // we would love to get this clean but node and npm are already flawed forcing us to do such hacks...
38
    Npm npm = this.context.getCommandletManager().getCommandlet(Npm.class);
7✔
39
    PackageManagerRequest packageManagerRequest = new PackageManagerRequest("config", this.tool).addArg("config").addArg("set").addArg("prefix")
13✔
40
        .addArg(getToolPath().toString());
4✔
41
    ProcessResult result = npm.runPackageManager(packageManagerRequest, true);
5✔
42
    if (result.isSuccessful()) {
3!
43
      this.context.success("Setting npm config prefix to: {} was successful", getToolPath());
11✔
44
    }
45
  }
1✔
46

47
  @Override
48
  public void printHelp(NlsBundle bundle) {
49

50
    this.context.info("For a list of supported options and arguments, use \"node --help\"");
×
51
  }
×
52

53
  @Override
54
  protected boolean isIgnoreSoftwareRepo() {
55

56
    return true;
2✔
57
  }
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc