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 space between var1 instanceof var2 in output #1513

Closed
OmgImAlexis opened this issue Sep 10, 2017 · 3 comments
Closed

Missing space between var1 instanceof var2 in output #1513

OmgImAlexis opened this issue Sep 10, 2017 · 3 comments
Labels
bug current functionality does not work as desired help wanted

Comments

@OmgImAlexis
Copy link

Description

When a test fails while using test.true(var1 instanceof var2) the output removes the spaces.

Test Source

test('returns itself', t => {                
    t.true(t.context.script instanceof Script);
});

Error Message & Stack Trace

  1 failed
  1 rejection

  returns itself

  /Users/xo/code/@lad/mongoose/test/test.js:10

    9: test('returns itself', t => {                
   10:   t.true(t.context.script instanceof Script);
   11: });                                          

  Value is not `true`:

  false

  t.context.scriptinstanceofScript
  => false

Config

Copy the relevant section from package.json:

{
  "ava": {
  ...
  }
}

Command-Line Arguments

Copy your npm build scripts or the ava command used:

ava

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:

Node.js v8.4.0
darwin 16.7.0
ava 0.22.0
npm 5.3.0
@novemberborn novemberborn added bug current functionality does not work as desired feature: power-assert help wanted labels Sep 10, 2017
@novemberborn
Copy link
Member

Yea that's not great. Thanks for reporting it.

@codeslikejaggars
Copy link
Contributor

The same behavior affects any infix operator. Empty strings are also rendered invisible:

const val = 'some value';
test('fails with multiple === expressions', t => {
	t.false(val === '' && '' === val);
});
  1 failed

  fails with multiple === expressions

  /Users/path/ava/test/fixture/enhanced-assertion-spaces.js:5

   4: test('fails with multiple === expressions', t => {
   5:   t.true(val === '' && '' === val);
   6: });

  Value is not `true`:

  false

  val===&&===val
  => false

  val===
  => false

  val
  => 'some value'

One way to resolve this would be to use babel-generator in enhance-assert.js to regenerate the code from the AST, instead of concatenating the token values.

@OmgImAlexis
Copy link
Author

@codeslikejaggars @novemberborn thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired help wanted
Projects
None yet
Development

No branches or pull requests

4 participants