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

adobe / reactor-turbine / 26974271630

04 Jun 2026 07:23PM UTC coverage: 18.928% (-77.0%) from 95.912%
26974271630

Pull #201

github

web-flow
Merge 99f374fa8 into 4a42733a4
Pull Request #201: Platir 64071 update vulnerability chain

36 of 379 branches covered (9.5%)

Branch coverage included in aggregate %.

4 of 6 new or added lines in 1 file covered. (66.67%)

640 existing lines in 47 files now uncovered.

197 of 852 relevant lines covered (23.12%)

1.21 hits per line

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

11.27
/src/createGetDataElementValue.js
1
/***************************************************************************************
2
 * (c) 2017 Adobe. All rights reserved.
3
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
 * you may not use this file except in compliance with the License. You may obtain a copy
5
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
 *
7
 * Unless required by applicable law or agreed to in writing, software distributed under
8
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
 * OF ANY KIND, either express or implied. See the License for the specific language
10
 * governing permissions and limitations under the License.
11
 ****************************************************************************************/
12

13
var validateInjectedParams = require('./helpers/validate-injected-params');
3✔
14

15
var getErrorMessage = function (
3✔
16
  dataDef,
17
  dataElementName,
18
  errorMessage,
19
  errorStack
20
) {
UNCOV
21
  return (
×
22
    'Failed to execute data element module ' +
23
    dataDef.modulePath +
24
    ' for data element ' +
25
    dataElementName +
26
    '. ' +
27
    errorMessage +
28
    (errorStack ? '\n' + errorStack : '')
×
29
  );
30
};
31

32
function injectCreateGetDataElementValue({
33
  cleanText,
34
  dataElementSafe,
35
  logger
36
}) {
37
  return function createGetDataElementValue(
6✔
38
    moduleProvider,
39
    getDataElementDefinition,
40
    replaceTokens,
41
    undefinedVarsReturnEmpty,
42
    settingsFileTransformer
43
  ) {
UNCOV
44
    return function (name, syntheticEvent) {
×
UNCOV
45
      var dataDef = getDataElementDefinition(name);
×
46

UNCOV
47
      if (!dataDef) {
×
UNCOV
48
        return undefinedVarsReturnEmpty ? '' : undefined;
×
49
      }
50

UNCOV
51
      var storageDuration = dataDef.storageDuration;
×
52
      var moduleExports;
53
      var moduleDefinition;
54

UNCOV
55
      try {
×
UNCOV
56
        moduleExports = moduleProvider.getModuleExports(dataDef.modulePath);
×
UNCOV
57
        moduleDefinition = moduleProvider.getModuleDefinition(
×
58
          dataDef.modulePath
59
        );
60
      } catch (e) {
UNCOV
61
        logger.error(getErrorMessage(dataDef, name, e.message, e.stack));
×
UNCOV
62
        return;
×
63
      }
64

UNCOV
65
      if (typeof moduleExports !== 'function') {
×
UNCOV
66
        logger.error(
×
67
          getErrorMessage(dataDef, name, 'Module did not export a function.')
68
        );
UNCOV
69
        return;
×
70
      }
71

72
      var value;
73

UNCOV
74
      var dataElementSettings = dataDef.settings || {};
×
UNCOV
75
      if (!dataDef.hasTransformedFilePaths && moduleDefinition.filePaths) {
×
UNCOV
76
        settingsFileTransformer(
×
77
          dataElementSettings,
78
          moduleDefinition.filePaths,
79
          dataDef.modulePath
80
        );
UNCOV
81
        dataDef.hasTransformedFilePaths = true;
×
82
      }
83

UNCOV
84
      try {
×
UNCOV
85
        value = moduleExports(
×
86
          replaceTokens(dataElementSettings, syntheticEvent),
87
          syntheticEvent
88
        );
89
      } catch (e) {
UNCOV
90
        logger.error(getErrorMessage(dataDef, name, e.message, e.stack));
×
UNCOV
91
        return;
×
92
      }
93

UNCOV
94
      if (storageDuration) {
×
UNCOV
95
        if (value != null) {
×
UNCOV
96
          dataElementSafe.setValue(name, storageDuration, value);
×
97
        } else {
UNCOV
98
          value = dataElementSafe.getValue(name, storageDuration);
×
99
        }
100
      }
101

UNCOV
102
      if (value == null && dataDef.defaultValue != null) {
×
UNCOV
103
        value = dataDef.defaultValue;
×
104
      }
105

UNCOV
106
      if (typeof value === 'string') {
×
UNCOV
107
        if (dataDef.cleanText) {
×
UNCOV
108
          value = cleanText(value);
×
109
        }
110

UNCOV
111
        if (dataDef.forceLowerCase) {
×
UNCOV
112
          value = value.toLowerCase();
×
113
        }
114
      }
115

UNCOV
116
      return value;
×
117
    };
118
  };
119
}
120

121
const validateInjection = validateInjectedParams(
3✔
122
  injectCreateGetDataElementValue
123
);
124

125
module.exports = validateInjection({
3✔
126
  cleanText: require('./cleanText'),
127
  logger: require('./logger'),
128
  dataElementSafe: require('./dataElementSafe')
129
});
130

131
if (REACTOR_KARMA_CI_UNIT_TEST_MODE) {
3!
132
  /* START.TESTS_ONLY */
133
  module.exports.injectCreateGetDataElementValue = validateInjection;
3✔
134
  /* END.TESTS_ONLY */
135
}
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