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

devpow112 / serverless-plugin-function-value / 13633348368

03 Mar 2025 02:36PM CUT coverage: 100.0%. Remained the same
13633348368

Pull #1240

github

web-flow
Merge a94ef7aa5 into 9717f153f
Pull Request #1240: build(deps): bump peter-evans/create-pull-request from 7.0.6 to 7.0.7

1 of 1 branches covered (100.0%)

Branch coverage included in aggregate %.

20 of 20 relevant lines covered (100.0%)

6.1 hits per line

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

100.0
/src/function-value-plugin.js
1
const formatLog = (resolver, address, result) =>
4✔
2
  `\${${resolver}:${address}} => ${JSON.stringify(result)}`;
6✔
3

4
export default class FunctionValuePlugin {
5
  constructor(serverless, _, { log }) {
6
    const naming = serverless.getProvider('aws').naming;
12✔
7
    const functions = serverless.service.getAllFunctions();
12✔
8
    const classes = serverless.classes;
12✔
9

10
    const getLambdaLogicalId = address => {
12✔
11
      if (functions.includes(address)) {
12✔
12
        return naming.getLambdaLogicalId(address);
6✔
13
      }
14

15
      throw new classes.Error(`Function "${address}" not defined`);
6✔
16
    };
17

18
    this.configurationVariablesSources = {
12✔
19
      'fn.arn': {
20
        resolve: ({ address }) => {
21
          const result = { 'Fn::GetAtt': [getLambdaLogicalId(address), 'Arn'] };
4✔
22

23
          log.debug(formatLog('fn.arn', address, result));
2✔
24

25
          return { value: result };
2✔
26
        }
27
      },
28
      'fn.name': {
29
        resolve: ({ address }) => {
30
          const result = { Ref: getLambdaLogicalId(address) };
4✔
31

32
          log.debug(formatLog('fn.name', address, result));
2✔
33

34
          return { value: result };
2✔
35
        }
36
      },
37
      'fn.logicalid': {
38
        resolve: ({ address }) => {
39
          const result = getLambdaLogicalId(address);
4✔
40

41
          log.debug(formatLog('fn.logicalid', address, result));
2✔
42

43
          return { value: result };
2✔
44
        }
45
      }
46
    };
47
  }
48
}
4✔
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