Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Commit 96ae1e8

Browse files
committed
feat: remove qemitter, passthrough-emitter and q-promise-utils
Use instead of these libraries written on q - anologue written on bluebird from gemini-core
1 parent 93a9b6a commit 96ae1e8

File tree

7 files changed

+14
-54
lines changed

7 files changed

+14
-54
lines changed

lib/capture-session/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
const inherit = require('inherit');
44
const _ = require('lodash');
55
const debug = require('debug');
6-
const promiseUtil = require('q-promise-utils');
6+
const Promise = require('bluebird');
7+
78
const ActionsBuilder = require('../tests-api/actions-builder');
89
const Browser = require('../browser');
910
const temp = require('../temp');
@@ -25,7 +26,7 @@ var CaptureSession = inherit({
2526

2627
runActions: function(actions) {
2728
this.log('run actions');
28-
return promiseUtil.sequence(actions, this.browser, new ActionsBuilder(this._postActions));
29+
return Promise.mapSeries(actions, (a) => a(this.browser, new ActionsBuilder(this._postActions)));
2930
},
3031

3132
prepareScreenshot: function(state) {
@@ -45,7 +46,7 @@ var CaptureSession = inherit({
4546
},
4647

4748
runPostActions: function() {
48-
return promiseUtil.sequence(this._postActions.reverse(), this.browser);
49+
return Promise.mapSeries(this._postActions.reverse(), (a) => a(this.browser));
4950
},
5051

5152
extendWithPageScreenshot: function(obj) {

lib/gemini.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
const debug = require('debug');
44
const chalk = require('chalk');
55
const _ = require('lodash');
6-
const PassthroughEmitter = require('./passthrough-emitter');
6+
const PassthroughEmitter = require('gemini-core').PassthroughEmitter;
77
const Promise = require('bluebird');
8-
const q = require('bluebird-q');
98
const pluginsLoader = require('plugins-loader');
109
const gracefulFs = require('graceful-fs');
1110

@@ -129,14 +128,14 @@ module.exports = class Gemini extends PassthroughEmitter {
129128

130129
options = _.assignIn(options, {paths});
131130

132-
return q(readTests(this, this.config, options)
131+
return readTests(this, this.config, options)
133132
.then((rootSuite) => {
134133
if (options.grep) {
135134
applyGrep_(options.grep, rootSuite);
136135
}
137136

138137
return new SuiteCollection(rootSuite.children);
139-
}));
138+
});
140139

141140
function applyGrep_(grep, suite) {
142141
if (!suite.hasStates) {
@@ -156,11 +155,11 @@ module.exports = class Gemini extends PassthroughEmitter {
156155
}
157156

158157
update(paths, options) {
159-
return q(this._run(StateProcessor.createScreenUpdater(options), paths, options));
158+
return this._run(StateProcessor.createScreenUpdater(options), paths, options);
160159
}
161160

162161
test(paths, options) {
163-
return q(this._run(StateProcessor.createTester(this.config), paths, options));
162+
return this._run(StateProcessor.createTester(this.config), paths, options);
164163
}
165164

166165
getScreenshotPath(suite, stateName, browserId) {

lib/passthrough-emitter.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

lib/runner/browser-runner/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const _ = require('lodash');
44
const url = require('url');
55
const path = require('path');
6-
const promiseUtils = require('q-promise-utils');
76
const BrowserAgent = require('gemini-core').BrowserAgent;
7+
const promiseUtils = require('gemini-core').promiseUtils;
88
const Runner = require('../runner');
99
const SuiteRunner = require('../suite-runner');
1010
const Events = require('../../constants/events');

lib/runner/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
'use strict';
22

3-
const Promise = require('bluebird');
43
const _ = require('lodash');
5-
const promiseUtils = require('q-promise-utils');
6-
74
const pool = require('../browser-pool');
85
const BrowserRunner = require('./browser-runner');
96
const Events = require('../constants/events');
107
const Coverage = require('../coverage');
118
const Runner = require('./runner');
129
const RunnerStats = require('../stats');
1310
const SuiteMonitor = require('../suite-monitor');
11+
const promiseUtils = require('gemini-core').promiseUtils;
1412

1513
module.exports = class TestsRunner extends Runner {
1614
static create(config, stateProcessor) {
@@ -37,7 +35,7 @@ module.exports = class TestsRunner extends Runner {
3735
}
3836

3937
run(suiteCollection) {
40-
return Promise.resolve(this.emitAndWait(Events.START_RUNNER, this))
38+
return this.emitAndWait(Events.START_RUNNER, this)
4139
.then(() => this.emit(Events.BEGIN, this._formatBeginEventData(suiteCollection)))
4240
.then(() => this._stateProcessor.prepare(this))
4341
.then(() => !this._cancelled && this._runTests(suiteCollection))

lib/runner/runner.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
'use strict';
22

3-
const PassthroughEmitter = require('../passthrough-emitter');
3+
const PassthroughEmitter = require('gemini-core').PassthroughEmitter;
44

55
module.exports = class Runner extends PassthroughEmitter {
66
run() {
77
throw 'Not implemented';
88
}
99
};
10-

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"debug": "^2.2.0",
2121
"fs-extra": "^0.30.0",
2222
"gemini-configparser": "^0.4.0",
23-
"gemini-core": "^1.3.0",
23+
"gemini-core": "gemini-testing/gemini-core#feature/emitters",
2424
"gemini-coverage": "^1.0.0",
2525
"graceful-fs": "^4.1.11",
2626
"handlebars": "^4.0.5",
@@ -32,8 +32,6 @@
3232
"node-fetch": "^1.6.3",
3333
"plugins-loader": "^1.0.1",
3434
"png-img": "^2.1.0",
35-
"q-promise-utils": "^1.1.0",
36-
"qemitter": "^1.0.0",
3735
"resolve": "^1.1.0",
3836
"sizzle": "^2.2.0",
3937
"source-map": "^0.5.3",

0 commit comments

Comments
 (0)