Comments (13)
So I hate when people +1 issues/PR's, but here we go:
+1
from opal-rspec.
I'm not sure it's the best approach, but I'm working on a branch I could turn into a PR here: https://github.com/wied03/opal-rspec/tree/opal-0.8-other/rspec31_async_fix
what works:
- Basic runner that uses promises along with example_group monkey patches and and a new AsyncExample class
- Test failures show up properly in results instead of uncaught exceptions (kind of a hack, but already had to do this with RSpec 3.1/lack of diff support for fail_with anyways)
I still need to get:
- example hierarchy working properly
- pending/skipped within the example working
- Support an async subject and/or example return value as you mention above so that the 'done' stuff is not necessary
- Ensure other specs besides async_spec.rb work (and all of the other async specs I'm toggling on and off right now as I test)
- See if there is a better way to test my work via CI besides manual inspection (test the test framework)
from opal-rspec.
@wied03 awesome, that would really help me out a lot :-) best of luck on it. Thanks
from opal-rspec.
Here's an update on that branch:
What works:
- If the example returns a promise, the runner waits for that promise to complete before continuing, example code from the checked in+pushed specs:
async 'matcher succeeds properly' do
promise = Promise.new
delay 1 do
1.should == 1
promise.resolve
end
promise
end
- Example group hierarchy working properly
- Pending/skipped within the example working
- Ensured other specs besides async_spec.rb work (and all of the other async specs I'm toggling on and off right now as I test)
- Added a basic Rake task that wraps the opal:spec test and ensures that we fail when we're supposed to and checks to make sure the right tests failed. This is kind of rudimentary I know, but before this, there was no way to verify that opal-rspec was failing when it should
- Test failures show up properly in results instead of uncaught exceptions (kind of a hack, but already had to do this with RSpec 3.1/lack of diff support for fail_with anyways)
- Basic runner that uses promises along with example_group monkey patches and and a new AsyncExample class
I still need to:
- Support an async subject
- Skipping an entire example_group may need some work (see /opal/opal/rspec/async/example_group.rb)
- Fail fast may need some work
from opal-rspec.
@wied03 so I thought I would ask this since your in the code right now. Is there any possibility of not needing to use async
(and just using it
) My main issue is I need to run the same specs in both mri and opal. I could just patch rspec when its running on mri to add async, but it would be great if it could work either way. Thanks, keep up the good work :-)
from opal-rspec.
@ryanstout - There is certainly appeal in doing that. I guess it depends how invasive we should be re: monkey patching RSpec. It's already invasive though to do what I've done, so not going further because it would be invasive might be a hollow argument.
@adambeynon or @elia - any opinions?
from opal-rspec.
The more I look at this, to get async before/subject working how it should (and I would consider those important), it might be easier just to go ahead and make 'it' run async by default. Otherwise there is 2 of everything with a mix, etc. and that's even more confusing
from opal-rspec.
I've gone ahead and converted stuff to be async aware by default. I've added additional specs and have more of an understanding of promises, so I've been able to simplify my modifications. A little more work needs to be done before it's ready for a test drive
from opal-rspec.
New branch of code is @ https://github.com/wied03/opal-rspec/tree/opal-0.8-other/rspec31_async_subject, almost done
from opal-rspec.
@wied03 nice work :-)
from opal-rspec.
from opal-rspec.
@ryanstout @adambeynon - This is in master now, so this issue can probably be closed
from opal-rspec.
👍
from opal-rspec.
Related Issues (20)
- Compiler/Line Number Metadata HOT 4
- Performance Improvement Ideas HOT 4
- issues with opal 0.10.0 HOT 4
- Results Reporting Sync/Async HOT 1
- filter_run_excluding not working? HOT 1
- how to require gem or a source file ? HOT 5
- stub_const doesn't work quite the same in opal 0.9 HOT 9
- Opal-Master Compatibility
- Sprockets HOT 1
- Support random order HOT 2
- Opal::RSpec::RakeTask HOT 4
- `expect_any_instance_of` is not working when using opal master HOT 5
- Trying to run phantomjs or in-browser tests throws Sprockets::FileNotFound HOT 3
- Get ` cannot load such file -- rake` when run test in browser. HOT 2
- Could not found jquery when use node as task runner. HOT 1
- spec not worked with opal 0.11. (chrome headless) HOT 11
- Unable to require 'nodejs' in spec HOT 2
- uninitialized constant OPAL_PLATFORM HOT 8
- Headless Chrome support HOT 3
- Can you release a new version? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opal-rspec.