Inconsistent Mixin testing behavior
See original GitHub issueWe’re trying to test a Mixin using the pattern generated by ember g mixin
. But we’re seeing inconsistent behavior.
The test is easy:
const ObjectWithMixin = Ember.Object.extend(Mixin);
const objToTest = ObjectWithMixin.create();
return this.PUBLIC_API.forEach(api=> {
return ok(objUnderTest.actions[api]);
});
this.PUBLIC_API
is defined in the beforeEach
hook of the module
call:
module('Unit | Mixin | auto completeable', {
beforeEach() {
return this.PUBLIC_API = ['actionX', 'actionY'];
}
});
Simple. All we’re doing here is testing that the actions defined on the mixin are incorporated into the object into which it’s being mixed in.
And yet when we run this via IrisUI we see two conflicting behaviors.
Sometimes objToTest
in the test has its actions
property defined; but other times it is undefined and the test fails referencing an undefined object. It seems to be there’s some race condition here in how the objects are created, but it’s got us somewhat stumped. Is this a known bug, or is there some other workaround?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
In Python can one implement mixin behavior without using ...
ruby - In Python can one implement mixin behavior without using inheritance? - Stack Overflow. Stack Overflow for Teams – Start collaborating ...
Read more >digitalmars.D.learn - mixin template scope inconsistency?
Template mixin scope seems to have a weird behavior: I don't understand 'WEIRD(1)' and ... (){ auto a=A(12); } void test1(){ writeln("test.begin"); mixin...
Read more >Testing Mixins in Isolation with Minitest and RSpec - Semaphore
In this tutorial, we will revisit what mixins are, identify mixin types, and learn how we can test mixins with the most popular...
Read more >Should @infix and @mixin be soft modifiers? - #8 by arturopala ...
Behavior only, i.e., does not impact elaboration nor type checking, nor even interop, but can affect run-time behavior: @strictfp , @volatile , lazy;...
Read more >Sass Guidelines
The last remaining inconsistencies are gathered and listed by myself under ... of CSS compatibility and making sure every general behavior is consistent....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ya, if that is the case, there isn’t much to be done here. This was a pretty weird thing that was done in Ember 1.x (and deprecated). Moving to Ember 2.0 should remove the inconsistency.
Closing…
It literally changes somewhat randomly between test reloads. In any case, adding
seems to fix the issue.