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

Facade for plugins #589

Merged
merged 1 commit into from
Sep 21, 2016
Merged

Facade for plugins #589

merged 1 commit into from
Sep 21, 2016

Conversation

DudaGod
Copy link
Member

@DudaGod DudaGod commented Sep 7, 2016

No description provided.

@levonet levonet added the review label Sep 7, 2016
@coveralls
Copy link

coveralls commented Sep 7, 2016

Coverage Status

Coverage increased (+0.09%) to 83.691% when pulling 473bb5e on add/facade-for-plugins into bb234cf on master.

@coveralls
Copy link

coveralls commented Sep 7, 2016

Coverage Status

Coverage increased (+0.09%) to 83.691% when pulling 4b4ec2b on add/facade-for-plugins into bb234cf on master.

load: function(gemini, options) {
_.chain(options.system.plugins)
load: (gemini) => {
_.chain(gemini.config.system.plugins)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_.chain(gemini.config.system.plugins) => _(gemini.config.system.plugins) 

@DudaGod DudaGod force-pushed the add/facade-for-plugins branch from 4b4ec2b to 49a6e91 Compare September 7, 2016 22:00
@coveralls
Copy link

coveralls commented Sep 7, 2016

Coverage Status

Coverage increased (+0.09%) to 83.691% when pulling 49a6e91 on add/facade-for-plugins into bb234cf on master.

return plugin.opts === false;
})
.map(function(plugin) {
.map((pair) => ({name: pair[0], opts: pair[1]}))
Copy link
Contributor

@tormozz48 tormozz48 Sep 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.map(_.curry(_.zipObject)(['name', 'opts']))

/cc @eGavr

Copy link
Contributor

@eGavr eGavr Sep 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Андрюх, +1 за знание лодаша :)

но исходный вариант более понятный

Copy link
Contributor

@j0tunn j0tunn Sep 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут можно вообще проще:

_(gemini.config.system.plugins)
    .map((opts, name) => ({name, opts}))

@tormozz48
Copy link
Contributor

🆗


Plugin example with the listening on the events:
```javascript
module.exports = function(gemini, options) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а че не стрелочные функции в примере?

@coveralls
Copy link

coveralls commented Sep 14, 2016

Coverage Status

Coverage increased (+0.2%) to 83.784% when pulling 5281ba8 on add/facade-for-plugins into bb234cf on master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 83.784% when pulling 5281ba8 on add/facade-for-plugins into bb234cf on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 83.784% when pulling 5281ba8 on add/facade-for-plugins into bb234cf on master.

@coveralls
Copy link

coveralls commented Sep 16, 2016

Coverage Status

Coverage increased (+0.1%) to 83.799% when pulling 1813a7a on add/facade-for-plugins into c970c52 on master.

@coveralls
Copy link

coveralls commented Sep 16, 2016

Coverage Status

Coverage increased (+0.1%) to 83.799% when pulling 1813a7a on add/facade-for-plugins into c970c52 on master.

.fin(() => this.emit(RunnerEvents.END));
.fin(() => {
this.emit(RunnerEvents.END);
this.emit(RunnerEvents.END_RUNNER, this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

событие END_RUNNER должно кидаться раньше, чем END

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в текущей логике это не так. Вообще событие END не должно бросаться, но это дело версии 5.x, кстати куда мы там пишем что нужно оторвать в новой версии? Надо дописать

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На BEGIN вообще не нашел, чтобы кто то подписывался в gemini, а на END подписывается только flat репортер.
Пишем в этот issue #555. Кажется ему номер 555 не случайно достался =)
Дописал, что нужно выпилить события BEGIN и END


const proxyquire = require('proxyquire');

let plugins;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а зачем эта переменная вне дескрайба?


return run_()
.then(() => assert.callOrder(begin, end));
.then(() => assert.callOrder(begin, startRunner, end, endRunner));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и тут у тебя должен тест упасть. Хотя, кажется, по этому тесту видно, что последовательность событий неправильная

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нет, не падает.

return getTests(paths, options)
.then((suiteCollection) => {
return this.emitAndWait(RunnerEvents.START_RUNNER, runner)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кстати, скорее всего этим мы сломали обратную совместимость. Теперь те, кто работают с gemini через API (например gemini-gui) не имеют возможности подписаться на события от gemini. Так что имеет смысл пробрасывать сообщения от раннера наверх. Но тогда встает вопрос о необходимости фасада как такового

Copy link
Member Author

@DudaGod DudaGod Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, теперь gemini-gui не может подписаться на события от gemini, проверил.
Что делаем?
Костыляем? )

Костыльнул, но что то мне вообще не нравится так.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

мы можем пробрасывать наружу только START_RUNNER и END_RUNNER как это было раньше

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То есть я правильно понял. Что нужно, чтобы не раннер эмитил события START_RUNNER и END_RUNNER, а gemini?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

скажем так: gemini тоже должен их эммитить. Ну типа ок, мы унесли их в runner, но gemini должен их пробрасывать наверх

@DudaGod DudaGod force-pushed the add/facade-for-plugins branch from c656c61 to faec51b Compare September 19, 2016 14:54
@coveralls
Copy link

coveralls commented Sep 19, 2016

Coverage Status

Coverage increased (+0.1%) to 83.95% when pulling faec51b on add/facade-for-plugins into 3eae590 on master.

@DudaGod
Copy link
Member Author

DudaGod commented Sep 19, 2016

/cc @j0tunn @sipayRT

@coveralls
Copy link

coveralls commented Sep 19, 2016

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling 9bc435d on add/facade-for-plugins into 3eae590 on master.

@j0tunn j0tunn changed the title Add/facade for plugins Facade for plugins Sep 20, 2016
@@ -37,6 +41,7 @@ module.exports = class TestsRunner extends Runner {
const suites = suiteCollection.allSuites();

return q.fcall(() => {
this.emit(RunnerEvents.START_RUNNER, this);
this.emit(RunnerEvents.BEGIN, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @SevInf привет. Не помнишь кто подписывается на данное событие? В gemini и плагинах не получается найти.

@coveralls
Copy link

coveralls commented Sep 20, 2016

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling 3906430 on add/facade-for-plugins into 3eae590 on master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling 3906430 on add/facade-for-plugins into 3eae590 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling 3906430 on add/facade-for-plugins into 3eae590 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling 3906430 on add/facade-for-plugins into 3eae590 on master.

});

afterEach(() => sandbox.restore());

it('should passthrough "START_RUNNER" and "END_RUNNER" events', () => {
sandbox.stub(temp, 'init');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай стаб наверх вынесем

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я не могу его вынести, он тогда ломает другие тесты.

const onStartRunner = sandbox.spy().named('onStartRunner');
runner.on(RunnerEvents.START_RUNNER, onStartRunner);

return run_().then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

странное форматирование :)

const onEndRunner = sandbox.spy().named('onEndRunner');
runner.on(RunnerEvents.END_RUNNER, onEndRunner);

return run_().then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и снова странное форматирование

@eGavr
Copy link
Contributor

eGavr commented Sep 21, 2016

/ok

@j0tunn
Copy link
Contributor

j0tunn commented Sep 21, 2016

/ok

@DudaGod DudaGod force-pushed the add/facade-for-plugins branch from eac2182 to ab7ea60 Compare September 21, 2016 11:34
@coveralls
Copy link

coveralls commented Sep 21, 2016

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling ab7ea60 on add/facade-for-plugins into 712ce38 on master.

@coveralls
Copy link

coveralls commented Sep 21, 2016

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling ab7ea60 on add/facade-for-plugins into 712ce38 on master.

@coveralls
Copy link

coveralls commented Sep 21, 2016

Coverage Status

Coverage increased (+0.1%) to 83.985% when pulling ceaea7f on add/facade-for-plugins into 712ce38 on master.

@DudaGod DudaGod force-pushed the add/facade-for-plugins branch from ceaea7f to ab7ea60 Compare September 21, 2016 23:08
@DudaGod DudaGod merged commit e3c4fc0 into master Sep 21, 2016
@DudaGod DudaGod deleted the add/facade-for-plugins branch September 21, 2016 23:24
@@ -37,6 +41,7 @@ module.exports = class TestsRunner extends Runner {
const suites = suiteCollection.allSuites();

return q.fcall(() => {
this.emit(RunnerEvents.START_RUNNER, this);
Copy link
Contributor

@j0tunn j0tunn Sep 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DudaGod Дима, вот это беда. Мы эммитили это событие (как и END_RUNNER) через emitAndWait. А теперь мы не ждем результата. Это очень плохо, т.к. на это событие может выполняться (и выполняется) всякая тяжелая инициализация + если в этой инициализации есть ошибки, мы их не видим

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants