cypress-fail-on-console-error 3.0.0 → 3.1.0
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 +6 -6
- package/dist/index.js +6 -2
- package/dist/types/Config.d.ts +1 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -20,11 +20,11 @@ failOnConsoleError();
|
|
|
20
20
|
|
|
21
21
|
### Config (optional)
|
|
22
22
|
|
|
23
|
-
| Parameter | Default | Description
|
|
24
|
-
| --------------------- | --------------------- |
|
|
25
|
-
| `excludeMessages` | `undefined` | Exclude console messages from throwing `AssertionError` <br /> When `console.error()` contains an error object from `new Error()`, then the whole stacktrace can be matched <br /> String
|
|
26
|
-
| `includeConsoleTypes` | `[consoleType.ERROR]` | Include console types for observation
|
|
27
|
-
| `cypressLog` | `false` | Include debug logs for `errorMessage_excludeMessage_match` and `errorMessage_excluded` to cypress runner
|
|
23
|
+
| Parameter | Default | Description |
|
|
24
|
+
| --------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `excludeMessages` | `undefined` | Exclude console messages from throwing `AssertionError` <br /> When `console.error()` contains an error object from `new Error()`, then the whole stacktrace can be matched <br /> Regular expression parameters are acceptable. String parameters will be interpreted as regular expression. Be sure to [escape the string regular expression](https://javascript.info/regexp-escaping) for special characters. |
|
|
26
|
+
| `includeConsoleTypes` | `[consoleType.ERROR]` | Include console types for observation |
|
|
27
|
+
| `cypressLog` | `false` | Include debug logs for `errorMessage_excludeMessage_match` and `errorMessage_excluded` to cypress runner |
|
|
28
28
|
|
|
29
29
|
<br/>
|
|
30
30
|
|
|
@@ -33,7 +33,7 @@ failOnConsoleError();
|
|
|
33
33
|
import failOnConsoleError, { consoleType } from 'cypress-fail-on-console-error';
|
|
34
34
|
|
|
35
35
|
const config = {
|
|
36
|
-
excludeMessages: ['foo',
|
|
36
|
+
excludeMessages: ['foo', /^some bar-regex.*/],
|
|
37
37
|
includeConsoleTypes: [
|
|
38
38
|
consoleType.ERROR,
|
|
39
39
|
consoleType.WARN,
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ exports.consoleType = exports.cypressLogger = exports.callToString = exports.isE
|
|
|
30
30
|
var chai = __importStar(require("chai"));
|
|
31
31
|
var sinon = __importStar(require("sinon"));
|
|
32
32
|
var sinon_chai_1 = __importDefault(require("sinon-chai"));
|
|
33
|
+
var type_detect_1 = __importDefault(require("type-detect"));
|
|
33
34
|
var ConsoleType_1 = require("./types/ConsoleType");
|
|
34
35
|
chai.should();
|
|
35
36
|
chai.use(sinon_chai_1.default);
|
|
@@ -55,8 +56,11 @@ var validateConfig = function (config) {
|
|
|
55
56
|
if (config.excludeMessages) {
|
|
56
57
|
chai.expect(config.excludeMessages).not.to.be.empty;
|
|
57
58
|
config.excludeMessages.forEach(function (_excludeMessage) {
|
|
58
|
-
chai.expect(_excludeMessage).to.be.
|
|
59
|
-
|
|
59
|
+
chai.expect((0, type_detect_1.default)(_excludeMessage)).to.be.oneOf([
|
|
60
|
+
'string',
|
|
61
|
+
'RegExp',
|
|
62
|
+
]);
|
|
63
|
+
chai.expect(_excludeMessage.toString()).to.have.length.above(0);
|
|
60
64
|
});
|
|
61
65
|
}
|
|
62
66
|
if (config.includeConsoleTypes) {
|
package/dist/types/Config.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress-fail-on-console-error",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "fail cypress test on console error",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test:ut:debug": "ts-mocha --inspect-brk test/unitTest.ts",
|
|
16
16
|
"test:it": "ts-mocha test/integrationTest.ts --timeout 60000",
|
|
17
17
|
"test:it:debug": "cypress open",
|
|
18
|
-
"verify": "npm run build && npm run prettier && npm run test",
|
|
18
|
+
"verify": "npm run build && npm run ci:prettier && npm run test",
|
|
19
19
|
"ci:prettier": "prettier --check \"**/*\""
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
@@ -42,14 +42,15 @@
|
|
|
42
42
|
"@types/chai": "4.3.1",
|
|
43
43
|
"@types/expect": "24.3.0",
|
|
44
44
|
"@types/mocha": "9.1.1",
|
|
45
|
-
"@types/sinon": "10.0.
|
|
45
|
+
"@types/sinon": "10.0.12",
|
|
46
46
|
"@types/sinon-chai": "3.2.8",
|
|
47
|
-
"
|
|
47
|
+
"@types/type-detect": "^4.0.1",
|
|
48
|
+
"cypress": "10.3.0",
|
|
48
49
|
"mocha": "10.0.0",
|
|
49
|
-
"prettier": "2.
|
|
50
|
-
"prettier-plugin-organize-imports": "
|
|
50
|
+
"prettier": "2.7.1",
|
|
51
|
+
"prettier-plugin-organize-imports": "3.0.0",
|
|
52
|
+
"rimraf": "3.0.2",
|
|
51
53
|
"ts-mocha": "10.0.0",
|
|
52
|
-
"typescript": "4.7.
|
|
53
|
-
"rimraf": "3.0.2"
|
|
54
|
+
"typescript": "4.7.4"
|
|
54
55
|
}
|
|
55
56
|
}
|