No results for

Powered byAlgolia


suggest edits

toBeTruthy() is a comparison function that evaluates to true or false. It must be called in the chain after the t.expect(value) or .and(value).

When toBeTruthy() evaluates to false, the chain is broken, and the test is marked as failed. When the chain is broken, further checks inside of the test are omitted.


FunkFunk object


import { describe } from '';
import http from 'k6/http';
export default function testSuite() {
describe('Basic test', (t) => {
t.expect(1).toBeTruthy(); // true
t.expect("hello").toBeTruthy(); // true
t.expect(3.14).toBeTruthy(); // true
t.expect([]).toBeTruthy(); // true
t.expect({}).toBeTruthy(); // true
t.expect(true).toBeTruthy(); // true
t.expect("1").toBeTruthy(); // true
t.expect(0).toBeTruthy(); // false
t.expect(undefined).toBeTruthy(); // false
t.expect(NaN).toBeTruthy(); // false
t.expect(false).toBeTruthy(); // false
t.expect("").toBeTruthy(); // false