Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
tests:
strategy:
matrix:
node: [ '14.x', '16.x', '18.x' ]
node: [ '14.x', '16.x', '18.x', '20.x', '22.x' ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
name: Node ${{ matrix.node }} - ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
tests:
strategy:
matrix:
node: [ '14.x', '16.x', '18.x' ]
node: [ '14.x', '16.x', '18.x', '20.x', '22.x' ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
name: Node ${{ matrix.node }} - ${{ matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .husky/commit-msg

commitlint --edit $1
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .husky/pre-commit

npm test
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
20
Binary file not shown.
12 changes: 4 additions & 8 deletions __tests__/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

const fs = require('fs');
const path = require('path');
const rimraf = require('rimraf');
const { rimrafSync } = require('rimraf');
const uniqueId = require('lodash/uniqueId');
const sizeOf = require('image-size');
const { SnapshotState } = require('jest-snapshot');
Expand All @@ -36,13 +36,9 @@ describe('toMatchImageSnapshot', () => {
expect.extend({ toMatchImageSnapshot });
});

beforeEach(() => {
rimraf.sync(`**/${cleanupRequiredIndicator}*`);
});
beforeEach(() => rimrafSync(`**/${cleanupRequiredIndicator}*`, { glob: true }));

afterAll(() => {
rimraf.sync(`**/${cleanupRequiredIndicator}*`);
});
afterAll(() => rimrafSync(`**/${cleanupRequiredIndicator}*`, { glob: true }));

describe('happy path', () => {
it('writes snapshot with no error if there is not one stored already', () => {
Expand Down Expand Up @@ -312,7 +308,7 @@ describe('toMatchImageSnapshot', () => {
expect(fs.existsSync(pathToResultImage))
.toBe(true);

expect(fs.readFileSync(pathToResultImage)).toEqual(largeImageFailureDiffData);
expect(fs.readFileSync(pathToResultImage)).toMatchImageSnapshot(largeImageFailureDiffData);
// just because file was written does not mean it is a png image
expect(sizeOf(pathToResultImage))
.toHaveProperty('type', 'png');
Expand Down
6 changes: 2 additions & 4 deletions __tests__/outdated-snapshot-reporter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const fs = require('fs');
const os = require('os');
const childProcess = require('child_process');
const path = require('path');
const rimraf = require('rimraf');
const { rimrafSync } = require('rimraf');

describe('OutdatedSnapshotReporter', () => {
const jestImageSnapshotDir = path.join(__dirname, '..');
Expand Down Expand Up @@ -78,9 +78,7 @@ describe('OutdatedSnapshotReporter', () => {
setupTestProject(tmpDir);
});

afterAll(() => {
rimraf.sync(tmpDir);
});
afterAll(() => rimrafSync(tmpDir, { glob: true }));

it('should write the image snapshot on first run', () => {
const { status, stdout, stderr } = runJest(['-u']);
Expand Down
Loading
Loading