Latte (an abbreviation from laconic testing
) is a testing framework designed for testing applications written in JavaScript and TypeScript.
Latte is an alternative to other testing frameworks like Jest, Mocha, and Jasmine with the following core features:
- Config free.
- Functions for creating test cases
it
,test
,describe
,suite
orexpect
. - Setup and Teardown functions
beforeEach
,afterEach
,beforeAll
,afterAll
. - React Components testing (
jsx
syntax supported). - HTML Components testing (DOM built-in).
- Headless browser in scope
B
for test web pages and remote saites. - Asynchronous code testing with
async/await
. - Mock functions.
- Big set (100+) of built-in matchers.
- TypeScript testing out of the box. You can use both
js
andts
test files in the same project. - Simple extend
Expect
class for adding your matchers. - A lot of expects in one test case.
- Built-in coverage tool.
Verbose
,Watching
andDebug
mode.- Different Reporters:
lcov
,console
,html
, andjunit
. - Open source and MIT license.
npm install @olton/latte -D
You can use Latte with IntelliJ IDEA, WebStorm, PhpStorm, and other JetBrains IDEs. The plugin is available in the JetBrains Marketplace.
Create a test file with *.test.js
or *.test.ts
extension (for example).
You can use both of them in the same project.
function hello() {
return "Hello"
}
describe(`Common tests suite`, () => {
it(`says hello`, () => {
return expect(hello()).toBe("Hello")
})
})
test(`Bad test 2 !== 1`, () => {
return expect(2).toBe(1)
})
Update package.json
to run tests with latte
command.
{
"scripts": {
"test": "latte"
}
}
Now you can run tests with the following command:
npm test
or with npx
:
npx latte
describe
– create a test suiteit
- create a test case in suitetest
- create standalone testexpect
- create assertionbeforeEach
- run before each test caseafterEach
- run after each test casebeforeAll
- run before all test casesafterAll
- run after all test casesmock
- create mock function
Latte contains a big set of built-in matchers:
- A simple comparison
- A strong comparison
- Type checking
- Number checking
- String checking
- Array checking
- Object checking
- Color checking
- IP, Email, Url checking
- JSON, XML checking
- Date, RegExp, Symbol checking
- Function checking
- HTML element checking
- and more...
To use Latte
with TypeScript you need to install tsx
package.
npm install -D tsx cross-env
and then
{
"scripts": {
"test": "cross-env NODE_OPTIONS=\"--import tsx\" latte"
}
}
Latte licensed under MIT license.
Use issue tracker to report bugs or request new features.
If you like this project, please consider supporting it by:
- Star this repository on GitHub
- Sponsor this project on GitHub Sponsors
- PayPal to
serhii@pimenov.com.ua
. - Patreon
- Buy me a coffee
Copyright (c) 2025 by Serhii Pimenov