CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.8.12 (changelog, source)
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.

Predicates

getTestFile

Gets the test file for f with stem extension stemExt, where stemExt is “test” or “spec”. That is, a 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.