CodeQL library for JavaScript
Search

Module Testing

Provides classes for working with JavaScript testing frameworks.

Import path

import semmle.javascript.frameworks.Testing

Imports

TestingCustomizations
javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

xUnit

Provides classes for working with xUnit.js tests.

Predicates

getTestFile

Gets the test file for f with stem extension stemExt. That is, a file named file named <base>.<stemExt>.<ext> in the same directory as f which is named <base>.<ext>.

Classes

AvaTest

An AVA test, that is, an invocation of require('ava').test.

BDDTest

A BDD-style test (as used by Mocha.js, Unit.js, Jasmine and others), that is, an invocation of a function named it where the first argument is a string and the second argument is a function.

CucumberTest

A Cucumber test, that is, an invocation of require('cucumber').

JestTest

A Jest test, that is, an invocation of a global function named test where the first argument is a string and the second argument is a function. Additionally, the invocation happens in a file named <base>.test.<ext> in the same directory as a file named <base>.<ext>.

QUnitTest

A QUnit test, that is, an invocation of QUnit.test.

TapeTest

A tape test, that is, an invocation of require('tape').test.

Test

A syntactic construct that represents a single test.

XUnitTest

A xUnit.js fact, that is, a function annotated with an xUnit.js Fact annotation.