Skip to content

Releases: japa/core

Export types from subpath

03 Mar 08:44
Compare
Choose a tag to compare
  • chore: export types from a submodule path 8e757bf
  • chore: update dependencies 895acc7

v7.3.2...v7.3.3

Add "test.retryAttempt" property and add debug logs

22 Feb 04:11
Compare
Choose a tag to compare
  • ci: set env variables using cross-env package e0ebd39
  • refactor: add debug calls d469255
  • chore: update dependencies 505119c
  • feat: add "test.retryAttempt" property 1807e9a
  • chore: update dependencies c6a554a

Full Changelog: v7.3.1...v7.3.2

Update dependencies and re-structure folder structure internally

07 Feb 06:42
Compare
Choose a tag to compare
  • docs: update sponsors list 9a66237
  • docs(README): fix badge url for github workflow a7afb6b
  • refactor: drop extension from imports fcd80ff
  • refactor: file structure and file naming conventions 627fd28
  • chore: update dependencies b623fde

Full Changelog: v7.3.0...v7.3.1

Add isPinned property to test start and end event data

15 Oct 17:12
Compare
Choose a tag to compare
  • feat: add "isPinned" property to test event data b1f1d47

Full Changelog: v7.2.0...v7.3.0

Add support for defining cleanup hooks within the test callback

12 Sep 08:32
Compare
Choose a tag to compare

In the following code example, if the select query raises an exception, the cleanup code connection.destory will never be called. Therefore, you will have an open connection even
after the test is over (aka failed).

test('find all users', async () => {
  // Setup
  const connection = await makeConnection()

  // Test logic
  await connection.select('*').from('users')

  // Cleanup
  await connection.destroy()
})

In order to counter situations like this, you can wrap the select query inside try/finally block and close the connection inside the finally block.

try {
  await connection.select('*').from('users')
} finally {
  await connection.destroy()
}

I usually avoid try/catch (whenever possible) because of the visual noise it creates. Therefore, this releases exposes a cleanup function that you can use to define the cleanup handlers that always run regardless of the test passes or fails.

test('find all users', async ({ cleanup }) => {
  const connection = await makeConnection()

  /**
   * Runs after the test is completed
   */
  cleanup(() => connection.destroy())

  await connection.select('*').from('users')
})
  • feat: add support for defining cleanup hooks from within the test 2a8aa8f

Full Changelog: v7.1.0...v7.2.0

Allow reporters to have names

12 Sep 05:20
Compare
Choose a tag to compare

With this release, one can register a reporter with a name and a handler function as follows.

runner.registerReporter({
  name: 'spec',
  handler: () => {
  }
})
  • feat: ReporterContract can now be named (#65) 0cb9899

What's Changed

New Contributors

Full Changelog: v7.0.1...v7.1.0

Update dependencies

07 Sep 10:00
Compare
Choose a tag to compare
  • chore: update dependencies f4cfde2
  • docs(README): remove v4 upgrade note b39378e
  • docs(README): update japa.dev link 01b5efc
  • chore: remove github health files in favor of central .github repo eb56a41

Full Changelog: v7.0.0...v7.0.1

Drill down layers when applying filters

02 Sep 19:03
Compare
Choose a tag to compare

Breaking change

After this release, creating a new instance of suite will need a refiner instance. It does not impact the public API of @japa/runner. But direct consumers of @japa/core are impacted.

Improvements to the filters

Before this release, a group will run its hooks even when all the tests inside that group were filtered out (aka skipped). Similarly, a suite will run its hooks even when all the groups and its tests were filtered out.

Ideally, this does not impact the correctness of the tests. But still, you end up paying cost for running those hooks.

After this release, the upper layers have knowledge about their children and skip running themselves when children have been skipped/filtered out. For example:

  • A suite will not run, if all the groups/tests within that group were filtered.
  • A group will not run, if all the tests within that group were filtered.

Commits

  • fix: build issues 1ebee5d
  • refactor: refiner to drill down layers when filtering groups 29a5494

v6.0.7...v7.0.0

Full Changelog: v6.0.7...v7.0.0

v6.0.7

02 Sep 07:32
Compare
Choose a tag to compare

Fix to not run lone tests when group filter is applied

This release contains a bug fix for not running lone tests when a group filter is applied. Let's say you have defined the following tests, where two of the tests are inside their respective groups and the third one is a lone test (without a group)

import { test } from '@japa/runner'

test.group('GroupOne', (group) => {
  test('My Test', ({ assert }) => {
    assert.isTrue(true)
  })
})

test.group('GroupTwo', (group) => {
  test('My Test', ({ assert }) => {
    assert.isTrue(true)
  })
})

test('Root', () => console.log('hey'))

Now when you run tests with the following filters, you would expect only the tests within the GroupOne should run.

node bin/test.js --groups "GroupOne"

However, before this release, the lone test was also running.

Reference literal values in dynamic test titles

If you have a test using dataset with literal values, now you can reference the literal value using the special $self keyboard. For example:

test('validate {$self}')
.with([
  '[email protected]',
  '[email protected]',
  '[email protected]'
])
.run({ assert }, email) => {
  assert.isTrue(validateEmail(email))
})

Earlier, there was no way to reference literal values from the dataset and that forces you to always use objects inside the dataset array.

Commits

  • feat: allow referencing literal values in dynamic test title 9fd89cb
  • fix: types breaking changes after moving for TypeScript 4.8 f23c4c4
  • test: fix breaking test after fixing #63 86beab3
  • docs(README): reference sponsors image from central CDN 6cb4278
  • fix: do not run lone tests when group filter is applied 4429e20
  • chore: update dependencies 6cad5c6
  • chore: update dependencies 77363c0
  • docs(README): add sponsors 4e48239
  • test: remove only modifier and run all tests ae4d674
  • chore: update dependencies 50738c2

Full Changelog: v6.0.6...v6.0.7

Fix super.emit to forward all arguments to parent class

17 May 08:20
Compare
Choose a tag to compare