๐Ÿ“ฆ antongolub / abstractest

Abstract testing processor

โ˜… 1 stars โ‘‚ 0 forks ๐Ÿ‘ 1 watching โš–๏ธ MIT License
testing
๐Ÿ“ฅ Clone https://github.com/antongolub/abstractest.git
HTTPS git clone https://github.com/antongolub/abstractest.git
SSH git clone git@github.com:antongolub/abstractest.git
CLI gh repo clone antongolub/abstractest
Anton Golub Anton Golub chore: up dev deps ddd9c5b 1 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ .yarn
๐Ÿ“ packages
๐Ÿ“„ .gitignore
๐Ÿ“„ .releaserc.js
๐Ÿ“„ .yarnrc.yml
๐Ÿ“„ LICENSE
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ yarn.lock
๐Ÿ“„ README.md

abstractest

CI Maintainability
An abstract testing processor

Hypothesis

Find out if it's possible to declare unit tests in some generic notation, and execute them via any appropriate provider.

Today, Jest dominates over all testing frameworks and libraries, in fact it represents the industry standard. Therefore, seems reasonable to take this notation and syntax as a basis, and then try to run Jest-like tests on different runners. It may turn out to be faster and more resource-efficient.

Usage

Install:
yarn add -D abstractest @abstractest/jest

Write a test:

// src/test/js/foo.test.js

import { describe, it, expect } from 'abstractest'

describe('foo()', () => {
  it('works as expected', () => {
    expect(foo()).toEqual('bar')
  })
})
Run tests via the required runner:
# via jest
abstractest --runner=jest src/test/js/**/*.test.js

# via native node:test
abstractest --runner=native src/test/js/**/*.test.js

Contents

PackageDescriptionLatest
@abstractest/coreabstractest core utilsnpm (scoped)
@abstractest/expectAssertion library for abstractestnpm (scoped)
@abstractest/fixture-basic-testTesting fixtures
@abstractest/infraabstractest monorepo infra assets
@abstractest/jestJest runner for abstractestnpm (scoped)
@abstractest/mockMocker module for abstractestnpm (scoped)
@abstractest/nativeNative node:test runner for abstractestnpm (scoped)
@abstractest/typesabstractest typesnpm (scoped)
abstractestCLI for abstractestnpm (scoped)

Implementation notes

  • Does not provide whole module mocking by design. It's recommended to use some kind of DI/IoC for this purpose.
  • Enforces ESM usage. Declare explicit file extensions (.cjs, .mjs, .mts, etc) to get necessary module context or initialize the legacy CommonJS API in place.

License

MIT