Skip to content

Commit

Permalink
Update emscripten (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilwanner committed Jul 22, 2020
1 parent 010d1f8 commit 09f32e9
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [ master ]
branches: [ master, feature/fix-ci ]
pull_request:
branches: [ master ]

Expand Down
2 changes: 1 addition & 1 deletion packages/mozjpeg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM trzeci/emscripten
FROM trzeci/emscripten:1.39.18-upstream

RUN apt-get update && \
apt-get install -y \
Expand Down
2 changes: 0 additions & 2 deletions packages/mozjpeg/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ describe('mozjpeg', () => {
// test all image sizes
['tiny', 'small', 'medium', 'large'].forEach((size) => {
it(`encodes a ${size} image`, async () => {
jest.setTimeout(60000);

const {
data,
info: { width, height, channels },
Expand Down
2 changes: 1 addition & 1 deletion packages/mozjpeg/__tests__/performance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('mozjpeg performance', () => {
});

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

const {
Expand Down
1 change: 0 additions & 1 deletion packages/mozjpeg/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ emcc \
-s WASM=1 \
-Oz \
-flto \
--llvm-lto 1 \
-s FILESYSTEM=0 \
-I /lib/mozjpeg \
-s 'EXPORT_NAME="mozjpeg"' \
Expand Down
11 changes: 7 additions & 4 deletions packages/mozjpeg/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ const initModule = (): Promise<void> => {
return new Promise((resolve) => {
// add a new job to the queue
queue.push(() => {
mozjpeg = Module();
mozjpeg.onRuntimeInitialized = (): void => {
resolve();
};
Module({
onRuntimeInitialized: () => {
resolve();
},
}).then((instance) => {
mozjpeg = instance;
});
});

// start it if there is no queue
Expand Down
2 changes: 1 addition & 1 deletion packages/mozjpeg/src/mozjpeg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export interface MozJPEGModule extends EmscriptenModule {
freeImage(imagePointer: number): void;
}

export default function(): MozJPEGModule;
export default function(mozjpeg: { onRuntimeInitialized: () => void }): MozJPEGModule;
2 changes: 1 addition & 1 deletion packages/oxipng/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust
FROM rust:1.44

RUN rustup target add wasm32-unknown-unknown
RUN mkdir /opt/wabt && \
Expand Down
2 changes: 1 addition & 1 deletion packages/oxipng/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('oxipng', () => {
// test all image sizes
['tiny', 'small', 'medium', 'large'].forEach((size) => {
it(`encodes a ${size} image`, async () => {
jest.setTimeout(60000);
jest.setTimeout(20000);

const {
data,
Expand Down
2 changes: 1 addition & 1 deletion packages/oxipng/__tests__/performance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('oxipng performance', () => {
});

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

const { data } = await getImage('images/small.png');
Expand Down

0 comments on commit 09f32e9

Please sign in to comment.