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

BigInt literals cause tests to not be recognized #4

Closed
broofa opened this issue Aug 1, 2019 · 7 comments
Closed

BigInt literals cause tests to not be recognized #4

broofa opened this issue Aug 1, 2019 · 7 comments

Comments

@broofa
Copy link

broofa commented Aug 1, 2019

With node@10.15.3 (i.e. BigInt support enabled) and ava@2.2.0:

Runs test and passes

test('main', t => t.is(123, 123));

Output: 1 test passed [06:42:47]

test('main', t => t.is(123n, 123n));

Output: ✖ Couldn't find any files to test

@broofa
Copy link
Author

broofa commented Aug 1, 2019

FWIW, discovered this while looking into sindresorhus/fnv1a#3

@novemberborn
Copy link
Member

I'm pretty sure I have working tests that use BigInt literals. Could you share a reproduction?

@novemberborn
Copy link
Member

(By which I mean a Gist or GitHub repo I can clone and run locally.)

@broofa
Copy link
Author

broofa commented Aug 2, 2019

kieffer@MacBook-Pro$ ava --version
2.2.0

kieffer@MacBook-Pro$ cat ava_bigint.js
import test from 'ava';

test('main', t => {
	t.is(123, 123);
	t.is(123n, 123n);
});

kieffer@MacBook-Pro$ ava ava_bigint.js



  ✖ Internal error
  SyntaxError: /Users/kieffer/work/ava_bigint.js: Identifier directly after number (5:9)

    3 | test('main', t => {
    4 | 	t.is(123, 123);
  > 5 | 	t.is(123n, 123n);
      | 	        ^
    6 | });
    7 |
  SyntaxError: /Users/kieffer/work/ava_bigint.js: Identifier directly after number (5:9)

    3 | test('main', t => {
    4 | 	t.is(123, 123);
  > 5 | 	t.is(123n, 123n);
      | 	        ^
    6 | });
    7 |
      at Parser.raise (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:6325:17)
      at Parser.readNumber (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:7215:12)
      at Parser.getTokenFromCode (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:6949:14)
      at Parser.nextToken (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:6525:12)
      at Parser.next (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:6465:10)
      at Parser.parseSubscript (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8509:12)
      at Parser.parseSubscripts (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8433:19)
      at Parser.parseExprSubscripts (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8422:17)
      at Parser.parseMaybeUnary (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8392:21)
      at Parser.parseExprOps (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8267:23)
      at Parser.parseMaybeConditional (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8240:23)
      at Parser.parseMaybeAssign (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8187:21)
      at Parser.parseExpression (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:8135:23)
      at Parser.parseStatementContent (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:9958:23)
      at Parser.parseStatement (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:9829:17)
      at Parser.parseBlockOrModuleBlockBody (/Users/kieffer/work/node_modules/@babel/parser/lib/index.js:10405:25)


kieffer@MacBook-Pro$

@novemberborn
Copy link
Member

Ah of course, I'm using this while having disabled our Babel pipeline. We need to add the syntax plugin so Babel is able to parse sources with these literals. There's probably a couple other stage-4 things we need to add in.

@novemberborn novemberborn transferred this issue from avajs/ava Dec 24, 2019
@broofa
Copy link
Author

broofa commented Jan 5, 2020

Closed, as in "resolved" or "wont fix" or...?

@novemberborn
Copy link
Member

As in, looks like this should already be working. With v2 even. I think.

Note that this is now part of a new package to be used with AVA v3. Which will be out soon (unofficially, I'm too tired to write the release notes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants