question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider allowing `null` and `undefined` for doesNotExist

See original GitHub issue

Consider the following

assert.dom(findMatching('button', 'Suspend')).doesNotExist('cannot suspend user')

When there is no button (undefined) this is output:

Expected: "Element div#ember-testing.ember-application[data-ol-has-click-handler] does not exist"
Result: "Element div#ember-testing.ember-application[data-ol-has-click-handler] exists once"

It also means I have to bypass qunit dom, like this:

assert.dom(findMatching('button', 'Restore')).exists('can restore user')
assert.ok(!findMatching('button', 'Suspend'), 'cannot suspend user')

…I see there are tests for this exact scenario, but I wonder if you would consider changing it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
patsy-issacommented, Jun 15, 2020

Opened https://github.com/simplabs/qunit-dom/issues/736 to track this potential false positive.

Thank you for reporting it 👍

1reaction
amk221commented, May 29, 2020

Thanks. That’s not something I want to use. No problem if you want to close the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to check for both `null` and `undefined`?
Using a juggling-check, you can test both null and undefined in one hit: if (x == null) {. If you use a strict-check,...
Read more >
Handling null and undefined in JavaScript | by Eric Elliott
In some statically typed languages, you can say that null and undefined are illegal values, and let your programming language throw a TypeError ......
Read more >
7 Tips to Handle undefined in JavaScript
A detailed article about 'undefined' keyword in JavaScript. 7 tips on how to handle correctly 'undefined' and increase code durability.
Read more >
Optional chaining (?.) - JavaScript - MDN Web Docs - Mozilla
If the object accessed or function called is undefined or null, it returns undefined instead of throwing an error.
Read more >
Documentation - TypeScript 3.7
You can think of this feature - the ?? operator - as a way to “fall back” to a default value when dealing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found