Skip to content

Commit

Permalink
Move test utility functions into an own package
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilwanner committed May 17, 2020
1 parent 9daf4cb commit 31b3c05
Show file tree
Hide file tree
Showing 18 changed files with 7,688 additions and 589 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"import/extensions": ["error", {
"d.ts": "always"
}],
"import/prefer-default-export": "off"
"import/prefer-default-export": "off",
"@typescript-eslint/no-use-before-define": "off"
}
}
1 change: 1 addition & 0 deletions packages/mozjpeg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
1. [Usage](#usage)
1. [API](#api)
1. [Examples](#examples)
1. [License](#license)

## Installation

Expand Down
14 changes: 12 additions & 2 deletions packages/mozjpeg/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { cleanup, getRawImage, writeTmpBuffer, getFileSize, getImageMetadata } from './util';
import {
initTestUtils,
cleanup,
getRawImage,
writeTmpBuffer,
getFileSize,
getImageMetadata,
} from '@wasm-codecs/test-utils';
import encode from '../lib';
import { ColorSpace } from '../lib/colorspace';

describe('mozjpeg', () => {
beforeAll(cleanup);
beforeAll(() => {
initTestUtils(__dirname);
});

afterAll(cleanup);

// test all image sizes
Expand Down
8 changes: 7 additions & 1 deletion packages/mozjpeg/__tests__/performance.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { getRawImage, getFileSize, getImageMetadata } from './util';
import { initTestUtils, getRawImage, getFileSize, getImageMetadata, cleanup } from '@wasm-codecs/test-utils';
import encode from '../lib';
import { ColorSpace } from '../lib/colorspace';

describe('mozjpeg performance', () => {
beforeAll(() => {
initTestUtils(__dirname);
});

afterAll(cleanup);

it('encodes many images', async () => {
jest.setTimeout(60000);
process.setMaxListeners(0);
Expand Down

0 comments on commit 31b3c05

Please sign in to comment.