Skip to content
Draft
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
9 changes: 7 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---

name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' ---**Describe the bug** A
clear and concise description of what the bug is.
**Describe the bug** A clear and concise description of what the bug is.

**To Reproduce** Steps to reproduce the behavior:

Expand Down
11 changes: 8 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---

name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' ---**Is your feature
request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]
**Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem
is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like** A clear and concise description of what you want to happen.

Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ your changes following the guidelines described in `CONTRIBUTING.md`. I will try

## Developing

Use a modern Node.js version from CI and Yarn Classic (1.x) for development. The Node.js 12 minimum applies to the
installed CLI, not the development tools.
Use a modern Node.js version from CI and Yarn Classic (1.x) for development. The pre-commit hooks require Git 2.32 or
newer. The Node.js 12 minimum applies to the installed CLI, not the development tools.

Make some changes, `yarn build` and then `./bin/diff2html` 😉

Expand Down
3 changes: 0 additions & 3 deletions babel.config.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default defineConfig([
extends: [tsPlugin.configs['flat/recommended'], importX.flatConfigs.typescript],
},
{
// Match Jest's default test discovery.
// Match testMatch in jest.config.cjs.
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
extends: [jest.configs['flat/recommended'], jest.configs['flat/style']],
},
Expand Down
11 changes: 5 additions & 6 deletions jest.config.ts → jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { JestConfigWithTsJest } from 'ts-jest';

const jestConfig: JestConfigWithTsJest = {
preset: 'ts-jest',
/** @type {import('jest').Config} */
module.exports = {
// Keep in sync with the Jest override in eslint.config.mjs.
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
transform: { '^.+\\.tsx?$': 'ts-jest' },
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
Expand All @@ -21,5 +22,3 @@ const jestConfig: JestConfigWithTsJest = {
},
},
};

export default jestConfig;
24 changes: 9 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"fix": "yarn run format:fix && yarn run lint:fix",
"preversion": "yarn run validate",
"version": "git add -A package.json",
"prepare": "husky install"
"prepare": "husky"
},
"bin": {
"diff2html": "./bin/diff2html.js"
Expand All @@ -84,19 +84,14 @@
"yargs": "17.7.3"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/preset-env": "^7.23.8",
"@babel/preset-typescript": "^7.23.3",
"@eslint/js": "10.0.1",
"@eslint/json": "2.1.1",
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.11",
"@jest/globals": "30.5.2",
"@types/node": "12.20.55",
"@types/node-fetch": "2.6.13",
"@types/yargs": "17.0.35",
"@typescript-eslint/eslint-plugin": "8.74.0",
"@typescript-eslint/parser": "8.74.0",
"babel-jest": "^29.7.0",
"eslint": "10.16.0",
"eslint-config-prettier": "10.1.9",
"eslint-import-resolver-typescript": "4.4.5",
Expand All @@ -107,18 +102,17 @@
"eslint-plugin-promise": "7.3.0",
"eslint-plugin-sonarjs": "4.2.3",
"globals": "17.14.0",
"husky": "8.0.3",
"husky": "9.1.7",
"is-ci-cli": "2.2.0",
"jest": "29.7.0",
"lint-staged": "15.2.0",
"jest": "30.5.2",
"lint-staged": "17.6.3",
"markdown-toc": "^1.2.0",
"prettier": "3.2.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "5.3.3"
"prettier": "3.10.1",
"ts-jest": "29.4.15",
"typescript": "6.0.3"
},
"resolutions": {
"eslint-plugin-sonarjs/typescript": "5.3.3"
"eslint-plugin-sonarjs/typescript": "6.0.3"
},
"license": "MIT",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-podman-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import childProcess from 'child_process';
import fs from 'fs';
import os from 'os';
import path from 'path';
import { jest } from '@jest/globals';
import { afterEach, beforeEach, expect, jest, test } from '@jest/globals';

import { put } from '../http-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-startup-tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals';
import { expect, jest, test } from '@jest/globals';

jest.mock('clipboardy', () => {
throw new Error('Clipboard adapter could not initialize');
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/cli-tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
import { jest } from '@jest/globals';
import { afterEach, beforeEach, describe, expect, jest, test } from '@jest/globals';
import { writeSync } from 'clipboardy';
import open from 'open';

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/http-utils-tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createServer } from 'http';
import { AddressInfo } from 'net';
import { jest } from '@jest/globals';
import { afterAll, beforeAll, describe, expect, jest, test } from '@jest/globals';

import { put } from '../http-utils';

Expand Down
7 changes: 4 additions & 3 deletions src/__tests__/main-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from 'path';
import { jest, expect } from '@jest/globals';
import { afterEach, beforeEach, describe, expect, jest, test } from '@jest/globals';
import { ColorSchemeType } from 'diff2html/lib/types.js';

import * as cli from '../cli';
import * as log from '../logger';
Expand Down Expand Up @@ -51,7 +52,7 @@ describe('main', () => {
maxLineSizeInBlockForComparison: 200,
outputFormat: 'line-by-line',
renderNothingWhenEmpty: false,
colorScheme: 'auto',
colorScheme: ColorSchemeType.AUTO,
},
{
diffyType: undefined,
Expand Down Expand Up @@ -90,7 +91,7 @@ describe('main', () => {
await command.main();

expect(process.exitCode).toBe(1);
expect(log.error).toHaveBeenCalledWith(error);
expect(jest.mocked(log.error).mock.calls).toEqual([[error]]);
expect(getOutputSpy).not.toHaveBeenCalled();
});
});
1 change: 1 addition & 0 deletions src/__tests__/utils-tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { existsSync, mkdtempSync, rmdirSync, unlinkSync } from 'fs';
import { tmpdir } from 'os';
import { join } from 'path';
import { describe, expect, test } from '@jest/globals';

import * as utils from '../utils';

Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"exclude": ["node_modules", "src/__tests__/**"],
"compilerOptions": {
"moduleResolution": "Node",
"ignoreDeprecations": "6.0",
"target": "ES2019",
"module": "CommonJS",
"lib": ["ES2019"],
"types": ["node"],
"jsx": "preserve",
"rootDir": "src",
"outDir": "lib",
Expand Down
Loading