cypress-fail-on-console-error 3.2.1 → 3.2.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/README.md +3 -3
- package/dist/index.d.ts +7 -6
- package/dist/index.js +10 -9
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -29,9 +29,9 @@ failOnConsoleError();
|
|
|
29
29
|
<br/>
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
import failOnConsoleError, { consoleType } from 'cypress-fail-on-console-error';
|
|
32
|
+
import failOnConsoleError, { consoleType, Config } from 'cypress-fail-on-console-error';
|
|
33
33
|
|
|
34
|
-
const config = {
|
|
34
|
+
const config: Config = {
|
|
35
35
|
excludeMessages: ['foo', /^some bar-regex.*/],
|
|
36
36
|
includeConsoleTypes: [
|
|
37
37
|
consoleType.ERROR,
|
|
@@ -67,4 +67,4 @@ When Cypress log is activated, debug information about the matching and exclude
|
|
|
67
67
|
|
|
68
68
|
### Contributing
|
|
69
69
|
1. Create an project issue with proper description and expected behaviour
|
|
70
|
-
2. Provide a PR with implementation and tests. Command `npm run verify` have to pass locally
|
|
70
|
+
2. Provide a PR with implementation and tests. Command `npm run verify` have to pass locally
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as sinon from 'sinon';
|
|
2
2
|
import { Config } from './types/Config';
|
|
3
3
|
import { ConsoleType } from './types/ConsoleType';
|
|
4
|
-
export default function failOnConsoleError(
|
|
4
|
+
export default function failOnConsoleError(_config?: Config): void;
|
|
5
5
|
export declare const validateConfig: (config: Config) => void;
|
|
6
|
-
export declare const createConfig: (config: Config) => Config
|
|
7
|
-
export declare const createSpies: (config: Config
|
|
6
|
+
export declare const createConfig: (config: Config) => Required<Config>;
|
|
7
|
+
export declare const createSpies: (config: Required<Config>, console: Console) => Map<ConsoleType, sinon.SinonSpy>;
|
|
8
8
|
export declare const resetSpies: (spies: Map<ConsoleType, sinon.SinonSpy>) => Map<ConsoleType, sinon.SinonSpy>;
|
|
9
|
-
export declare const getIncludedCall: (spies: Map<ConsoleType, sinon.SinonSpy>, config: Config) => string | undefined;
|
|
10
|
-
export declare const findIncludedCall: (spy: sinon.SinonSpy, config: Config) => string | undefined;
|
|
9
|
+
export declare const getIncludedCall: (spies: Map<ConsoleType, sinon.SinonSpy>, config: Required<Config>) => string | undefined;
|
|
10
|
+
export declare const findIncludedCall: (spy: sinon.SinonSpy, config: Required<Config>) => string | undefined;
|
|
11
11
|
export declare const isErrorMessageExcluded: (errorMessage: string, excludeMessage: string, cypressLog: boolean) => boolean;
|
|
12
12
|
export declare const callToString: (calls: any[]) => string;
|
|
13
13
|
export declare const cypressLogger: (name: string, message: any) => void;
|
|
14
|
-
export
|
|
14
|
+
export { Config } from './types/Config';
|
|
15
|
+
export { ConsoleType as consoleType } from './types/ConsoleType';
|
package/dist/index.js
CHANGED
|
@@ -36,11 +36,11 @@ var type_detect_1 = __importDefault(require("type-detect"));
|
|
|
36
36
|
var ConsoleType_1 = require("./types/ConsoleType");
|
|
37
37
|
chai.should();
|
|
38
38
|
chai.use(sinon_chai_1.default);
|
|
39
|
-
function failOnConsoleError(
|
|
40
|
-
if (
|
|
39
|
+
function failOnConsoleError(_config) {
|
|
40
|
+
if (_config === void 0) { _config = {}; }
|
|
41
41
|
var spies;
|
|
42
|
-
(0, exports.validateConfig)(
|
|
43
|
-
config = (0, exports.createConfig)(
|
|
42
|
+
(0, exports.validateConfig)(_config);
|
|
43
|
+
var config = (0, exports.createConfig)(_config);
|
|
44
44
|
Cypress.on('window:before:load', function (window) {
|
|
45
45
|
spies = (0, exports.createSpies)(config, window.console);
|
|
46
46
|
});
|
|
@@ -75,13 +75,13 @@ var validateConfig = function (config) {
|
|
|
75
75
|
};
|
|
76
76
|
exports.validateConfig = validateConfig;
|
|
77
77
|
var createConfig = function (config) {
|
|
78
|
-
var _a, _b;
|
|
78
|
+
var _a, _b, _c;
|
|
79
79
|
return ({
|
|
80
|
-
excludeMessages: config.excludeMessages,
|
|
81
|
-
includeConsoleTypes: ((
|
|
80
|
+
excludeMessages: (_a = config.excludeMessages) !== null && _a !== void 0 ? _a : [],
|
|
81
|
+
includeConsoleTypes: ((_b = config.includeConsoleTypes) === null || _b === void 0 ? void 0 : _b.length)
|
|
82
82
|
? config.includeConsoleTypes
|
|
83
83
|
: [ConsoleType_1.ConsoleType.ERROR],
|
|
84
|
-
cypressLog: (
|
|
84
|
+
cypressLog: (_c = config.cypressLog) !== null && _c !== void 0 ? _c : false,
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
87
|
exports.createConfig = createConfig;
|
|
@@ -165,4 +165,5 @@ var cypressLogger = function (name, message) {
|
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
167
|
exports.cypressLogger = cypressLogger;
|
|
168
|
-
|
|
168
|
+
var ConsoleType_2 = require("./types/ConsoleType");
|
|
169
|
+
Object.defineProperty(exports, "consoleType", { enumerable: true, get: function () { return ConsoleType_2.ConsoleType; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cypress-fail-on-console-error",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "fail cypress test on console error",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"sinon-chai": "^3.7.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/chai": "4.3.
|
|
42
|
+
"@types/chai": "4.3.3",
|
|
43
43
|
"@types/expect": "24.3.0",
|
|
44
44
|
"@types/mocha": "9.1.1",
|
|
45
45
|
"@types/sinon": "10.0.13",
|
|
46
46
|
"@types/sinon-chai": "3.2.8",
|
|
47
47
|
"@types/type-detect": "4.0.1",
|
|
48
|
-
"cypress": "10.
|
|
48
|
+
"cypress": "10.7.0",
|
|
49
49
|
"mocha": "10.0.0",
|
|
50
50
|
"prettier": "2.7.1",
|
|
51
|
-
"prettier-plugin-organize-imports": "3.
|
|
51
|
+
"prettier-plugin-organize-imports": "3.1.1",
|
|
52
52
|
"rimraf": "3.0.2",
|
|
53
53
|
"ts-mocha": "10.0.0",
|
|
54
|
-
"typescript": "4.
|
|
54
|
+
"typescript": "4.8.3"
|
|
55
55
|
}
|
|
56
56
|
}
|