mentie 0.1.10 → 0.1.12
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/modules/environment.js +3 -2
- package/modules/logging.js +8 -1
- package/package.json +1 -1
package/modules/environment.js
CHANGED
|
@@ -12,7 +12,7 @@ export const is_web = typeof window !== 'undefined'
|
|
|
12
12
|
* Checks if the code is running within a Cypress environment.
|
|
13
13
|
* @returns {boolean} Returns true if the code is running in a Cypress environment, otherwise returns false.
|
|
14
14
|
*/
|
|
15
|
-
export const is_cypress = typeof Cypress !== 'undefined'
|
|
15
|
+
export const is_cypress = is_web && typeof window.Cypress !== 'undefined'
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Checks if the code is running in a Node environment.
|
|
@@ -80,7 +80,8 @@ export const log_environment = logger => {
|
|
|
80
80
|
},
|
|
81
81
|
environment: {
|
|
82
82
|
dev,
|
|
83
|
-
is_emulator
|
|
83
|
+
is_emulator,
|
|
84
|
+
is_cypress
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
package/modules/logging.js
CHANGED
|
@@ -63,7 +63,14 @@ const annotate_messages = messages => {
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
// If we are running in cypress, stringify the messages because they become unavailable in the console
|
|
66
|
-
if( is_cypress )
|
|
66
|
+
if( is_cypress ) {
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
messages = messages.map( message => JSON.stringify( message, null, 2 ) )
|
|
70
|
+
} catch {
|
|
71
|
+
// This fails if the JSON was something curcular, se we'll leave things as they are
|
|
72
|
+
}
|
|
73
|
+
}
|
|
67
74
|
|
|
68
75
|
// Annotate the provided messages
|
|
69
76
|
messages = add_trace( messages )
|