oxc/tasks/coverage
Arnaud Barré d9cc429d4a
fix(parser): parse empty method declaration as TSEmptyBodyFunctionExpression (#2574)
That a tricky one, because it's time to decide what does ESTree
compliant means in the TS world (re #2463)

This code:

```ts
export declare class ByteBuffer {
  clear(): void;
     // ^^
}
```

- Is parsed by
[Babel](d38530204e)
as `FunctionExpression` with an empty body
- By
[TS-ESLint](4ea4e2feb5)
as
[TSEmptyBodyFunctionExpression](https://github.com/typescript-eslint/typescript-eslint/pull/1289)
- By
[OXC](https://oxc-project.github.io/oxc/playground/?code=3YCAAIC1gICAgICAgICyHorESipoTXPdvBaE9wxzlOraoWs19SUxDvdcwSVU0kbBO2b7ppX3x2P5IhQlpGHOYEHNCEfLf38HUICA)
as `TSDeclareFunction`

I'm going the easy way to fix this to the Babel way, but I think
following TS-ESLint would make sense. There is an [open babel
issue](https://github.com/babel/babel/issues/13878) about that.

Edit: Ok that not so easy and require updating some logic.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-03-03 13:59:17 +00:00
..
misc feat(parser): parse import attributes in TSImportType (#2436) 2024-02-19 12:26:42 +08:00
src feat(codegen): add sourcemap (#2565) 2024-03-03 14:44:49 +08:00
Cargo.toml chore(deps): update rust crates (#2503) 2024-02-26 10:38:11 +08:00
codegen_babel.snap feat(Codegen): Improve codegen (#2460) 2024-02-21 14:41:57 +08:00
codegen_misc.snap feat(parser): parse import attributes in TSImportType (#2436) 2024-02-19 12:26:42 +08:00
codegen_runtime_test262.snap fix(codegen): when async is on the left-hand side of a for-of, wrap it in parentheses (#2407) 2024-02-13 22:42:23 +08:00
codegen_sourcemap.snap feat(codegen): add sourcemap (#2565) 2024-03-03 14:44:49 +08:00
codegen_test262.snap feat(Codegen): Improve codegen (#2460) 2024-02-21 14:41:57 +08:00
codegen_typescript.snap feat(Codegen): Improve codegen (#2460) 2024-02-21 14:41:57 +08:00
minifier_babel.snap chore: update snapshots 2023-11-28 16:27:10 +08:00
minifier_test262.snap chore: update snapshots 2024-01-22 19:16:09 +08:00
parser_babel.snap feat(semantic): add check for duplicate class elements in checker (#2455) 2024-02-21 14:10:19 +08:00
parser_misc.snap feat(parser): parse import attributes in TSImportType (#2436) 2024-02-19 12:26:42 +08:00
parser_test262.snap refactor: use our forked version of miette::Reporter for tests (#2266) 2024-02-02 16:15:31 +08:00
parser_typescript.snap fix(parser): parse empty method declaration as TSEmptyBodyFunctionExpression (#2574) 2024-03-03 13:59:17 +00:00
prettier_babel.snap feat(ast): add "abstract" type to MethodDefinition and PropertyDefinition (#2536) 2024-02-28 17:33:11 +08:00
prettier_misc.snap feat(parser): parse import attributes in TSImportType (#2436) 2024-02-19 12:26:42 +08:00
prettier_test262.snap feat(coverage): add prettier idempotency test (#2402) 2024-02-12 15:30:16 +08:00
prettier_typescript.snap feat(ast): add "abstract" type to MethodDefinition and PropertyDefinition (#2536) 2024-02-28 17:33:11 +08:00
README.md chore(coverage): remove mention of git submodule update --remote in README 2023-04-01 10:57:25 +08:00

Coverage

The parser is tested against test262, babel and TypeScript for conformance.

Note: tests against regexp are disabled for now.

Clone the test files beforehand:

git submodule update --init

Development

# full run
cargo coverage
cargo coverage js # for test262
cargo coverage babel # for babel
cargo coverage ts # for typescript

# run in watch
cargo watch -x 'coverage js'

# filter for a file path
cargo watch -x 'coverage js --filter filter-file-path'