Test utility functions for other @wasm-codecs packages
This is a private and unpublished package and can not be installed from the npm registry.
To add @wasm-codecs/test-utils
to a new package within this repository, run the following command in the root directory of this monorepo:
npm run lerna add @wasm-codecs/test-utils -- --scope=@wasm-codecs/TARGET-CODEC-NAME
import { initTestUtils, cleanup } from '@wasm-codecs/test-utils';
describe('my test', () => {
beforeAll(() => {
initTestUtils(__dirname);
);
afterAll(cleanup);
// ...
});
Initializes the test utils by configuring internal paths.
Path to the test root.
Cleans up tests by removing temporary files and directories.
If true, will forcefully remove the tmp directory, even if the KEEP_IMAGE_OUTPUT
env variable is set.
Loads an image file and returns its buffer and information.
Name of the image file to load.
Loads an image file and returns its raw RGB data per pixel and information.
Name of the image file to load.
Returns all available metadata of an image.
Name of the image file to load.
Returns the size of a file in bytes.
Name of the image file to load.
Writes a buffer into a temporary file.
Buffer to write.
Filename of the temporary file.
Licensed under the MIT license.
© Copyright Cyril Wanner