@onehat/events 1.6.6 → 1.6.7
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
package/src/EventEmitter.js
CHANGED
|
@@ -118,7 +118,7 @@ export default class EventEmitter extends EE {
|
|
|
118
118
|
/**
|
|
119
119
|
* Sets checkReturnValues, so we can utilize the return values of handlers.
|
|
120
120
|
*/
|
|
121
|
-
setCheckReturnValues
|
|
121
|
+
setCheckReturnValues(bool = true) {
|
|
122
122
|
this.checkReturnValues = bool;
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -128,7 +128,7 @@ export default class EventEmitter extends EE {
|
|
|
128
128
|
* @param {string} name - Event name
|
|
129
129
|
* @return {boolean} isChanged - Whether event was successfully added
|
|
130
130
|
*/
|
|
131
|
-
registerEvent
|
|
131
|
+
registerEvent(name) {
|
|
132
132
|
return this.registerEvents([name]);
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -138,7 +138,7 @@ export default class EventEmitter extends EE {
|
|
|
138
138
|
* @param {array} names - Event names
|
|
139
139
|
* @return {boolean} isChanged - Whether (any) events were successfully added
|
|
140
140
|
*/
|
|
141
|
-
registerEvents
|
|
141
|
+
registerEvents(names) {
|
|
142
142
|
const count = this._registeredEvents.length;
|
|
143
143
|
this._registeredEvents = _.uniq(_.concat(this._registeredEvents, names));
|
|
144
144
|
return this._registeredEvents.length !== count;
|
|
@@ -149,7 +149,7 @@ export default class EventEmitter extends EE {
|
|
|
149
149
|
* @param {string} name - Event name
|
|
150
150
|
* @return {boolean} isChanged - Whether event was successfully removed
|
|
151
151
|
*/
|
|
152
|
-
unregisterEvent
|
|
152
|
+
unregisterEvent(name) {
|
|
153
153
|
return this.unregisterEvents([name]);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -159,7 +159,7 @@ export default class EventEmitter extends EE {
|
|
|
159
159
|
* @param {array} names - Event names
|
|
160
160
|
* @return {boolean} isChanged - Whether (any) events were successfully removed
|
|
161
161
|
*/
|
|
162
|
-
unregisterEvents
|
|
162
|
+
unregisterEvents(names) {
|
|
163
163
|
const count = this._registeredEvents.length;
|
|
164
164
|
_.pullAll(this._registeredEvents, names);
|
|
165
165
|
return this._registeredEvents.length !== count;
|
|
@@ -169,7 +169,7 @@ export default class EventEmitter extends EE {
|
|
|
169
169
|
* Determines whether or not an event with supplied name is registered
|
|
170
170
|
* @return {bool} isRegisteredEvent
|
|
171
171
|
*/
|
|
172
|
-
isRegisteredEvent
|
|
172
|
+
isRegisteredEvent(name) {
|
|
173
173
|
if (_.indexOf(this._registeredEvents, name) === -1) {
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
@@ -180,7 +180,7 @@ export default class EventEmitter extends EE {
|
|
|
180
180
|
* Gets array of names of all registered event types.
|
|
181
181
|
* @return {array} _registeredEvents - Event names
|
|
182
182
|
*/
|
|
183
|
-
getRegisteredEvents
|
|
183
|
+
getRegisteredEvents() {
|
|
184
184
|
return this._registeredEvents;
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -190,7 +190,7 @@ export default class EventEmitter extends EE {
|
|
|
190
190
|
* Any events emitted while paused will be added to a queue.
|
|
191
191
|
* @return this
|
|
192
192
|
*/
|
|
193
|
-
pauseEvents
|
|
193
|
+
pauseEvents() {
|
|
194
194
|
this.eventsPaused = true;
|
|
195
195
|
return this;
|
|
196
196
|
}
|
|
@@ -202,7 +202,7 @@ export default class EventEmitter extends EE {
|
|
|
202
202
|
* If false, then queued events will be discarded. Defaults to false.
|
|
203
203
|
* @return this
|
|
204
204
|
*/
|
|
205
|
-
resumeEvents
|
|
205
|
+
resumeEvents(emitQueuedEvents = false) {
|
|
206
206
|
this.eventsPaused = false;
|
|
207
207
|
if (emitQueuedEvents) {
|
|
208
208
|
_.forEach(this._eventQueue, (args) => {
|
|
@@ -217,7 +217,7 @@ export default class EventEmitter extends EE {
|
|
|
217
217
|
* Relays events from one object to another. A relayed event will appear to be emitted
|
|
218
218
|
* from the relaying object (this), not from the origin object.
|
|
219
219
|
*/
|
|
220
|
-
relayEventsFrom
|
|
220
|
+
relayEventsFrom(origin, events, prefix = '') {
|
|
221
221
|
if (_.isString(events)) {
|
|
222
222
|
events = [events];
|
|
223
223
|
}
|
|
@@ -247,7 +247,7 @@ export default class EventEmitter extends EE {
|
|
|
247
247
|
* - const listener = () => {};
|
|
248
248
|
* - emitter.addListeners(events, listener);
|
|
249
249
|
*/
|
|
250
|
-
addListeners
|
|
250
|
+
addListeners(events, listener) {
|
|
251
251
|
_.each(events, (event) => {
|
|
252
252
|
this.on(event, listener);
|
|
253
253
|
});
|
|
@@ -256,7 +256,7 @@ export default class EventEmitter extends EE {
|
|
|
256
256
|
/**
|
|
257
257
|
* Alias for addListeners
|
|
258
258
|
*/
|
|
259
|
-
ons
|
|
259
|
+
ons(events, listener) {
|
|
260
260
|
return this.addListeners(events, listener);
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -270,7 +270,7 @@ export default class EventEmitter extends EE {
|
|
|
270
270
|
* - const listener = () => {};
|
|
271
271
|
* - emitter.addListeners(events, listener);
|
|
272
272
|
*/
|
|
273
|
-
removeListeners
|
|
273
|
+
removeListeners(events, listener) {
|
|
274
274
|
_.each(events, (event) => {
|
|
275
275
|
this.off(event, listener);
|
|
276
276
|
});
|
|
@@ -279,7 +279,7 @@ export default class EventEmitter extends EE {
|
|
|
279
279
|
/**
|
|
280
280
|
* Alias for removeListeners
|
|
281
281
|
*/
|
|
282
|
-
offs
|
|
282
|
+
offs(events, listener) {
|
|
283
283
|
return this.removeListeners(events, listener);
|
|
284
284
|
}
|
|
285
285
|
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "JSON schema for https://cypress.io test runner cypress.json file. Details at https://on.cypress.io/configuration",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"baseUrl" : {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"description": "Url used as prefix for cy.visit() or cy.request() command’s url. Example http://localhost:3030 or https://test.my-domain.com"
|
|
9
|
-
},
|
|
10
|
-
"env": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"description": "Any values to be set as environment variables",
|
|
13
|
-
"body": {}
|
|
14
|
-
},
|
|
15
|
-
"ignoreTestFiles": {
|
|
16
|
-
"type": ["string", "array"],
|
|
17
|
-
"items": {
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"description": "A String or Array of glob patterns used to ignore test files that would otherwise be shown in your list of tests. Cypress uses minimatch with the options: {dot: true, matchBase: true}. We suggest using http://globtester.com to test what files would match."
|
|
21
|
-
},
|
|
22
|
-
"numTestsKeptInMemory": {
|
|
23
|
-
"type": "number",
|
|
24
|
-
"default": 50,
|
|
25
|
-
"description": "The number of tests for which snapshots and command data are kept in memory. Reduce this number if you are experiencing high memory consumption in your browser during a test run."
|
|
26
|
-
},
|
|
27
|
-
"port": {
|
|
28
|
-
"type": "number",
|
|
29
|
-
"default": null,
|
|
30
|
-
"description": "Port used to host Cypress. Normally this is a randomly generated port"
|
|
31
|
-
},
|
|
32
|
-
"reporter": {
|
|
33
|
-
"type": "string",
|
|
34
|
-
"default": "spec",
|
|
35
|
-
"description": "The reporter used when running headlessly or in CI. See https://on.cypress.io/reporters"
|
|
36
|
-
},
|
|
37
|
-
"reporterOptions": {
|
|
38
|
-
"type": "object",
|
|
39
|
-
"default": null,
|
|
40
|
-
"description": "The reporter options used. Supported options depend on the reporter. See https://on.cypress.io/reporters#Reporter-Options"
|
|
41
|
-
},
|
|
42
|
-
"watchForFileChanges": {
|
|
43
|
-
"type": "boolean",
|
|
44
|
-
"default": true,
|
|
45
|
-
"description": "Whether Cypress will watch and restart tests on test file changes"
|
|
46
|
-
},
|
|
47
|
-
"defaultCommandTimeout": {
|
|
48
|
-
"type": "number",
|
|
49
|
-
"default": 4000,
|
|
50
|
-
"description": "Time, in milliseconds, to wait until most DOM based commands are considered timed out"
|
|
51
|
-
},
|
|
52
|
-
"execTimeout": {
|
|
53
|
-
"type": "number",
|
|
54
|
-
"default": 60000,
|
|
55
|
-
"description": "Time, in milliseconds, to wait for a system command to finish executing during a cy.exec() command"
|
|
56
|
-
},
|
|
57
|
-
"pageLoadTimeout": {
|
|
58
|
-
"type": "number",
|
|
59
|
-
"default": 60000,
|
|
60
|
-
"description": "Time, in milliseconds, to wait for page transition events or cy.visit(), cy.go(), cy.reload() commands to fire their page load events"
|
|
61
|
-
},
|
|
62
|
-
"requestTimeout": {
|
|
63
|
-
"type": "number",
|
|
64
|
-
"default": 5000,
|
|
65
|
-
"description": "Time, in milliseconds, to wait for an XHR request to go out in a cy.wait() command"
|
|
66
|
-
},
|
|
67
|
-
"responseTimeout": {
|
|
68
|
-
"type": "number",
|
|
69
|
-
"default": 30000,
|
|
70
|
-
"description": "Time, in milliseconds, to wait until a response in a cy.request(), cy.wait(), cy.fixture(), cy.getCookie(), cy.getCookies(), cy.setCookie(), cy.clearCookie(), cy.clearCookies(), and cy.screenshot() commands"
|
|
71
|
-
},
|
|
72
|
-
"fileServerFolder": {
|
|
73
|
-
"type": "string",
|
|
74
|
-
"default": "root project folder",
|
|
75
|
-
"description": "Path to folder where application files will attempt to be served from"
|
|
76
|
-
},
|
|
77
|
-
"fixturesFolder": {
|
|
78
|
-
"type": ["string", "boolean"],
|
|
79
|
-
"default": "cypress/fixtures",
|
|
80
|
-
"description": "Path to folder containing fixture files (Pass false to disable)"
|
|
81
|
-
},
|
|
82
|
-
"integrationFolder": {
|
|
83
|
-
"type": "string",
|
|
84
|
-
"default": "cypress/integration",
|
|
85
|
-
"description": "Path to folder containing integration test files"
|
|
86
|
-
},
|
|
87
|
-
"pluginsFile": {
|
|
88
|
-
"type": ["string", "boolean"],
|
|
89
|
-
"default": "cypress/plugins/index.js",
|
|
90
|
-
"description": "Path to plugins file. (Pass false to disable)"
|
|
91
|
-
},
|
|
92
|
-
"screenshotsFolder": {
|
|
93
|
-
"type": "string",
|
|
94
|
-
"default": "cypress/screenshots",
|
|
95
|
-
"description": "Path to folder where screenshots will be saved from cy.screenshot() command or after a headless or CI run’s test failure"
|
|
96
|
-
},
|
|
97
|
-
"supportFile": {
|
|
98
|
-
"type": ["string", "boolean"],
|
|
99
|
-
"default": "cypress/support/index.js",
|
|
100
|
-
"description": "Path to file to load before test files load. This file is compiled and bundled. (Pass false to disable)"
|
|
101
|
-
},
|
|
102
|
-
"videosFolder": {
|
|
103
|
-
"type": "string",
|
|
104
|
-
"default": "cypress/videos",
|
|
105
|
-
"description": "Path to folder where videos will be saved after a headless or CI run"
|
|
106
|
-
},
|
|
107
|
-
"trashAssetsBeforeRuns": {
|
|
108
|
-
"type": "boolean",
|
|
109
|
-
"default": true,
|
|
110
|
-
"description": "Whether Cypress will trash assets within the screenshotsFolder and videosFolder before headless test runs."
|
|
111
|
-
},
|
|
112
|
-
"videoCompression": {
|
|
113
|
-
"type": ["number", "boolean"],
|
|
114
|
-
"default": 32,
|
|
115
|
-
"description": "The quality setting for the video compression, in Constant Rate Factor (CRF). The value can be false to disable compression or a value between 0 and 51, where a lower value results in better quality (at the expense of a higher file size)."
|
|
116
|
-
},
|
|
117
|
-
"video": {
|
|
118
|
-
"type": "boolean",
|
|
119
|
-
"default": true,
|
|
120
|
-
"description": "Whether Cypress will record a video of the test run when running headlessly."
|
|
121
|
-
},
|
|
122
|
-
"videoUploadOnPasses": {
|
|
123
|
-
"type": "boolean",
|
|
124
|
-
"default": true,
|
|
125
|
-
"description": "Whether Cypress will upload the video to the Dashboard even if all tests are passing. This applies only when recording your runs to the Dashboard. Turn this off if you’d like the video uploaded only when there are failing tests."
|
|
126
|
-
},
|
|
127
|
-
"chromeWebSecurity": {
|
|
128
|
-
"type": "boolean",
|
|
129
|
-
"default": true,
|
|
130
|
-
"description": "Whether Chrome Web Security for same-origin policy and insecure mixed content is enabled. Read more about this at https://on.cypress.io/web-security"
|
|
131
|
-
},
|
|
132
|
-
"userAgent": {
|
|
133
|
-
"type": "string",
|
|
134
|
-
"default": null,
|
|
135
|
-
"description": "Enables you to override the default user agent the browser sends in all request headers. User agent values are typically used by servers to help identify the operating system, browser, and browser version. See User-Agent MDN Documentation for example user agent values here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent"
|
|
136
|
-
},
|
|
137
|
-
"blacklistHosts": {
|
|
138
|
-
"type": ["string", "array"],
|
|
139
|
-
"items": {
|
|
140
|
-
"type": "string"
|
|
141
|
-
},
|
|
142
|
-
"default": null,
|
|
143
|
-
"description": "A String or Array of hosts that you wish to block traffic for. Please read the notes for examples on using this https://on.cypress.io/configuration#blacklistHosts"
|
|
144
|
-
},
|
|
145
|
-
"modifyObstructiveCode": {
|
|
146
|
-
"type": "boolean",
|
|
147
|
-
"default": true,
|
|
148
|
-
"description": "Whether Cypress will search for and replace obstructive JS code found in .js or .html files that prevents Cypress from working. Please read the notes for more information on this setting. https://on.cypress.io/configuration#modifyObstructiveCode"
|
|
149
|
-
},
|
|
150
|
-
"viewportHeight": {
|
|
151
|
-
"type": "number",
|
|
152
|
-
"default": 660,
|
|
153
|
-
"description": "Default height in pixels for the application under tests’ viewport (Override with cy.viewport() command)"
|
|
154
|
-
},
|
|
155
|
-
"viewportWidth": {
|
|
156
|
-
"type": "number",
|
|
157
|
-
"default": 1000,
|
|
158
|
-
"description": "Default width in pixels for the application under tests’ viewport. (Override with cy.viewport() command)"
|
|
159
|
-
},
|
|
160
|
-
"animationDistanceThreshold": {
|
|
161
|
-
"type": "number",
|
|
162
|
-
"default": 5,
|
|
163
|
-
"description": "The distance in pixels an element must exceed over time to be considered animating"
|
|
164
|
-
},
|
|
165
|
-
"waitForAnimations": {
|
|
166
|
-
"type": "boolean",
|
|
167
|
-
"default": true,
|
|
168
|
-
"description": "Whether to wait for elements to finish animating before executing commands"
|
|
169
|
-
},
|
|
170
|
-
"projectId": {
|
|
171
|
-
"type": "string",
|
|
172
|
-
"default": null,
|
|
173
|
-
"description": "A 6 character string to identify this project with Dashboard service. See https://on.cypress.io/dashboard-service#Identification"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const webpack = require('@cypress/webpack-preprocessor'),
|
|
2
|
-
webpackOptions = {
|
|
3
|
-
mode: 'development',
|
|
4
|
-
devtool: 'module-source-map', // See https://survivejs.com/webpack/building/source-maps/
|
|
5
|
-
module: {
|
|
6
|
-
rules: [
|
|
7
|
-
{
|
|
8
|
-
test: /\.(js|jsx|mjs)$/,
|
|
9
|
-
exclude: /node_modules/,
|
|
10
|
-
loader: 'babel-loader',
|
|
11
|
-
options: {
|
|
12
|
-
cacheDirectory: false,
|
|
13
|
-
presets: [
|
|
14
|
-
'@babel/preset-env'
|
|
15
|
-
],
|
|
16
|
-
plugins: [
|
|
17
|
-
'@babel/plugin-proposal-class-properties',
|
|
18
|
-
'@babel/plugin-transform-runtime'
|
|
19
|
-
],
|
|
20
|
-
sourceType: 'unambiguous',
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
module.exports = (on, config) => {
|
|
28
|
-
on('file:preprocessor', webpack({
|
|
29
|
-
webpackOptions,
|
|
30
|
-
watchOptions: {},
|
|
31
|
-
}));
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|