codeceptjs 4.0.1-beta.26 → 4.0.1-beta.27

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.
package/lib/container.js CHANGED
@@ -34,6 +34,7 @@ let container = {
34
34
  /** @type {Result | null} */
35
35
  result: null,
36
36
  sharedKeys: new Set(), // Track keys shared via share() function
37
+ tsFileMapping: null, // TypeScript file mapping for error stack fixing
37
38
  }
38
39
 
39
40
  /**
@@ -176,6 +177,15 @@ class Container {
176
177
  return container.translation
177
178
  }
178
179
 
180
+ /**
181
+ * Get TypeScript file mapping for error stack fixing
182
+ *
183
+ * @api
184
+ */
185
+ static tsFileMapping() {
186
+ return container.tsFileMapping
187
+ }
188
+
179
189
  /**
180
190
  * Get Mocha instance
181
191
  *
@@ -415,6 +425,8 @@ async function requireHelperFromModule(helperName, config, HelperClass) {
415
425
  importPath = tempFile
416
426
  tempJsFile = allTempFiles
417
427
  fileMapping = mapping
428
+ // Store file mapping in container for runtime error fixing
429
+ container.tsFileMapping = mapping
418
430
  } catch (tsError) {
419
431
  throw new Error(`Failed to load TypeScript helper ${importPath}: ${tsError.message}. Make sure 'typescript' package is installed.`)
420
432
  }
@@ -757,6 +769,8 @@ async function loadSupportObject(modulePath, supportObjectName) {
757
769
  // Store temp files list in a way that cleanup can access them
758
770
  tempJsFile = allTempFiles
759
771
  fileMapping = mapping
772
+ // Store file mapping in container for runtime error fixing
773
+ container.tsFileMapping = mapping
760
774
  } catch (tsError) {
761
775
  throw new Error(`Failed to load TypeScript file ${importPath}: ${tsError.message}. Make sure 'typescript' package is installed.`)
762
776
  }
@@ -5,6 +5,8 @@ import output from '../output.js'
5
5
  import store from '../store.js'
6
6
  import { TIMEOUT_ORDER } from '../timeout.js'
7
7
  import retryStep from './retry.js'
8
+ import { fixErrorStack } from '../utils/typescript.js'
9
+ import Container from '../container.js'
8
10
  function recordStep(step, args) {
9
11
  step.status = 'queued'
10
12
 
@@ -60,6 +62,13 @@ function recordStep(step, args) {
60
62
  recorder.catch(err => {
61
63
  step.status = 'failed'
62
64
  step.endTime = +Date.now()
65
+
66
+ // Fix error stack to point to original .ts files
67
+ const fileMapping = Container.tsFileMapping()
68
+ if (fileMapping) {
69
+ fixErrorStack(err, fileMapping)
70
+ }
71
+
63
72
  event.emit(event.step.failed, step, err)
64
73
  event.emit(event.step.finished, step)
65
74
  throw err
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "4.0.1-beta.26",
3
+ "version": "4.0.1-beta.27",
4
4
  "type": "module",
5
5
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
6
6
  "keywords": [