integration-tests-rails 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 07f7241b5d554a5e0409bf4d955b5bcb859126f394e7eed5513ba6f92a9b3318
|
|
4
|
+
data.tar.gz: 72e0af62570e42a128cbd906b8874e30e69c0e419e898cacc96b936b0f4f3d56
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9bb1e5c7734164e053e45ab9a0fc17d7134d9a0b525351cafda5812110a26594fac0a363a8d1d415db849394f6d3bc591193fda4a6dba1b8c3d89d253f70909a
|
|
7
|
+
data.tar.gz: 23b0f92a2ecd62af9882abdfb48ca3cf751fd891ff0d6b28e2e39793e259a4b63e8069f0f85a35f65d7ad4c866ade47c1b6b18b888917e2b2b4b40a783ac3f2a
|
|
@@ -126,11 +126,13 @@ module IntegrationTestsRails
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const instrumentedDir = '#{config.output_path}';
|
|
129
|
+
const backupDir = '#{config.backup_path}';
|
|
130
|
+
const sourceDir = '#{config.source_path}';
|
|
129
131
|
const instrumentedFiles = findJsFiles(instrumentedDir);
|
|
130
132
|
|
|
131
133
|
instrumentedFiles.forEach(instrumentedFile => {
|
|
132
134
|
const relativePath = path.relative(instrumentedDir, instrumentedFile);
|
|
133
|
-
const originalFile = path.join(
|
|
135
|
+
const originalFile = path.join(sourceDir, relativePath);
|
|
134
136
|
|
|
135
137
|
if (coverageMap.data[originalFile]) return;
|
|
136
138
|
|
|
@@ -140,6 +142,7 @@ module IntegrationTestsRails
|
|
|
140
142
|
|
|
141
143
|
if (match && match[1]) {
|
|
142
144
|
const coverageData = eval('(' + match[1] + ')');
|
|
145
|
+
// Keep original path for display
|
|
143
146
|
coverageData.path = originalFile;
|
|
144
147
|
coverageMap.addFileCoverage(coverageData);
|
|
145
148
|
}
|
|
@@ -150,7 +153,21 @@ module IntegrationTestsRails
|
|
|
150
153
|
|
|
151
154
|
const context = libReport.createContext({
|
|
152
155
|
dir: 'coverage/javascript',
|
|
153
|
-
coverageMap: coverageMap
|
|
156
|
+
coverageMap: coverageMap,
|
|
157
|
+
sourceFinder: function(filePath) {
|
|
158
|
+
const relativePath = path.relative(sourceDir, filePath);
|
|
159
|
+
const backupFile = path.join(backupDir, relativePath);
|
|
160
|
+
|
|
161
|
+
try {
|
|
162
|
+
// Read content from backup (original source)
|
|
163
|
+
if (fs.existsSync(backupFile)) {
|
|
164
|
+
return fs.readFileSync(backupFile, 'utf8');
|
|
165
|
+
}
|
|
166
|
+
} catch(e) {
|
|
167
|
+
console.error('Could not read backup file:', backupFile, e.message);
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
154
171
|
});
|
|
155
172
|
|
|
156
173
|
['html', 'lcov', 'cobertura'].forEach(reportType => {
|