Skip to content

Make writing "within a test" and "t.XXX" matchers easier: #72

Closed
@jamestalmage

Description

@jamestalmage

We have this code construct everywhere:

CallExpression: function (node) {
  // only check if we are within a test file, and if this CallExpression is within a test.
  if (!ava.isTestFile || !ava.currentTestNode) {
    return;
  }
}

I propose we add some sugar to ava.merge() that allows something like this:

'CallExpression:inTest': function (node) {

},
'VariableDeclaration:inTestFile': function (node) {

},
'CallExpression:inTest:inTestFile': function (node) {

},

While we are at it, we should define one (specifically for CallExpression), that checks the callee is a MemberExpression of the form t.XXX:

'AssertionCallExpression:inTest': function (node) {

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions