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

Report error when parsing for line number selection #3062

Merged
merged 1 commit into from Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/reporters/default.js
Expand Up @@ -220,6 +220,9 @@ export default class Reporter {
this.lineNumberErrors.push(event);

this.write(colors.information(`${figures.warning} Could not parse ${this.relativeFile(event.testFile)} for line number selection`));
this.lineWriter.writeLine();
this.lineWriter.writeLine(colors.errorStack(event.err.stack));
this.lineWriter.writeLine();
break;
}

Expand Down
14 changes: 13 additions & 1 deletion test-tap/reporters/default.edgecases.v12.log
@@ -1,8 +1,20 @@

---tty-stream-chunk-separator
⚠ Could not parse ast-syntax-error.cjs for line number selection
---tty-stream-chunk-separator

SyntaxError: Unexpected token (3:11)
 at Parser.pp$4.raise (~/node_modules/acorn/dist/acorn.js:3462:15)
 at Parser.pp$9.unexpected (~/node_modules/acorn/dist/acorn.js:756:10)
 at Parser.pp$5.parseExprAtom (~/node_modules/acorn/dist/acorn.js:2837:12)
 at Parser.pp$5.parseExprSubscripts (~/node_modules/acorn/dist/acorn.js:2629:21)
 at Parser.pp$5.parseMaybeUnary (~/node_modules/acorn/dist/acorn.js:2595:19)
 at Parser.pp$5.parseExprOps (~/node_modules/acorn/dist/acorn.js:2522:21)
 at Parser.pp$5.parseMaybeConditional (~/node_modules/acorn/dist/acorn.js:2505:21)
 at Parser.pp$5.parseMaybeAssign (~/node_modules/acorn/dist/acorn.js:2472:21)
 at Parser.pp$8.parseVar (~/node_modules/acorn/dist/acorn.js:1299:26)
 at Parser.pp$8.parseVarStatement (~/node_modules/acorn/dist/acorn.js:1163:10)

---tty-stream-chunk-separator
Uncaught exception in ast-syntax-error.cjs

~/test-tap/fixture/report/edgecases/ast-syntax-error.cjs:3
Expand Down
14 changes: 13 additions & 1 deletion test-tap/reporters/default.edgecases.v14.log
@@ -1,8 +1,20 @@

---tty-stream-chunk-separator
⚠ Could not parse ast-syntax-error.cjs for line number selection
---tty-stream-chunk-separator

SyntaxError: Unexpected token (3:11)
 at Parser.pp$4.raise (~/node_modules/acorn/dist/acorn.js:3462:15)
 at Parser.pp$9.unexpected (~/node_modules/acorn/dist/acorn.js:756:10)
 at Parser.pp$5.parseExprAtom (~/node_modules/acorn/dist/acorn.js:2837:12)
 at Parser.pp$5.parseExprSubscripts (~/node_modules/acorn/dist/acorn.js:2629:21)
 at Parser.pp$5.parseMaybeUnary (~/node_modules/acorn/dist/acorn.js:2595:19)
 at Parser.pp$5.parseExprOps (~/node_modules/acorn/dist/acorn.js:2522:21)
 at Parser.pp$5.parseMaybeConditional (~/node_modules/acorn/dist/acorn.js:2505:21)
 at Parser.pp$5.parseMaybeAssign (~/node_modules/acorn/dist/acorn.js:2472:21)
 at Parser.pp$8.parseVar (~/node_modules/acorn/dist/acorn.js:1299:26)
 at Parser.pp$8.parseVarStatement (~/node_modules/acorn/dist/acorn.js:1163:10)

---tty-stream-chunk-separator
Uncaught exception in ast-syntax-error.cjs

SyntaxError: Unexpected token 'do'
Expand Down
14 changes: 13 additions & 1 deletion test-tap/reporters/default.edgecases.v16.log
@@ -1,8 +1,20 @@

---tty-stream-chunk-separator
⚠ Could not parse ast-syntax-error.cjs for line number selection
---tty-stream-chunk-separator

SyntaxError: Unexpected token (3:11)
 at Parser.pp$4.raise (~/node_modules/acorn/dist/acorn.js:3462:15)
 at Parser.pp$9.unexpected (~/node_modules/acorn/dist/acorn.js:756:10)
 at Parser.pp$5.parseExprAtom (~/node_modules/acorn/dist/acorn.js:2837:12)
 at Parser.pp$5.parseExprSubscripts (~/node_modules/acorn/dist/acorn.js:2629:21)
 at Parser.pp$5.parseMaybeUnary (~/node_modules/acorn/dist/acorn.js:2595:19)
 at Parser.pp$5.parseExprOps (~/node_modules/acorn/dist/acorn.js:2522:21)
 at Parser.pp$5.parseMaybeConditional (~/node_modules/acorn/dist/acorn.js:2505:21)
 at Parser.pp$5.parseMaybeAssign (~/node_modules/acorn/dist/acorn.js:2472:21)
 at Parser.pp$8.parseVar (~/node_modules/acorn/dist/acorn.js:1299:26)
 at Parser.pp$8.parseVarStatement (~/node_modules/acorn/dist/acorn.js:1163:10)

---tty-stream-chunk-separator
Uncaught exception in ast-syntax-error.cjs

SyntaxError: Unexpected token 'do'
Expand Down
14 changes: 13 additions & 1 deletion test-tap/reporters/default.edgecases.v18.log
@@ -1,8 +1,20 @@

---tty-stream-chunk-separator
⚠ Could not parse ast-syntax-error.cjs for line number selection
---tty-stream-chunk-separator

SyntaxError: Unexpected token (3:11)
 at pp$4.raise (~/node_modules/acorn/dist/acorn.js:3462:15)
 at pp$9.unexpected (~/node_modules/acorn/dist/acorn.js:756:10)
 at pp$5.parseExprAtom (~/node_modules/acorn/dist/acorn.js:2837:12)
 at pp$5.parseExprSubscripts (~/node_modules/acorn/dist/acorn.js:2629:21)
 at pp$5.parseMaybeUnary (~/node_modules/acorn/dist/acorn.js:2595:19)
 at pp$5.parseExprOps (~/node_modules/acorn/dist/acorn.js:2522:21)
 at pp$5.parseMaybeConditional (~/node_modules/acorn/dist/acorn.js:2505:21)
 at pp$5.parseMaybeAssign (~/node_modules/acorn/dist/acorn.js:2472:21)
 at pp$8.parseVar (~/node_modules/acorn/dist/acorn.js:1299:26)
 at pp$8.parseVarStatement (~/node_modules/acorn/dist/acorn.js:1163:10)

---tty-stream-chunk-separator
Uncaught exception in ast-syntax-error.cjs

SyntaxError: Unexpected token 'do'
Expand Down