npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

testee-client

v0.5.6

Published

Testee testing framework client adapters

Downloads

1,092

Readme

Testee client adapters

Build Status

Testee client side adapters for Mocha, QUnit and Jasmine (1 and 2) that convert test results into Feathers service calls (runs, suites, tests and coverages).

Initializing options

In your test page you can set Testee options using window.Testee.

BaseURL

By default, the client will use the url the tests are running at (window.location.protocol + '//' + window.location.host). you can change this using the baseURL option:

<script type="text/javascript">
window.Testee = {
  baseURL: 'http://testee-server.com/'
}
</script>
<script type="text/javascript" src="testee-client.js"></script>

Provider

By default, the client will use socket.io to make Feathers service calls. You can change this to use REST by specifying the provider option:

<script type="text/javascript">
window.Testee = {
  provider: {
    type: 'rest'
  }
}
</script>
<script type="text/javascript" src="testee-client.js"></script>

Socket

You can provide your own socket instance to make Feathers service calls using the socket option:

<script type="text/javascript" src="http://testee-server.com/socket.io/socket.io.js"></script>
<script type="text/javascript">
window.Testee = {
  socket: io('http://testee-server.com/')
}
</script>
<script type="text/javascript" src="testee-client.js"></script>

Asynchronous Loading

When loading files asynchronously, you need to stop your testing framework from running until all test files are loaded. Then call window.Testee.init(). If you're using steal, you can use the steal-mocha, steal-qunit or steal-jasmine libraries.

Mocha

<script type="text/javascript" src="//best/cdn/ever/mocha/mocha.js"></script>
<script type="text/javascript" src="testee-client.js"></script>
<script type="text/javascript">
define(['tests.js'], function() {
  if(window.Testee) {
    window.Testee.init();
  }
  mocha.run();
});
</script>

QUnit

<script type="text/javascript" src="//best/cdn/ever/qunit.js"></script>
<script type="text/javascript" src="testee-client.js"></script>
<script type="text/javascript">
QUnit.config.autorun = false;
define(['tests.js'], function() {
  if(window.Testee) {
    window.Testee.init();
  }
  QUnit.load();
});
</script>

Jasmine

<script type="text/javascript" src="//best/cdn/ever/jasmine/jasmine.js"></script>
<script type="text/javascript" src="//best/cdn/ever/jasmine/jasmine-html.js"></script>
<script type="text/javascript" src="//best/cdn/ever/jasmine/boot.js"></script>
<script type="text/javascript" src="testee-client.js"></script>
<script type="text/javascript">
define(['tests.js'], function() {
  if(window.Testee) {
    window.Testee.init();
  }
  window.onload();
});
</script>

A test flow:

var ids = {
  run: guid(),
  suite: guid(),
  childsuite: guid(),
  testpass: guid(),
  testfail: guid()
};

Testee.start({
  id: ids.run,
  environment : navigator.userAgent,
  runner : 'Jasmine'
});

Testee.suite({
  "title": "Main test suite title",
  "root": true, // If it is the root level test suite
  "id": ids.suite,
  "parent": runId
});

Testee.suite({
  "title": "Child test suite",
  "parent": ids.suite,
  "id": ids.childsuite
});

Testee.test({
  "title": "The test title",
  "parent": ids.childsuite, // Parent suite id
  "id": ids.testpass
});

Testee.pass({
  "duration": 0,
  "id": ids.testpass
});

Testee.testEnd({
  "id": ids.testspass
});

Testee.test({
  "title": "A failing test",
  "parent": ids.childsuite,
  "id": ids.testfail
});

Testee.fail({
  "id": ids.testfail,
  "err": {
    "message": "expected 1 to equal 2",
    "stack": "Error: expected 1 to equal 2\n    at Assertion.assert (/Users/daff/Development/node/swarmling/node_modules/expect.js/expect.js:99:13)\n    CUSTOM STACK TRACE"
  }
});

Testee.testEnd({
  "id": ids.testfail
});

Testee.suiteEnd({
  "id": ids.childsuite
});

Testee.suiteEnd({
  "id": ids.suite
});

Testee.end({});