Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
zenteredPublic archive

About

[DEPRECATED] Tiny helper function to read JSON fixtures for tests. No longer maintained.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

Repository files navigation

read-fixtures

Warning

This package is deprecated and no longer maintained. Read fixtures with JSON.parse(await readFile(new URL('./fixtures/name.json', import.meta.url))) from node:fs/promises instead.

Tiny helper function to read JSON fixtures for tests

npm install @zentered/read-fixtures

Usage

import { test } from 'node:test'
import assert from 'node:assert/strict'
import readFixture from '@zentered/read-fixtures'

test('process events', async () => {
  const mockData = await readFixture('log_stream.json')
  assert.deepEqual(mockData, { hello: 'world' })
})

Arguments

Argument Default Description
name required File name of the JSON fixture, for example log_stream.json.
folder 'fixtures' Folder under test/ that holds the file.

Files resolve from process.cwd()/test/<folder>/<name>. Run tests from the project root so process.cwd() points there.

// reads test/custom/log_stream.json
const mockData = await readFixture('log_stream.json', 'custom')

About

[DEPRECATED] Tiny helper function to read JSON fixtures for tests. No longer maintained.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages