0.17.2 • Published 8 months ago

@olton/latte v0.17.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

🥛 Latte

NPM Version License: MIT NPM Downloads JavaScript Style Guide

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.


Demo

Quick Reference

Installation

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.

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.

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"
    }
}

Run tests

Now you can run tests with the following command:

npm test

or with npx:

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.

npm install -D tsx cross-env

and then

{
    "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

JavaScript Style Guide


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
  • Buy me a coffee

Copyright (c) 2025 by Serhii Pimenov

0.17.2

8 months ago

0.17.1

8 months ago

0.17.0

8 months ago

0.16.2

9 months ago

0.16.0

9 months ago

0.15.0

9 months ago

0.14.1

9 months ago

0.14.0

9 months ago

0.13.0

9 months ago

0.12.0

10 months ago

0.11.2

10 months ago

0.11.1

10 months ago

0.11.0

10 months ago

0.10.2

10 months ago

0.10.1

10 months ago

0.10.0

10 months ago

0.9.0

10 months ago

0.8.0

10 months ago

0.7.0

10 months ago

0.6.0

11 months ago

0.5.0

11 months ago

0.4.0

11 months ago

0.3.0

11 months ago

0.2.0

11 months ago

0.1.0

11 months ago