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

ember-qunit-nice-errors

v1.2.1

Published

Because expected true, result false is not enough!

Downloads

19,542

Readme

ember-qunit-nice-errors

Build Status

Because expected true, result false is not enough!

This addon aims to improve the testing experience by defining a nice message on those asserts that don't have one set by you.

Installation

As easy as ember install ember-qunit-nice-errors

Example

When you have a test with a failing assertion and no custom message, the default error doesn't say much. As you can see by the following example test and the default ouput below:

import { module, test } from 'qunit';

module('Unit | ok test');

test('it works', function(assert) {
  assert.ok(1===3);
});

Test failed output without addon

But with ember-qunit-nice-errors the message is way nicer! Test failed output with addon

Configuration

showFileInfo

If you want your error messages to include the original test file, line and column where the failed assertion is, just add the following configuration on your config/environment.js file:

ENV['ember-qunit-nice-errors'] = {
  showFileInfo: true
};
Before
assert.ok(false)
After
assert.ok(false) at my-app/tests/unit/ok-test.js:17:2

Also note you can enable this only for certain environments:

if (environment === 'development') {
  ENV['ember-qunit-nice-errors'] = {
    showFileInfo: true
  };
}

completeExistingMessages

If you fully trust us you can add this option to replace all assertions within your project tests, just add this to your configuration on your config/environment.js file:

ENV['ember-qunit-nice-errors'] = {
  completeExistingMessages: true
};

Don't worry, the override will still show your orginal messages, it is not a destructive operation!

The following example illustrates what is the result of using the option completeExistingMessages.

Before
assert.ok(1 === 1, 'one should be one');
After
assert.ok(1 === 1, "assert.ok(1 === 1, 'one should be one')");

include

By default only test files that match the glob **/*-test.js are processed by the addon. You can include/exclude files from being processed by setting custom glob rules.

ENV['ember-qunit-nice-errors'] = {
  include: ["**/*-foo.js"]
};

Note that by changing the include configuration you are overriding the default glob **/*-test.js. If you want to include files and keep the default rules, you can write it as follows.

ENV['ember-qunit-nice-errors'] = {
  include: [
    "**/*-test.js",
    "**/*-foo.js",
  ]
};

You can use any expression supported by minimatch, see https://www.npmjs.com/package/minimatch for more info.

exclude

You can exclude specific test files from beign processed by adding exclude rules.

ENV['ember-qunit-nice-errors'] = {
  exclude: ["**/my-special-test.js"]
};

You can use any expression supported by minimatch, see https://www.npmjs.com/package/minimatch for more info.

Supported assertions

We are currently supporting all the assertions provided by QUnit, those are:

  • ok
  • notOk
  • equal
  • notEqual
  • deepEqual
  • notDeepEqual
  • propEqual
  • notPropEqual
  • strictEqual
  • notStrictEqual

Maintainers

Credits

We got inspiration from

License

ember-qunit-nice-errors is licensed under the MIT license.

See LICENSE for the full license text.