@apica-io/asm-playwright-runner 1.0.0-dev.3 → 1.0.0-dev.5

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.
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -18,310 +9,289 @@ const archiver_1 = __importDefault(require("archiver"));
18
9
  const path_1 = __importDefault(require("path"));
19
10
  const fs_1 = __importDefault(require("fs"));
20
11
  const runnerConfig_1 = require("../model/runnerConfig");
21
- function getJsonFileData(tracePath, fileName) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const directory = yield unzipper_1.default.Open.file(tracePath);
24
- const file = directory.files.find(f => f.path.endsWith(fileName));
25
- if (!file) {
26
- return {};
27
- }
28
- const content = yield file.buffer();
29
- return JSON.parse(content.toString("utf-8"));
30
- });
12
+ async function getJsonFileData(tracePath, fileName) {
13
+ const directory = await unzipper_1.default.Open.file(tracePath);
14
+ const file = directory.files.find(f => f.path.endsWith(fileName));
15
+ if (!file) {
16
+ return {};
17
+ }
18
+ const content = await file.buffer();
19
+ return JSON.parse(content.toString("utf-8"));
31
20
  }
32
21
  exports.getJsonFileData = getJsonFileData;
33
- function getFileData(tracePath, fileName) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- const directory = yield unzipper_1.default.Open.file(tracePath);
36
- const traceFile = directory.files.find(f => f.path.endsWith(fileName));
37
- if (!traceFile) {
38
- return [];
39
- }
40
- const content = yield traceFile.buffer();
41
- return content.toString('utf-8').split('\n').filter(Boolean);
42
- });
22
+ async function getFileData(tracePath, fileName) {
23
+ const directory = await unzipper_1.default.Open.file(tracePath);
24
+ const traceFile = directory.files.find(f => f.path.endsWith(fileName));
25
+ if (!traceFile) {
26
+ return [];
27
+ }
28
+ const content = await traceFile.buffer();
29
+ return content.toString('utf-8').split('\n').filter(Boolean);
43
30
  }
44
31
  exports.getFileData = getFileData;
45
- function extractResources(zipPath_1) {
46
- return __awaiter(this, arguments, void 0, function* (zipPath, targetImages = []) {
47
- const baseDir = path_1.default.dirname(zipPath);
48
- const runName = path_1.default.basename(baseDir);
49
- const resultDir = path_1.default.dirname(baseDir);
50
- const parentDir = resultDir === "." ? runName : resultDir;
51
- const appendRunName = resultDir === "." ? [] : [runName];
52
- const screenshotsDir = path_1.default.join(parentDir, runnerConfig_1.ResultDir.SCREENSHOT, ...appendRunName);
53
- const sourceDir = path_1.default.join(parentDir, runnerConfig_1.ResultDir.SOURCE, ...appendRunName);
54
- // Create folders if not exists
55
- [screenshotsDir, sourceDir].forEach(dir => {
56
- if (!fs_1.default.existsSync(dir)) {
57
- fs_1.default.mkdirSync(dir, { recursive: true });
58
- }
59
- });
60
- const directory = yield unzipper_1.default.Open.file(zipPath);
61
- // Copy target images
62
- const imagePromises = targetImages.map(targetImage => {
63
- const fileEntry = directory.files.find((file) => file.path === `resources/${targetImage}`);
64
- if (!fileEntry) {
65
- return Promise.resolve();
66
- }
67
- const outputPath = path_1.default.join(screenshotsDir, targetImage);
68
- return new Promise((resolve, reject) => {
69
- fileEntry
70
- .stream()
71
- .pipe(fs_1.default.createWriteStream(outputPath))
72
- .on('finish', () => {
73
- resolve(true);
74
- })
75
- .on('error', reject);
76
- });
77
- });
78
- // Copy all src@*.txt files
79
- const sourcePromises = directory.files
80
- .filter(file => file.path.startsWith('resources/') &&
81
- /^src@.*\.txt$/.test(path_1.default.basename(file.path)))
82
- .map(fileEntry => {
83
- const fileName = path_1.default.basename(fileEntry.path);
84
- const outputPath = path_1.default.join(sourceDir, fileName);
85
- return new Promise((resolve, reject) => {
86
- fileEntry
87
- .stream()
88
- .pipe(fs_1.default.createWriteStream(outputPath))
89
- .on('finish', () => {
90
- resolve(true);
91
- })
92
- .on('error', reject);
93
- });
94
- });
95
- const errorContext = path_1.default.join(baseDir, "error-context.md");
96
- if (fs_1.default.existsSync(errorContext)) {
97
- fs_1.default.copyFileSync(errorContext, path_1.default.join(sourceDir, "error-context.md"));
32
+ async function extractResources(zipPath, targetImages = []) {
33
+ const baseDir = path_1.default.dirname(zipPath);
34
+ const runName = path_1.default.basename(baseDir);
35
+ const resultDir = path_1.default.dirname(baseDir);
36
+ const parentDir = resultDir === "." ? runName : resultDir;
37
+ const appendRunName = resultDir === "." ? [] : [runName];
38
+ const screenshotsDir = path_1.default.join(parentDir, runnerConfig_1.ResultDir.SCREENSHOT, ...appendRunName);
39
+ const sourceDir = path_1.default.join(parentDir, runnerConfig_1.ResultDir.SOURCE, ...appendRunName);
40
+ // Create folders if not exists
41
+ [screenshotsDir, sourceDir].forEach(dir => {
42
+ if (!fs_1.default.existsSync(dir)) {
43
+ fs_1.default.mkdirSync(dir, { recursive: true });
98
44
  }
99
- yield Promise.all([...imagePromises, ...sourcePromises]);
100
45
  });
101
- }
102
- function zipResources(outputZipPath, screenshotsDir, sourceDir) {
103
- return __awaiter(this, void 0, void 0, function* () {
46
+ const directory = await unzipper_1.default.Open.file(zipPath);
47
+ // Copy target images
48
+ const imagePromises = targetImages.map(targetImage => {
49
+ const fileEntry = directory.files.find((file) => file.path === `resources/${targetImage}`);
50
+ if (!fileEntry) {
51
+ return Promise.resolve();
52
+ }
53
+ const outputPath = path_1.default.join(screenshotsDir, targetImage);
104
54
  return new Promise((resolve, reject) => {
105
- const output = fs_1.default.createWriteStream(outputZipPath);
106
- const archive = (0, archiver_1.default)("zip", { zlib: { level: 9 } });
107
- output.on("close", resolve);
108
- archive.on("error", reject);
109
- archive.pipe(output);
110
- if (fs_1.default.existsSync(screenshotsDir)) {
111
- archive.directory(screenshotsDir, runnerConfig_1.ResultDir.SCREENSHOT);
112
- }
113
- if (fs_1.default.existsSync(sourceDir)) {
114
- archive.directory(sourceDir, runnerConfig_1.ResultDir.SOURCE);
115
- }
116
- archive.finalize();
55
+ fileEntry
56
+ .stream()
57
+ .pipe(fs_1.default.createWriteStream(outputPath))
58
+ .on('finish', () => {
59
+ resolve(true);
60
+ })
61
+ .on('error', reject);
62
+ });
63
+ });
64
+ // Copy all src@*.txt files
65
+ const sourcePromises = directory.files
66
+ .filter(file => file.path.startsWith('resources/') &&
67
+ /^src@.*\.txt$/.test(path_1.default.basename(file.path)))
68
+ .map(fileEntry => {
69
+ const fileName = path_1.default.basename(fileEntry.path);
70
+ const outputPath = path_1.default.join(sourceDir, fileName);
71
+ return new Promise((resolve, reject) => {
72
+ fileEntry
73
+ .stream()
74
+ .pipe(fs_1.default.createWriteStream(outputPath))
75
+ .on('finish', () => {
76
+ resolve(true);
77
+ })
78
+ .on('error', reject);
117
79
  });
118
80
  });
81
+ const errorContext = path_1.default.join(baseDir, "error-context.md");
82
+ if (fs_1.default.existsSync(errorContext)) {
83
+ fs_1.default.copyFileSync(errorContext, path_1.default.join(sourceDir, "error-context.md"));
84
+ }
85
+ await Promise.all([...imagePromises, ...sourcePromises]);
86
+ }
87
+ async function zipResources(outputZipPath, screenshotsDir, sourceDir) {
88
+ return new Promise((resolve, reject) => {
89
+ const output = fs_1.default.createWriteStream(outputZipPath);
90
+ const archive = (0, archiver_1.default)("zip", { zlib: { level: 9 } });
91
+ output.on("close", resolve);
92
+ archive.on("error", reject);
93
+ archive.pipe(output);
94
+ if (fs_1.default.existsSync(screenshotsDir)) {
95
+ archive.directory(screenshotsDir, runnerConfig_1.ResultDir.SCREENSHOT);
96
+ }
97
+ if (fs_1.default.existsSync(sourceDir)) {
98
+ archive.directory(sourceDir, runnerConfig_1.ResultDir.SOURCE);
99
+ }
100
+ archive.finalize();
101
+ });
119
102
  }
120
103
  exports.zipResources = zipResources;
121
- function setHookActions(traceRawResult) {
122
- return __awaiter(this, void 0, void 0, function* () {
123
- var _a, _b;
124
- const hookModel = { actions: [], stdio: [], errors: [] };
125
- const hookActions = {};
126
- for (const [index, row] of traceRawResult.entries()) {
127
- const entry = JSON.parse(row);
128
- if (entry.type === "context-options") {
129
- Object.assign(hookModel, {
130
- origin: entry.origin,
131
- browserName: entry.browserName,
132
- playwrightVersion: entry.playwrightVersion,
133
- options: entry.options,
134
- platform: entry.platform,
135
- wallTime: entry.wallTime,
136
- startTime: entry.monotonicTime,
137
- sdkLanguage: entry.sdkLanguage,
138
- testIdAttributeName: entry.testIdAttributeName,
139
- contextId: entry.contextId,
140
- testTimeout: entry.testTimeout,
141
- });
142
- continue;
104
+ async function setHookActions(traceRawResult) {
105
+ const hookModel = { actions: [], stdio: [], errors: [] };
106
+ const hookActions = {};
107
+ for (const [index, row] of traceRawResult.entries()) {
108
+ const entry = JSON.parse(row);
109
+ if (entry.type === "context-options") {
110
+ Object.assign(hookModel, {
111
+ origin: entry.origin,
112
+ browserName: entry.browserName,
113
+ playwrightVersion: entry.playwrightVersion,
114
+ options: entry.options,
115
+ platform: entry.platform,
116
+ wallTime: entry.wallTime,
117
+ startTime: entry.monotonicTime,
118
+ sdkLanguage: entry.sdkLanguage,
119
+ testIdAttributeName: entry.testIdAttributeName,
120
+ contextId: entry.contextId,
121
+ testTimeout: entry.testTimeout,
122
+ });
123
+ continue;
124
+ }
125
+ else if (entry.type === "stdout" || entry.type === "stderr") {
126
+ hookModel?.stdio?.push(entry);
127
+ }
128
+ else if (entry.type === "before") {
129
+ const action = {
130
+ type: "action",
131
+ callId: entry.callId,
132
+ stepId: entry.stepId,
133
+ parentId: entry.parentId,
134
+ startTime: entry.startTime,
135
+ class: entry.class,
136
+ method: entry.method,
137
+ title: entry.title,
138
+ params: entry.params,
139
+ stack: entry.stack,
140
+ log: [],
141
+ };
142
+ hookActions[entry.callId] = action;
143
+ hookModel.actions.push(action);
144
+ }
145
+ else if (entry.type === "after" && hookActions[entry.callId]) {
146
+ Object.assign(hookActions[entry.callId], {
147
+ endTime: entry.endTime,
148
+ annotations: entry.annotations,
149
+ error: entry.error,
150
+ });
151
+ }
152
+ else if (entry.type == "error") {
153
+ hookModel.errors?.push(entry);
154
+ }
155
+ if (index === (traceRawResult.length - 1) && entry.type === "after") {
156
+ hookModel.endTime = entry.endTime;
157
+ if (hookModel.endTime != null && hookModel.startTime) {
158
+ hookModel.duration = Number((hookModel.endTime - hookModel.startTime).toFixed(3));
143
159
  }
144
- else if (entry.type === "stdout" || entry.type === "stderr") {
145
- (_a = hookModel === null || hookModel === void 0 ? void 0 : hookModel.stdio) === null || _a === void 0 ? void 0 : _a.push(entry);
160
+ }
161
+ }
162
+ return hookModel;
163
+ }
164
+ exports.setHookActions = setHookActions;
165
+ async function setActions(traceRawResult, traceModel, tracePath, stackData) {
166
+ let beforeFlag = false;
167
+ let action = null;
168
+ let targetImages = [];
169
+ for (const row of traceRawResult) {
170
+ const entry = JSON.parse(row);
171
+ if (entry.type === 'context-options') {
172
+ traceModel.origin = entry.origin;
173
+ traceModel.browserName = entry.browserName;
174
+ traceModel.playwrightVersion = entry.playwrightVersion;
175
+ traceModel.options = entry.options;
176
+ traceModel.platform = entry.platform;
177
+ traceModel.wallTime = entry.wallTime;
178
+ traceModel.startTime = entry.monotonicTime;
179
+ traceModel.sdkLanguage = entry.sdkLanguage;
180
+ traceModel.testIdAttributeName = entry.testIdAttributeName;
181
+ traceModel.contextId = entry.contextId;
182
+ }
183
+ else if (entry.type == "event" || entry.type == "console") {
184
+ traceModel.events?.push(entry);
185
+ }
186
+ else if (entry.type === "stdout" || entry.type === "stderr") {
187
+ traceModel?.stdio?.push(entry);
188
+ }
189
+ else if (entry.type == "screencast-frame") {
190
+ let page = traceModel.pages?.find(p => p.pageId === entry.pageId);
191
+ if (!page) {
192
+ page = {
193
+ pageId: entry.pageId,
194
+ screencastFrames: [],
195
+ };
196
+ traceModel.pages?.push(page);
146
197
  }
147
- else if (entry.type === "before") {
148
- const action = {
149
- type: "action",
198
+ targetImages.push(entry.sha1);
199
+ page.screencastFrames.push(entry);
200
+ }
201
+ else {
202
+ if (entry.type == "before") {
203
+ action = {
150
204
  callId: entry.callId,
151
- stepId: entry.stepId,
152
- parentId: entry.parentId,
153
- startTime: entry.startTime,
154
205
  class: entry.class,
155
206
  method: entry.method,
156
- title: entry.title,
207
+ startTime: entry.startTime,
208
+ type: "action",
157
209
  params: entry.params,
158
- stack: entry.stack,
210
+ pageId: entry.pageId,
159
211
  log: [],
212
+ stack: stackData[entry.callId]
160
213
  };
161
- hookActions[entry.callId] = action;
162
- hookModel.actions.push(action);
163
- }
164
- else if (entry.type === "after" && hookActions[entry.callId]) {
165
- Object.assign(hookActions[entry.callId], {
166
- endTime: entry.endTime,
167
- annotations: entry.annotations,
168
- error: entry.error,
169
- });
170
- }
171
- else if (entry.type == "error") {
172
- (_b = hookModel.errors) === null || _b === void 0 ? void 0 : _b.push(entry);
173
- }
174
- if (index === (traceRawResult.length - 1) && entry.type === "after") {
175
- hookModel.endTime = entry.endTime;
176
- if (hookModel.endTime != null && hookModel.startTime) {
177
- hookModel.duration = Number((hookModel.endTime - hookModel.startTime).toFixed(3));
178
- }
179
- }
180
- }
181
- return hookModel;
182
- });
183
- }
184
- exports.setHookActions = setHookActions;
185
- function setActions(traceRawResult, traceModel, tracePath, stackData) {
186
- return __awaiter(this, void 0, void 0, function* () {
187
- var _a, _b, _c, _d, _e, _f;
188
- let beforeFlag = false;
189
- let action = null;
190
- let targetImages = [];
191
- for (const row of traceRawResult) {
192
- const entry = JSON.parse(row);
193
- if (entry.type === 'context-options') {
194
- traceModel.origin = entry.origin;
195
- traceModel.browserName = entry.browserName;
196
- traceModel.playwrightVersion = entry.playwrightVersion;
197
- traceModel.options = entry.options;
198
- traceModel.platform = entry.platform;
199
- traceModel.wallTime = entry.wallTime;
200
- traceModel.startTime = entry.monotonicTime;
201
- traceModel.sdkLanguage = entry.sdkLanguage;
202
- traceModel.testIdAttributeName = entry.testIdAttributeName;
203
- traceModel.contextId = entry.contextId;
204
- }
205
- else if (entry.type == "event" || entry.type == "console") {
206
- (_a = traceModel.events) === null || _a === void 0 ? void 0 : _a.push(entry);
207
- }
208
- else if (entry.type === "stdout" || entry.type === "stderr") {
209
- (_b = traceModel === null || traceModel === void 0 ? void 0 : traceModel.stdio) === null || _b === void 0 ? void 0 : _b.push(entry);
210
- }
211
- else if (entry.type == "screencast-frame") {
212
- let page = (_c = traceModel.pages) === null || _c === void 0 ? void 0 : _c.find(p => p.pageId === entry.pageId);
213
- if (!page) {
214
- page = {
215
- pageId: entry.pageId,
216
- screencastFrames: [],
217
- };
218
- (_d = traceModel.pages) === null || _d === void 0 ? void 0 : _d.push(page);
214
+ if (entry.class == "Frame") {
215
+ action.beforeSnapshot = entry.beforeSnapshot;
219
216
  }
220
- targetImages.push(entry.sha1);
221
- page.screencastFrames.push(entry);
217
+ beforeFlag = true;
222
218
  }
223
- else {
224
- if (entry.type == "before") {
225
- action = {
226
- callId: entry.callId,
227
- class: entry.class,
228
- method: entry.method,
229
- startTime: entry.startTime,
230
- type: "action",
231
- params: entry.params,
232
- pageId: entry.pageId,
233
- log: [],
234
- stack: stackData[entry.callId]
235
- };
236
- if (entry.class == "Frame") {
237
- action.beforeSnapshot = entry.beforeSnapshot;
238
- }
239
- beforeFlag = true;
219
+ if (beforeFlag && action != null && action.callId == entry.callId) {
220
+ if (entry.type == "log") {
221
+ action.log?.push({
222
+ time: entry.time,
223
+ message: entry.message
224
+ });
240
225
  }
241
- if (beforeFlag && action != null && action.callId == entry.callId) {
242
- if (entry.type == "log") {
243
- (_e = action.log) === null || _e === void 0 ? void 0 : _e.push({
244
- time: entry.time,
245
- message: entry.message
246
- });
247
- }
248
- if (entry.type == "after") {
249
- beforeFlag = false;
250
- action.endTime = entry.endTime;
251
- action.result = entry.result;
252
- action.error = entry.error;
253
- action.afterSnapshot = entry.afterSnapshot;
254
- (_f = traceModel.actions) === null || _f === void 0 ? void 0 : _f.push(action);
255
- }
226
+ if (entry.type == "after") {
227
+ beforeFlag = false;
228
+ action.endTime = entry.endTime;
229
+ action.result = entry.result;
230
+ action.error = entry.error;
231
+ action.afterSnapshot = entry.afterSnapshot;
232
+ traceModel.actions?.push(action);
256
233
  }
257
234
  }
258
235
  }
259
- traceModel.endTime = action === null || action === void 0 ? void 0 : action.endTime;
260
- if (traceModel.endTime != null && traceModel.startTime) {
261
- traceModel.duration = Number((traceModel.endTime - traceModel.startTime).toFixed(3));
262
- }
263
- yield extractResources(tracePath, targetImages);
264
- });
236
+ }
237
+ traceModel.endTime = action?.endTime;
238
+ if (traceModel.endTime != null && traceModel.startTime) {
239
+ traceModel.duration = Number((traceModel.endTime - traceModel.startTime).toFixed(3));
240
+ }
241
+ await extractResources(tracePath, targetImages);
265
242
  }
266
243
  exports.setActions = setActions;
267
- function setResources(resourceRawResult, traceModel) {
268
- return __awaiter(this, void 0, void 0, function* () {
269
- var _a;
270
- for (const row of resourceRawResult) {
271
- const entry = JSON.parse(row);
272
- (_a = traceModel.resources) === null || _a === void 0 ? void 0 : _a.push(entry.snapshot);
273
- }
274
- });
244
+ async function setResources(resourceRawResult, traceModel) {
245
+ for (const row of resourceRawResult) {
246
+ const entry = JSON.parse(row);
247
+ traceModel.resources?.push(entry.snapshot);
248
+ }
275
249
  }
276
250
  exports.setResources = setResources;
277
- function prepareStackData(stacksRawResult) {
278
- return __awaiter(this, void 0, void 0, function* () {
279
- const preparedData = {};
280
- const files = stacksRawResult.files || [];
281
- const stacks = stacksRawResult.stacks || [];
282
- for (const stack of stacks) {
283
- const [callId, frames] = stack;
284
- preparedData[`call@${callId}`] = frames.map(([fileIndex, line, column, fn]) => ({
285
- file: files[fileIndex] || `source-file-${fileIndex}`,
286
- fileIndex: `source-file-${fileIndex}`,
287
- line,
288
- column,
289
- functionName: fn || ""
290
- }));
291
- }
292
- return preparedData;
293
- });
251
+ async function prepareStackData(stacksRawResult) {
252
+ const preparedData = {};
253
+ const files = stacksRawResult.files || [];
254
+ const stacks = stacksRawResult.stacks || [];
255
+ for (const stack of stacks) {
256
+ const [callId, frames] = stack;
257
+ preparedData[`call@${callId}`] = frames.map(([fileIndex, line, column, fn]) => ({
258
+ file: files[fileIndex] || `source-file-${fileIndex}`,
259
+ fileIndex: `source-file-${fileIndex}`,
260
+ line,
261
+ column,
262
+ functionName: fn || ""
263
+ }));
264
+ }
265
+ return preparedData;
294
266
  }
295
267
  exports.prepareStackData = prepareStackData;
296
- function prepareTraceModel(tracePath, logLevel) {
297
- return __awaiter(this, void 0, void 0, function* () {
298
- const traceRawResult = yield getFileData(tracePath, "trace.trace");
299
- const resourceRawResult = yield getFileData(tracePath, "trace.network");
300
- const stacksRawResult = yield getJsonFileData(tracePath, "trace.stacks");
301
- const traceModel = {
302
- actions: [],
303
- events: [],
304
- resources: [],
305
- errors: [],
306
- pages: [],
307
- stdio: []
308
- };
268
+ async function prepareTraceModel(tracePath, logLevel) {
269
+ const traceRawResult = await getFileData(tracePath, "trace.trace");
270
+ const resourceRawResult = await getFileData(tracePath, "trace.network");
271
+ const stacksRawResult = await getJsonFileData(tracePath, "trace.stacks");
272
+ const traceModel = {
273
+ actions: [],
274
+ events: [],
275
+ resources: [],
276
+ errors: [],
277
+ pages: [],
278
+ stdio: []
279
+ };
280
+ if (logLevel == runnerConfig_1.LogLevel.DEBUG) {
281
+ fs_1.default.writeFileSync(path_1.default.join(path_1.default.dirname(tracePath), "trace-raw-data.json"), JSON.stringify(traceRawResult, null, 2), "utf-8");
282
+ }
283
+ const stackData = await prepareStackData(stacksRawResult);
284
+ await setActions(traceRawResult, traceModel, tracePath, stackData);
285
+ await setResources(resourceRawResult, traceModel);
286
+ const testHookResult = await getFileData(tracePath, "test.trace");
287
+ if (testHookResult && testHookResult.length > 0) {
309
288
  if (logLevel == runnerConfig_1.LogLevel.DEBUG) {
310
- fs_1.default.writeFileSync(path_1.default.join(path_1.default.dirname(tracePath), "trace-raw-data.json"), JSON.stringify(traceRawResult, null, 2), "utf-8");
311
- }
312
- const stackData = yield prepareStackData(stacksRawResult);
313
- yield setActions(traceRawResult, traceModel, tracePath, stackData);
314
- yield setResources(resourceRawResult, traceModel);
315
- const testHookResult = yield getFileData(tracePath, "test.trace");
316
- if (testHookResult && testHookResult.length > 0) {
317
- if (logLevel == runnerConfig_1.LogLevel.DEBUG) {
318
- //raw data to validate data from trace
319
- fs_1.default.writeFileSync(path_1.default.join(path_1.default.dirname(tracePath), "test-trace-raw-data.json"), JSON.stringify(testHookResult, null, 2), "utf-8");
320
- }
321
- const hookModel = yield setHookActions(testHookResult);
322
- return [hookModel, traceModel];
289
+ //raw data to validate data from trace
290
+ fs_1.default.writeFileSync(path_1.default.join(path_1.default.dirname(tracePath), "test-trace-raw-data.json"), JSON.stringify(testHookResult, null, 2), "utf-8");
323
291
  }
324
- return [traceModel];
325
- });
292
+ const hookModel = await setHookActions(testHookResult);
293
+ return [hookModel, traceModel];
294
+ }
295
+ return [traceModel];
326
296
  }
327
297
  exports.prepareTraceModel = prepareTraceModel;