Skip to content

Commit

Permalink
Get back e2e binary tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Aug 24, 2024
1 parent ce1df85 commit c586e3d
Show file tree
Hide file tree
Showing 5 changed files with 1,342 additions and 72 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,13 @@ jobs:
- run: opam exec -- dune build --verbose
- run: opam exec -- dune exec ODiffBin -- --version

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: 'pmpn-lock.yaml'

- name: e2e test
run: pnpm test

4 changes: 3 additions & 1 deletion bin/node-bindings/odiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ function parsePixelDiffStdout(stdout) {
const CMD_BIN_HELPER_MSG =
"Usage: odiff [OPTION]... [BASE] [COMPARING] [DIFF]\nTry `odiff --help' for more information.\n";

const NO_FILE_ODIFF_ERROR_REGEX = /no\s+'([^']+)'\s+file\s+or\s+directory/;

async function compare(basePath, comparePath, diffOutput, options = {}) {
return new Promise((resolve, reject) => {
let producedStdout, producedStdError;
Expand Down Expand Up @@ -148,7 +150,7 @@ async function compare(basePath, comparePath, diffOutput, options = {}) {
).replace(CMD_BIN_HELPER_MSG, "");

const noFileOrDirectoryMatches = originalErrorMessage.match(
/no\n\s*`(.*)'\sfile or\n\s*directory/
NO_FILE_ODIFF_ERROR_REGEX
);

if (options.noFailOnFsErrors && noFileOrDirectoryMatches?.[1]) {
Expand Down
80 changes: 12 additions & 68 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,20 @@
{
"name": "odiff",
"name": "odiff-bin",
"version": "3.0.1",
"description": "The fastest image difference tool.",
"author": "Dmitriy Kovalenko <[email protected]>",
"license": "MIT",
"esy": {
"build": "dune build --release --only-packages odiff,odiff-io,odiff-core",
"buildDev": "refmterr dune build --promote-install-files --root . --only-packages odiff,odiff-io,odiff-core",
"release": {
"bin": {
"odiff": "ODiffBin"
},
"rewritePrefix": true,
"includePackages": [
"odiff"
]
},
"buildEnv": {
"ODOC_SYNTAX": "re"
}
},
"description": "The fastest image difference tool in the world",
"scripts": {
"run": "esy x ODiffBin",
"test": "esy x RunTests.exe",
"test-js": "esy ava",
"test-ts": "esy tsc --noEmit test/node-bindings.test.ts",
"format": "esy dune build @fmt --auto-promote",
"doc": "esy dune build @doc",
"post-release": "node .ci/pipelines-release.js",
"process:readme": "esy node scripts/process-readme.js"
},
"dependencies": {
"@opam/cmdliner": "1.0.4",
"@opam/dune": "< 4.0.0",
"@opam/dune-configurator": "< 4.0.0",
"@opam/reason": "3.9.0",
"@reason-native/console": "*",
"@reason-native/pastel": "*",
"@reason-native/rely": "*",
"esy-libjpeg": "*",
"esy-libspng": "*",
"esy-libtiff": "*",
"esy-zlib": "*",
"ocaml": "4.14.x"
"test": "ava"
},
"keywords": [
"visual-regression",
"pixelmatch",
"image",
"comparison",
"diff"
],
"devDependencies": {
"ava": "^3.15.0",
"typescript": "^4.3.5",
"@opam/merlin": "*",
"@opam/ocaml-lsp-server": "*",
"refmterr": "*"
},
"resolutions": {
"esy-cmake": "ManasJayanth/esy-cmake:esy.json#dcc7909f7ea0604f1d644b14a3e83d7ebaf64272",
"@opam/reason": "3.9.0",
"@reason-native/file-context-printer": "reasonml/reason-native:file-context-printer.json#a0ddab6ab25237961e32d8732b0a222ec2372d4a",
"@reason-native/cli": "reasonml/reason-native:cli.json#a0ddab6ab25237961e32d8732b0a222ec2372d4a",
"@reason-native/rely": "reasonml/reason-native:rely.json#a0ddab6ab25237961e32d8732b0a222ec2372d4a",
"@reason-native/pastel": "reasonml/reason-native:pastel.json#a0ddab6ab25237961e32d8732b0a222ec2372d4a",
"@reason-native/console": "reasonml/reason-native:console.json#a0ddab6ab25237961e32d8732b0a222ec2372d4a",
"refmterr": "reasonml/reason-native:refmterr.json#a0ddab6ab25237961e32d8732b0a222ec2372d4a",
"esy-libspng": "ManasJayanth/esy-libspng:esy.json#255c1531255d71d59a66b57af6d893a16c75dc0e",
"esy-libjpeg": "eWert-Online/esy-libjpeg#76b287add2732e191a2c4a1c14a34bab63c4f74d",
"esy-libtiff": "esy-packages/esy-libtiff#83b1f5c8f76ad42acb5c008f537b5b3f0902c066",
"esy-zlib": "esy-packages/esy-zlib#65faba12e4aed539d8fd2444fede2f1136389f6f"
},
"repository": {
"type": "git",
"url": "https://github.com/dmtrKovalenko/odiff"
},
"author": {
"email": "[email protected]",
"name": "Dmitriy Kovalenko",
"url": "https://dmtrkovalenko.dev"
"ava": "^6.1.3"
}
}
Loading

0 comments on commit c586e3d

Please sign in to comment.