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

missing comma can cause false positive #442

Closed
shaunlebron opened this issue Sep 5, 2018 · 4 comments
Closed

missing comma can cause false positive #442

shaunlebron opened this issue Sep 5, 2018 · 4 comments
Labels
semver-major: breaking change Any breaking changes

Comments

@shaunlebron
Copy link

shaunlebron commented Sep 5, 2018

I was amused to see this passing after I left a comma out:

test("foo", t => {
  t.deepEqual(
    [1,2]  // <-- notice a comma is missing after "]"
    [3]
  );
  t.end();
});

[3] becomes a property lookup for [1,2], returning undefined

t.deepEqual(undefined) is true.

Proposing: t.deepEqual (et al) should fail if only one arg is passed.

@ORESoftware
Copy link

whoa wtf

@ljharb
Copy link
Collaborator

ljharb commented Sep 5, 2018

That's delightful, but if anyone was relying on the implicit undefined there, it'd be a breaking change. I'd be happy to make that change whenever we're doing a major otherwise, but I don't think it's worth it to do one just for that.

@ORESoftware
Copy link

if(arguments.length < 2) throw 'one of those missing commas amirite?'

@ljharb ljharb added the semver-major: breaking change Any breaking changes label Jul 29, 2019
@ljharb
Copy link
Collaborator

ljharb commented Dec 27, 2019

Since node's assert does this check, we can too in v5.

@ljharb ljharb closed this as completed in 89f2010 Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-major: breaking change Any breaking changes
Projects
None yet
Development

No branches or pull requests

3 participants