(taskData, { transformRecordedData } = defaultOptions)
| 289 | }; |
| 290 | |
| 291 | async function teardownGitLabTest(taskData, { transformRecordedData } = defaultOptions) { |
| 292 | if (process.env.RECORD_FIXTURES) { |
| 293 | await resetRepositories(taskData); |
| 294 | |
| 295 | try { |
| 296 | const filename = getExpectationsFilename(taskData); |
| 297 | |
| 298 | console.log('Persisting recorded data for test:', path.basename(filename)); |
| 299 | |
| 300 | const { owner, token } = getEnvs(); |
| 301 | |
| 302 | const expectations = await retrieveRecordedExpectations(); |
| 303 | |
| 304 | const toSanitize = { |
| 305 | owner, |
| 306 | repo: taskData.repo, |
| 307 | token, |
| 308 | ownerName: taskData.user.name, |
| 309 | }; |
| 310 | // transform the mock proxy recorded requests into Cypress route format |
| 311 | const toPersist = expectations.map(expectation => |
| 312 | transformRecordedData(expectation, toSanitize), |
| 313 | ); |
| 314 | |
| 315 | const toPersistString = sanitizeString(JSON.stringify(toPersist, null, 2), toSanitize); |
| 316 | |
| 317 | await fs.writeFile(filename, toPersistString); |
| 318 | } catch (e) { |
| 319 | console.log(e); |
| 320 | } |
| 321 | |
| 322 | await resetMockServerState(); |
| 323 | } |
| 324 | |
| 325 | return null; |
| 326 | } |
| 327 | |
| 328 | module.exports = { |
| 329 | transformRecordedData, |
no test coverage detected