Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove browser support #62

Closed
davidchambers opened this issue Sep 14, 2015 · 12 comments
Closed

remove browser support #62

davidchambers opened this issue Sep 14, 2015 · 12 comments

Comments

@davidchambers
Copy link
Owner

This project could be simplified significantly were it to target Node exclusively. Is anyone out there running doctest in the browser?

@danse
Copy link
Collaborator

danse commented Sep 14, 2015

Hey, a lot of activity on this recently, that's good news! Personally i never run this in the browser, but i often used it in order to test code written for the browser

@davidchambers
Copy link
Owner Author

Hey, a lot of activity on this recently, that's good news!

I had a busy weekend. :)

Personally i never run this in the browser, but i often used it in order to test code written for the browser

Could you elaborate? Do the modules you're testing reference window anywhere, or are they CommonJS modules which can be tested in Node?

@danse
Copy link
Collaborator

danse commented Sep 14, 2015

I was mostly referring to module systems which can be used in Browsers. We added support for AMD in the past and i used it, with a project based on Require. Nowadays i am working almost all the time with Angular, which kind of prevents me from using Doctest. Hopefully in the future modularisation in Javascript will follow just one standard, but currently there is still some fragmentation, so i think that keeping room for alternative module systems still has quite some value. Of course this needs to be balanced with the cost in terms of complexity

@davidchambers
Copy link
Owner Author

Thanks for providing more detail, Francesco. :)

I'm going to put together a pull request just to see how much infrastructure we could remove from the project if we removed the ability to run doctests in the browser.

@danse
Copy link
Collaborator

danse commented Sep 14, 2015

Sure! 🌞 As far as i remember, our approach for supporting custom running environments in the past was based on mocking necessary objects like module.exports or require. This might work also for window, angular or others. If this is implemented as a preliminary step, it does not affect the logic used eventually to extract, run and check the tests. This approach has several limitations and is not very elegant, but it might help somebody to actually use Doctest in their projects, without a big cost in terms of complexity in Doctest's code

@davidchambers
Copy link
Owner Author

As far as i remember, our approach for supporting custom running environments in the past was based on mocking necessary objects like module.exports or require. This might work also for window, angular or others.

That's a good idea. I'd like to wait for a concrete use case before doing so. I currently only use doctest to test Node modules, so my needs are already met. :)

I'm going to put together a pull request just to see how much infrastructure we could remove from the project if we removed the ability to run doctests in the browser.

master...no-browser

@danse
Copy link
Collaborator

danse commented Sep 14, 2015

master...no-browser

I see that you are keeping support for different module systems there, so all fine :)

@texastoland
Copy link

Have you seen Doctest.js? It's specialized for browser (if you deprecate it) and never quite got Node support.

@davidchambers
Copy link
Owner Author

I'm aware of that project. It seems overly complex to me. I want a way to ensure the examples in my documentation stay up to date; I've no desire to replace unit tests with doctests. Doctests are great for pure, synchronous functions. Asynchronous functions are better tested by unit tests.

@texastoland
Copy link

👍 I meant if you drop browser support you could point users there.

@davidchambers
Copy link
Owner Author

Yep. Thanks for the suggestion! :)

@danse
Copy link
Collaborator

danse commented Dec 14, 2015

@dnalot Doctest.js does not provide actual doctests, and it has no commits in the last two years. If testing in the browser has even a minimal utility, this project can easily keep supporting it

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

No branches or pull requests

3 participants