GithubHelp home page GithubHelp logo

Comments (13)

ryanstout avatar ryanstout commented on July 18, 2024

So I hate when people +1 issues/PR's, but here we go:

+1

from opal-rspec.

wied03 avatar wied03 commented on July 18, 2024

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.

ryanstout avatar ryanstout commented on July 18, 2024

@wied03 awesome, that would really help me out a lot :-) best of luck on it. Thanks

from opal-rspec.

wied03 avatar wied03 commented on July 18, 2024

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.

ryanstout avatar ryanstout commented on July 18, 2024

@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.

wied03 avatar wied03 commented on July 18, 2024

@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.

wied03 avatar wied03 commented on July 18, 2024

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.

wied03 avatar wied03 commented on July 18, 2024

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.

wied03 avatar wied03 commented on July 18, 2024

New branch of code is @ https://github.com/wied03/opal-rspec/tree/opal-0.8-other/rspec31_async_subject, almost done

from opal-rspec.

ryanstout avatar ryanstout commented on July 18, 2024

@wied03 nice work :-)

from opal-rspec.

wied03 avatar wied03 commented on July 18, 2024

#21

from opal-rspec.

wied03 avatar wied03 commented on July 18, 2024

@ryanstout @adambeynon - This is in master now, so this issue can probably be closed

from opal-rspec.

elia avatar elia commented on July 18, 2024

👍

from opal-rspec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.