Skip to content

gearonixx/kurtex-rs

Repository files navigation

Kurtex

Testing framework, written in Rust

vitest.dev short-written analogue. Written in rust using swc, rusty-v8, Deno low-level APIs.

Supports functionality such as watch mode, resolving dependency tests, logger, snapshot manager, reporter.

Examples

// tests/basic.test.ts
import { assertEquals } from 'jsr:@std/assert';
// Alternatively, you can add methods from @kurtex/mod deno package.
// import { test, describe, beforeAll, afterAll } from '@kurtex/mod'

test('Math.sqrt()', () => {
  const x = 1 + 2;
  assertEquals(x, 3);
})

test.concurrent('test 1', async ({ expect }) => {
  expect(foo).toMatchSnapshot()
})
test.concurrent('test 2', async ({ expect }) => {
  expect(foo).toMatchSnapshot()
})

describe('reference', () => {
  beforeAll(async () => {
    await startMocking()
  })

  afterAll(async () => {
    await stopMocking() // this method is called after all tests run
  })

  test.skip('skipped test', () => {
    // Test skipped, no error
    assertEquals(Math.sqrt(4), 3)
  })

  test.only('should print error', () => {
    assertEquals(Math.sqrt(4), 2);
  })


  test('should be skipped, because of only flag', () => {
    assertEquals(Math.sqrt(4), 2);
  })
})


describe.skip('block should be skipped', () => {
  beforeEach(async () => {
     // called once before each test run
     await prepareSomething()
  })


  test('will not run because of skip', () => {
    assertEquals(Math.sqrt(4), 2);
  })

  test.todo('unimplemented test')
})

Create kurtex config file.

// kurtex.config.ts
import { defineConfig } from '@kurtex/mod'

export default defineConfig({
    includes: ['dev/tests/*.test.ts'],
    excludes: ['**/node_modules/**', '**/fixtures/**', 'dev/tests/*.js'],
    watch: true,
    parallel: true
})

Run in your terminal

ktx --help

ktx

How it works

schema

Warning

Early stage of development

Literature

About

Javascript testing framework, written in Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published