codeceptjs 3.6.2 → 3.6.3-beta.2
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/cli.js +15 -11
- package/lib/helper/WebDriver.js +1 -1
- package/lib/plugin/coverage.js +34 -1
- package/package.json +16 -16
package/lib/cli.js
CHANGED
|
@@ -186,20 +186,24 @@ class Cli extends Base {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
stack.
|
|
192
|
-
|
|
189
|
+
try {
|
|
190
|
+
let stack = err.stack ? err.stack.split('\n') : [];
|
|
191
|
+
if (stack[0] && stack[0].includes(err.message)) {
|
|
192
|
+
stack.shift();
|
|
193
|
+
}
|
|
193
194
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
if (output.level() < 3) {
|
|
196
|
+
stack = stack.slice(0, 3);
|
|
197
|
+
}
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
err.stack = `${stack.join('\n')}\n\n${output.colors.blue(log)}`;
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
// clone err object so stack trace adjustments won't affect test other reports
|
|
202
|
+
test.err = err;
|
|
203
|
+
return test;
|
|
204
|
+
} catch (e) {
|
|
205
|
+
throw Error(e);
|
|
206
|
+
}
|
|
203
207
|
});
|
|
204
208
|
|
|
205
209
|
const originalLog = Base.consoleLog;
|
package/lib/helper/WebDriver.js
CHANGED
|
@@ -642,6 +642,7 @@ class WebDriver extends Helper {
|
|
|
642
642
|
|
|
643
643
|
if (this.options.automationProtocol) {
|
|
644
644
|
this.puppeteerBrowser = await this.browser.getPuppeteer();
|
|
645
|
+
this.page = (await this.puppeteerBrowser.pages())[0];
|
|
645
646
|
}
|
|
646
647
|
|
|
647
648
|
return this.browser;
|
|
@@ -2731,7 +2732,6 @@ class WebDriver extends Helper {
|
|
|
2731
2732
|
this.recording = true;
|
|
2732
2733
|
this.recordedAtLeastOnce = true;
|
|
2733
2734
|
|
|
2734
|
-
this.page = (await this.puppeteerBrowser.pages())[0];
|
|
2735
2735
|
await this.page.setRequestInterception(true);
|
|
2736
2736
|
|
|
2737
2737
|
this.page.on('request', (request) => {
|
package/lib/plugin/coverage.js
CHANGED
|
@@ -11,7 +11,7 @@ const defaultConfig = {
|
|
|
11
11
|
outputDir: 'output/coverage',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const supportedHelpers = ['Puppeteer', 'Playwright'];
|
|
14
|
+
const supportedHelpers = ['Puppeteer', 'Playwright', 'WebDriver'];
|
|
15
15
|
|
|
16
16
|
const v8CoverageHelpers = {
|
|
17
17
|
Playwright: {
|
|
@@ -61,6 +61,33 @@ const v8CoverageHelpers = {
|
|
|
61
61
|
await coverageReport.add(coverageList);
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
|
+
WebDriver: {
|
|
65
|
+
startCoverage: async (page) => {
|
|
66
|
+
await Promise.all([
|
|
67
|
+
page.coverage.startJSCoverage({
|
|
68
|
+
resetOnNavigation: false,
|
|
69
|
+
includeRawScriptCoverage: true,
|
|
70
|
+
}),
|
|
71
|
+
page.coverage.startCSSCoverage({
|
|
72
|
+
resetOnNavigation: false,
|
|
73
|
+
}),
|
|
74
|
+
]);
|
|
75
|
+
},
|
|
76
|
+
takeCoverage: async (page, coverageReport) => {
|
|
77
|
+
const [jsCoverage, cssCoverage] = await Promise.all([
|
|
78
|
+
page.coverage.stopJSCoverage(),
|
|
79
|
+
page.coverage.stopCSSCoverage(),
|
|
80
|
+
]);
|
|
81
|
+
// to raw V8 script coverage
|
|
82
|
+
const coverageList = [...jsCoverage.map((it) => {
|
|
83
|
+
return {
|
|
84
|
+
source: it.text,
|
|
85
|
+
...it.rawScriptCoverage,
|
|
86
|
+
};
|
|
87
|
+
}), ...cssCoverage];
|
|
88
|
+
await coverageReport.add(coverageList);
|
|
89
|
+
},
|
|
90
|
+
},
|
|
64
91
|
};
|
|
65
92
|
|
|
66
93
|
/**
|
|
@@ -109,11 +136,17 @@ module.exports = function (config) {
|
|
|
109
136
|
const debug = debugModule(`codeceptjs:plugin:${helperName.toLowerCase()}Coverage`);
|
|
110
137
|
|
|
111
138
|
const helper = helpers[helperName];
|
|
139
|
+
|
|
140
|
+
if (helperName === 'WebDriver' && !helper.config.devtoolsProtocol) throw Error('Coverage is currently supporting the WebDriver running with Devtools protocol.');
|
|
141
|
+
|
|
112
142
|
const v8Helper = v8CoverageHelpers[helperName];
|
|
113
143
|
|
|
114
144
|
const coverageOptions = {
|
|
115
145
|
...config,
|
|
116
146
|
};
|
|
147
|
+
|
|
148
|
+
if (helperName === 'WebDriver') coverageOptions.coverageProvider = 'v8';
|
|
149
|
+
|
|
117
150
|
const coverageReport = new CoverageReport(coverageOptions);
|
|
118
151
|
coverageReport.cleanCache();
|
|
119
152
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.6.2",
|
|
3
|
+
"version": "3.6.3-beta.2",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"acorn": "8.11.3",
|
|
78
78
|
"arrify": "2.0.1",
|
|
79
79
|
"axios": "1.6.7",
|
|
80
|
-
"chai": "5.1.
|
|
80
|
+
"chai": "5.1.1",
|
|
81
81
|
"chai-deep-match": "1.2.1",
|
|
82
82
|
"chai-exclude": "2.1.0",
|
|
83
83
|
"chai-json-schema": "1.5.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"cross-spawn": "7.0.3",
|
|
90
90
|
"css-to-xpath": "0.1.0",
|
|
91
91
|
"csstoxpath": "1.6.0",
|
|
92
|
-
"devtools": "8.
|
|
92
|
+
"devtools": "8.36.1",
|
|
93
93
|
"envinfo": "7.11.1",
|
|
94
94
|
"escape-string-regexp": "4.0.0",
|
|
95
95
|
"figures": "3.2.0",
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
"lodash.merge": "4.6.2",
|
|
105
105
|
"mkdirp": "1.0.4",
|
|
106
106
|
"mocha": "10.4.0",
|
|
107
|
-
"monocart-coverage-reports": "2.
|
|
107
|
+
"monocart-coverage-reports": "2.8.3",
|
|
108
108
|
"ms": "2.1.3",
|
|
109
109
|
"ora-classic": "5.4.2",
|
|
110
|
-
"pactum": "3.6.
|
|
110
|
+
"pactum": "3.6.9",
|
|
111
111
|
"parse-function": "5.6.10",
|
|
112
112
|
"parse5": "7.1.2",
|
|
113
113
|
"promise-retry": "1.1.1",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"uuid": "9.0"
|
|
117
117
|
},
|
|
118
118
|
"optionalDependencies": {
|
|
119
|
-
"@codeceptjs/detox-helper": "1.0.
|
|
119
|
+
"@codeceptjs/detox-helper": "1.0.7"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@codeceptjs/mock-request": "0.3.1",
|
|
@@ -131,36 +131,36 @@
|
|
|
131
131
|
"@wdio/utils": "8.36.1",
|
|
132
132
|
"@xmldom/xmldom": "0.8.10",
|
|
133
133
|
"apollo-server-express": "2.25.3",
|
|
134
|
-
"chai-as-promised": "7.1.
|
|
134
|
+
"chai-as-promised": "7.1.2",
|
|
135
135
|
"chai-subset": "1.6.0",
|
|
136
136
|
"contributor-faces": "1.1.0",
|
|
137
137
|
"documentation": "12.3.0",
|
|
138
|
-
"electron": "30.0.
|
|
139
|
-
"eslint": "
|
|
138
|
+
"electron": "30.0.3",
|
|
139
|
+
"eslint": "9.2.0",
|
|
140
140
|
"eslint-config-airbnb-base": "15.0.0",
|
|
141
141
|
"eslint-plugin-import": "2.29.1",
|
|
142
|
-
"eslint-plugin-mocha": "
|
|
142
|
+
"eslint-plugin-mocha": "10.4.3",
|
|
143
143
|
"expect": "29.7.0",
|
|
144
144
|
"express": "4.19.2",
|
|
145
145
|
"graphql": "14.6.0",
|
|
146
146
|
"husky": "8.0.3",
|
|
147
147
|
"inquirer-test": "2.0.1",
|
|
148
|
-
"jsdoc": "
|
|
148
|
+
"jsdoc": "4.0.3",
|
|
149
149
|
"jsdoc-typeof-plugin": "1.0.0",
|
|
150
150
|
"json-server": "0.10.1",
|
|
151
|
-
"playwright": "1.
|
|
152
|
-
"puppeteer": "22.
|
|
151
|
+
"playwright": "1.44.0",
|
|
152
|
+
"puppeteer": "22.10.0",
|
|
153
153
|
"qrcode-terminal": "0.12.0",
|
|
154
154
|
"rosie": "2.1.1",
|
|
155
155
|
"runok": "0.9.3",
|
|
156
|
-
"sinon": "
|
|
156
|
+
"sinon": "18.0.0",
|
|
157
157
|
"sinon-chai": "3.7.0",
|
|
158
158
|
"testcafe": "3.5.0",
|
|
159
159
|
"ts-morph": "21.0.1",
|
|
160
160
|
"ts-node": "10.9.2",
|
|
161
161
|
"tsd": "^0.31.0",
|
|
162
162
|
"tsd-jsdoc": "2.5.0",
|
|
163
|
-
"typedoc": "0.25.
|
|
163
|
+
"typedoc": "0.25.13",
|
|
164
164
|
"typedoc-plugin-markdown": "3.17.1",
|
|
165
165
|
"typescript": "5.3.3",
|
|
166
166
|
"wdio-docker-service": "1.5.0",
|
|
@@ -179,4 +179,4 @@
|
|
|
179
179
|
"strict": false
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
}
|
|
182
|
+
}
|