PHP 8.2.30
Preview: pixels.spec.js Size: 766 B
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/png-js/test/pixels.spec.js

const PNGNode = require('../png-node');
const fs = require('fs');

const files = fs.readdirSync('test/images');

async function getPixels(Ctor, fileName) {
  const image = new Ctor(fs.readFileSync(`test/images/${fileName}`));
  return new Promise(resolve => {
    Ctor === PNGNode
      ? image.decodePixels(resolve)
      : resolve(image.decodePixels());
  });
}

describe('pixels', () => {
  describe('node', () => {
    test.each(files)('%s', async fileName => {
      const pixels = await getPixels(PNGNode, fileName);
      expect(pixels).toMatchSnapshot();
    });
  });

  describe('browser', () => {
    test.each(files)('%s', async fileName => {
      const pixels = await getPixels(PNG, fileName);
      expect(pixels).toMatchSnapshot();
    });
  });
});

Directory Contents

Dirs: 2 × Files: 4

Name Size Perms Modified Actions
images DIR
- drwxr-xr-x 2026-02-14 19:20:32
Edit Download
- drwxr-xr-x 2026-02-14 19:21:06
Edit Download
570 B lrw-r--r-- 2026-02-14 19:19:14
Edit Download
617 B lrw-r--r-- 2026-02-14 19:19:14
Edit Download
56 B lrw-r--r-- 2026-02-14 19:19:14
Edit Download
766 B lrw-r--r-- 2026-02-14 19:19:14
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).