Skip to content

Make line number selection work with TS and JSX syntax #3065

Open
@novemberborn

Description

@novemberborn

Line number selection relies on parsing the test file. This only supports JS syntax:

function parse(file) {
// Avoid loading these until we actually need to select tests by line number.
const acorn = require('acorn');
const walk = require('acorn-walk');
const ast = acorn.parse(fs.readFileSync(file, 'utf8'), {
ecmaVersion: 11,
locations: true,
sourceType: 'module',
});

Acorn has a plugin for JSX. If we want to use that we need to decide whether to add it to AVA's dependencies or how else we register it.

There is no plugin for TypeScript. We'd have to work out a solution so that line number selection can work without using @ava/typescript. See #3064 for making it work with @ava/typescript.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions