https://github.com/olton/latte
Latte - Framework for testing JavaScript/TypeScript with DOM and React support and built-in headless browser!
https://github.com/olton/latte
dom framework html javascript react react-testing test testing typescript
Last synced: 4 months ago
JSON representation
Latte - Framework for testing JavaScript/TypeScript with DOM and React support and built-in headless browser!
- Host: GitHub
- URL: https://github.com/olton/latte
- Owner: olton
- License: mit
- Created: 2024-09-25T13:43:44.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-22T05:47:59.000Z (9 months ago)
- Last Synced: 2025-03-22T06:26:07.893Z (9 months ago)
- Topics: dom, framework, html, javascript, react, react-testing, test, testing, typescript
- Language: JavaScript
- Homepage: https://latte.org.ua
- Size: 1.09 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 🥛 Latte
[](https://www.npmjs.com/package/@olton/latte)
[](https://opensource.org/licenses/MIT)

[](https://standardjs.com)
Latte (an abbreviation from `laconic testing`) is a testing framework designed for testing applications written in JavaScript and TypeScript.
---
### **It is designed to be straightforward to use, with a focus on speed, performance, and user information.**
---
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` or `expect`.
- 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` and `ts` 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` and `Debug` mode.
- Different Reporters: `lcov`, `console`, `html`, and `junit`.
- Open source and MIT license.
---
Documentation: https://latte.org.ua/
---

## Quick Reference
### Installation
```bash
npm install @olton/latte -D
```
### Usage
#### IntelliJ plugin
You can use Latte with IntelliJ IDEA, WebStorm, PhpStorm, and other JetBrains IDEs. The plugin is available in the [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/27190-latte-test-runner).
#### Command line
Create a test file with `*.test.js` or `*.test.ts` extension (for example).
You can use both of them in the same project.
```js
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.
```json
{
"scripts": {
"test": "latte"
}
}
```
#### Run tests
Now you can run tests with the following command:
```bash
npm test
```
or with `npx`:
```bash
npx latte
```
### Functions
- `describe` – create a test suite
- `it` - create a test case in suite
- `test` - create standalone test
- `expect` - create assertion
- `beforeEach` - run before each test case
- `afterEach` - run after each test case
- `beforeAll` - run before all test cases
- `afterAll` - run after all test cases
- `mock` - create mock function
### Matchers
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...
### TypeScript
To use `Latte` with TypeScript you need to install `tsx` package.
```bash
npm install -D tsx cross-env
```
and then
```json
{
"scripts": {
"test": "cross-env NODE_OPTIONS=\"--import tsx\" latte"
}
}
```
## License
Latte licensed under MIT license.
## Contributing
### Bug Reports & Feature Requests
Use issue tracker to report bugs or request new features.
---
### Code Standards
[](https://github.com/standard/standard)
---
## Support
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**](https://www.patreon.com/metroui)
+ [**Buy me a coffee**](https://buymeacoffee.com/pimenov)
---
Copyright (c) 2025 by [Serhii Pimenov](https://pimenov.com.ua)