Skip to main content

TSQuery test

Betterer ships several built-in tests to get you started. Check out the implementations for inspiration for your own tests!

@betterer/tsquery

Use this test to incrementally remove TSQuery matches from your codebase. See the TSQuery documentation for more details about the query syntax.

import { tsquery } from '@betterer/tsquery';

export default {
'no raw console.log': () =>
tsquery('CallExpression > PropertyAccessExpression[expression.name="console"][name.name="log"]').include(
'./src/**/*.ts'
)
};

@betterer/tsquery is a BettererFileTest, so you can use include, exclude, only, and skip.