dd-trace 6.0.0-pre-51a58bc → 6.0.0-pre-386f4e7
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/package.json
CHANGED
|
@@ -4,6 +4,10 @@ let isKnownTestsEnabled = false
|
|
|
4
4
|
let knownTestsForSuite = []
|
|
5
5
|
let suiteTests = []
|
|
6
6
|
let earlyFlakeDetectionNumRetries = 0
|
|
7
|
+
// We need to grab the original window as soon as possible,
|
|
8
|
+
// in case the test changes the origin. If the test does change the origin,
|
|
9
|
+
// any call to `cy.window()` will result in a cross origin error.
|
|
10
|
+
let originalWindow
|
|
7
11
|
|
|
8
12
|
// If the test is using multi domain with cy.origin, trying to access
|
|
9
13
|
// window properties will result in a cross origin error.
|
|
@@ -61,6 +65,9 @@ beforeEach(function () {
|
|
|
61
65
|
this.skip()
|
|
62
66
|
}
|
|
63
67
|
})
|
|
68
|
+
cy.window().then(win => {
|
|
69
|
+
originalWindow = win
|
|
70
|
+
})
|
|
64
71
|
})
|
|
65
72
|
|
|
66
73
|
before(function () {
|
|
@@ -78,39 +85,39 @@ before(function () {
|
|
|
78
85
|
})
|
|
79
86
|
|
|
80
87
|
after(() => {
|
|
81
|
-
|
|
82
|
-
if (safeGetRum(
|
|
83
|
-
|
|
88
|
+
try {
|
|
89
|
+
if (safeGetRum(originalWindow)) {
|
|
90
|
+
originalWindow.dispatchEvent(new Event('beforeunload'))
|
|
84
91
|
}
|
|
85
|
-
})
|
|
92
|
+
} catch (e) {
|
|
93
|
+
// ignore error. It's usually a multi origin issue.
|
|
94
|
+
}
|
|
86
95
|
})
|
|
87
96
|
|
|
88
97
|
|
|
89
98
|
afterEach(function () {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
} catch (e) {}
|
|
99
|
+
const currentTest = Cypress.mocha.getRunner().suite.ctx.currentTest
|
|
100
|
+
const testInfo = {
|
|
101
|
+
testName: currentTest.fullTitle(),
|
|
102
|
+
testSuite: Cypress.mocha.getRootSuite().file,
|
|
103
|
+
testSuiteAbsolutePath: Cypress.spec && Cypress.spec.absolute,
|
|
104
|
+
state: currentTest.state,
|
|
105
|
+
error: currentTest.err,
|
|
106
|
+
isNew: currentTest._ddIsNew,
|
|
107
|
+
isEfdRetry: currentTest._ddIsEfdRetry
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
testInfo.testSourceLine = Cypress.mocha.getRunner().currentRunnable.invocationDetails.line
|
|
111
|
+
} catch (e) {}
|
|
104
112
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
})
|
|
113
|
+
if (safeGetRum(originalWindow)) {
|
|
114
|
+
testInfo.isRUMActive = true
|
|
115
|
+
}
|
|
116
|
+
let coverage
|
|
117
|
+
try {
|
|
118
|
+
coverage = originalWindow.__coverage__
|
|
119
|
+
} catch (e) {
|
|
120
|
+
// ignore error and continue
|
|
121
|
+
}
|
|
122
|
+
cy.task('dd:afterEach', { test: testInfo, coverage })
|
|
116
123
|
})
|