cypress-fail-on-console-error 2.1.2 → 2.1.3
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/README.md +1 -1
- package/dist/index.js +9 -9
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# cypress-fail-on-console-error
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This Plugin observes console.error() function from [window object](https://developer.mozilla.org/de/docs/Web/API/Window). It will automatically fail the executed cypress test as soon as the error function is executed once.
|
|
4
4
|
|
|
5
5
|
### Installation
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -32,21 +32,21 @@ chai.use(sinon_chai_1.default);
|
|
|
32
32
|
function failOnConsoleError(config) {
|
|
33
33
|
if (config === void 0) { config = {}; }
|
|
34
34
|
var spies;
|
|
35
|
-
exports.validateConfig(config);
|
|
36
|
-
config = exports.createConfig(config);
|
|
35
|
+
(0, exports.validateConfig)(config);
|
|
36
|
+
config = (0, exports.createConfig)(config);
|
|
37
37
|
Cypress.on('window:before:load', function (win) {
|
|
38
|
-
spies = exports.createSpies(config, win.console);
|
|
38
|
+
spies = (0, exports.createSpies)(config, win.console);
|
|
39
39
|
});
|
|
40
40
|
Cypress.on('command:enqueued', function () {
|
|
41
41
|
if (spies) {
|
|
42
|
-
spies = exports.resetSpies(spies);
|
|
42
|
+
spies = (0, exports.resetSpies)(spies);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
Cypress.on('command:end', function () {
|
|
46
|
-
if (!spies || !exports.someSpyCalled(spies)) {
|
|
46
|
+
if (!spies || !(0, exports.someSpyCalled)(spies)) {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
var spy = exports.getIncludedSpy(spies, config);
|
|
49
|
+
var spy = (0, exports.getIncludedSpy)(spies, config);
|
|
50
50
|
if (spy) {
|
|
51
51
|
chai.expect(spy).to.have.callCount(0);
|
|
52
52
|
}
|
|
@@ -64,7 +64,7 @@ var validateConfig = function (config) {
|
|
|
64
64
|
if (config.includeConsoleTypes) {
|
|
65
65
|
chai.expect(config.includeConsoleTypes).not.to.be.empty;
|
|
66
66
|
config.includeConsoleTypes.forEach(function (_includeConsoleType) {
|
|
67
|
-
return chai.expect(ConsoleType_1.someConsoleType(_includeConsoleType), "includeConsoleTypes '" + _includeConsoleType + "' is an unknown ConsoleType").to.be.true;
|
|
67
|
+
return chai.expect((0, ConsoleType_1.someConsoleType)(_includeConsoleType), "includeConsoleTypes '" + _includeConsoleType + "' is an unknown ConsoleType").to.be.true;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
};
|
|
@@ -97,7 +97,7 @@ exports.resetSpies = resetSpies;
|
|
|
97
97
|
var someSpyCalled = function (spies) { return Array.from(spies.values()).some(function (value) { return value.called; }); };
|
|
98
98
|
exports.someSpyCalled = someSpyCalled;
|
|
99
99
|
var getIncludedSpy = function (spies, config) {
|
|
100
|
-
return Array.from(spies.values()).find(function (spy) { return spy.called && exports.someIncludedCall(spy, config); });
|
|
100
|
+
return Array.from(spies.values()).find(function (spy) { return spy.called && (0, exports.someIncludedCall)(spy, config); });
|
|
101
101
|
};
|
|
102
102
|
exports.getIncludedSpy = getIncludedSpy;
|
|
103
103
|
var someIncludedCall = function (spy, config) {
|
|
@@ -105,7 +105,7 @@ var someIncludedCall = function (spy, config) {
|
|
|
105
105
|
return true;
|
|
106
106
|
}
|
|
107
107
|
return spy.args.some(function (call) {
|
|
108
|
-
return !exports.isExcludedMessage(config.excludeMessages, exports.callToString(call));
|
|
108
|
+
return !(0, exports.isExcludedMessage)(config.excludeMessages, (0, exports.callToString)(call));
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
111
|
exports.someIncludedCall = someIncludedCall;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress-fail-on-console-error",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "fail cypress test on console error",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
"homepage": "https://github.com/nils-hoyer/cypress-fail-on-console-error#readme",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"chai": "^4.3.4",
|
|
38
|
-
"sinon": "^
|
|
38
|
+
"sinon": "^12.0.0",
|
|
39
39
|
"sinon-chai": "^3.7.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/chai": "
|
|
43
|
-
"@types/expect": "
|
|
44
|
-
"@types/mocha": "
|
|
45
|
-
"@types/sinon": "
|
|
46
|
-
"@types/sinon-chai": "
|
|
47
|
-
"cypress": "
|
|
48
|
-
"mocha": "
|
|
49
|
-
"prettier": "
|
|
50
|
-
"prettier-plugin-organize-imports": "
|
|
51
|
-
"ts-mocha": "
|
|
52
|
-
"typescript": "
|
|
42
|
+
"@types/chai": "4.2.22",
|
|
43
|
+
"@types/expect": "24.3.0",
|
|
44
|
+
"@types/mocha": "9.0.0",
|
|
45
|
+
"@types/sinon": "10.0.6",
|
|
46
|
+
"@types/sinon-chai": "3.2.6",
|
|
47
|
+
"cypress": "9.1.0",
|
|
48
|
+
"mocha": "9.1.3",
|
|
49
|
+
"prettier": "2.5.0",
|
|
50
|
+
"prettier-plugin-organize-imports": "2.3.4",
|
|
51
|
+
"ts-mocha": "8.0.0",
|
|
52
|
+
"typescript": "4.5.2"
|
|
53
53
|
}
|
|
54
54
|
}
|