Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/javascript-api/jslib/testing/non-retrying-assertions/tobefalsy.md (append .md) or send Accept: text/markdown to /docs/k6/latest/javascript-api/jslib/testing/non-retrying-assertions/tobefalsy/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
toBeFalsy()
The toBeFalsy() method asserts that a value is falsy in JavaScript. A value is falsy if it converts to false when evaluated in a boolean context.
Syntax
expect(actual).toBeFalsy();
expect(actual).not.toBeFalsy();Returns
| Type | Description |
|---|---|
| void | No return value |
Description
The toBeFalsy() method checks if a value is falsy. In JavaScript, the following values are falsy:
false0-00n(BigInt)""(empty string)nullundefinedNaN
All other values are truthy.
Usage
import { expect } from 'https://jslib.k6.io/k6-testing/0.6.1/index.js';
export default function () {
expect(false).toBeFalsy();
expect(0).toBeFalsy();
expect(-0).toBeFalsy();
expect(0n).toBeFalsy();
expect('').toBeFalsy();
expect(null).toBeFalsy();
expect(undefined).toBeFalsy();
expect(NaN).toBeFalsy();
}Was this page helpful?
Related resources from Grafana Labs

