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

nestjs / nest / 4985bf1d-5e80-46f6-bbaf-e681bc066260

03 Apr 2025 08:01AM UTC coverage: 89.274% (-0.03%) from 89.308%
4985bf1d-5e80-46f6-bbaf-e681bc066260

Pull #14900

circleci

kamilmysliwiec
feat(core): call hooks by components hierarchy level
Pull Request #14900: feat(core): call hooks by components hierarchy level (order)

2685 of 3377 branches covered (79.51%)

66 of 72 new or added lines in 9 files covered. (91.67%)

1 existing line in 1 file now uncovered.

7166 of 8027 relevant lines covered (89.27%)

16.47 hits per line

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

5.88
/packages/core/repl/repl-native-commands.ts
1
import type { REPLServer } from 'repl';
2

3
/**
4
 * Displays a list of available commands in the REPL alongside with their
5
 * descriptions.
6
 * (c) This code was inspired by the 'help' command from Node.js core:
7
 * {@link https://github.com/nodejs/node/blob/58b60c1393dd65cd228a8b0084a19acd2c1d16aa/lib/repl.js#L1741-L1759}
8
 */
9
function listAllCommands(replServer: REPLServer) {
10
  Object.keys(replServer.commands)
×
11
    .sort()
12
    .forEach(name => {
13
      const cmd = replServer.commands[name];
×
14
      if (cmd) {
×
15
        replServer.output.write(`${name}\t${cmd.help || ''}\n`);
×
16
      }
17
    });
18
}
19

20
export function defineDefaultCommandsOnRepl(replServer: REPLServer): void {
1✔
21
  replServer.defineCommand('help', {
×
22
    help: 'Show REPL options',
23
    action(name?: string) {
24
      this.clearBufferedCommand();
×
25

26
      if (name) {
×
27
        // Considering native commands before native nestjs injected functions.
28
        const nativeCommandOrFunction =
29
          this.commands[name] || this.context[name];
×
30
        // NOTE: If the command was retrieve from the context, it will have a `help`
31
        // getter property that outputs the helper message and returns undefined.
32
        // But if the command was retrieve from the `commands` object, it will
33
        // have a `help` property that returns the helper message.
34
        const helpMessage = nativeCommandOrFunction?.help;
×
35
        if (helpMessage) {
×
36
          this.output.write(`${helpMessage}\n`);
×
37
        }
38
      } else {
39
        listAllCommands(this);
×
40
        this.output.write('\n\n');
×
41
        this.context.help();
×
42
        this.output.write(
×
43
          '\nPress Ctrl+C to abort current expression, Ctrl+D to exit the REPL\n',
44
        );
45
      }
46

47
      this.displayPrompt();
×
48
    },
49
  });
50
}
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

© 2025 Coveralls, Inc