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

Add pure web example for sites like jsfiddle #44

Open
devpaul opened this issue Jun 7, 2017 · 3 comments
Open

Add pure web example for sites like jsfiddle #44

devpaul opened this issue Jun 7, 2017 · 3 comments

Comments

@devpaul
Copy link

devpaul commented Jun 7, 2017

As a user, I'd like to be able to write intern tests that run purely in the browser. For example, I may want to produce a test for a project like DefintielyTyped that prevents me from adding a package.json file to a sub-directory; or I may want to share tests on jsfiddle, dojo.io, or in workshops.

Long story short, it'd be awesome to get an example that can show people that intern can do this and how to get started ❤️

Here's my started code. I haven't yet gotten it working due to theintern/intern#747

<!DOCTYPE html>
<html lang="en">
<head>
	<title>Unit Tests</title>
	<script src="https://unpkg.com/intern@next/browser/intern.js"></script>
</head>
</html>
@jason0x43
Copy link
Member

Presumably the test suites would still be in the repo?

@devpaul
Copy link
Author

devpaul commented Jun 11, 2017

Is it possible to write tests in the HTML file?

@jason0x43
Copy link
Member

jason0x43 commented Jun 12, 2017

It is. You can currently do something like:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Unit Tests</title>
    <script src="https://unpkg.com/intern@next/browser/intern.js"></script>
    <script>
        var registerSuite = intern.getPlugin('interface.object').registerSuite;
        registerSuite('suiteA', {
            test1: function () { ... },
            test2: function () { ... }
        });
        intern.configure({ reporters: 'html' });
        intern.run();
    </script>
</head>
</html>

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

2 participants