Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/_test-units.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:

- name: Test code
run: npm run test

run-tests-without-optional-dependencies:
name: Run Tests Without Optional Dependencies
strategy:
Expand Down
76 changes: 18 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"test-v1-light": "mocha --grep \"#includeOptionalDeps\" --invert \"tests/v1/**/*.spec.ts\"",
"test-v2": "mocha --grep \"#omitOptionalDeps\" --invert \"tests/v2/**/*.spec.ts\"",
"test-v2-light": "mocha --grep \"#includeOptionalDeps\" --invert \"tests/v2/**/*.spec.ts\"",
"lint": "tsc --noEmit && eslint './src/**/*.ts' --report-unused-disable-directives && echo 'Your .ts files look good.'",
"lint-fix": "eslint './src/**/*.ts' --fix",
"lint": "tsc --noEmit && eslint --report-unused-disable-directives './src/**/*.ts' './tests/**/*.ts'",
"lint-fix": "eslint --fix --report-unused-disable-directives './src/**/*.ts' './tests/**/*.ts'",
"docs": "typedoc --out docs/_build ./src/index.ts",
"docs-for-dist": "typedoc --out docs/_build ./src/index.ts && cp -r ./docs/code_samples ./docs/_build/"
},
Expand Down Expand Up @@ -47,28 +47,26 @@
},
"homepage": "https://mindee.com/",
"devDependencies": {
"@types/chai": "^5.2.3",
"@types/mocha": "^10.0.10",
"@types/node": "^18.19.130",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^8.52.0",
"@typescript-eslint/parser": "^8.52.0",
"chai": "^6.2.2",
"@typescript-eslint/eslint-plugin": "^8.55.0",
"@typescript-eslint/parser": "^8.55.0",
"eslint": "^9.39.2",
"eslint-plugin-jsdoc": "^50.6.17",
"eslint-plugin-jsdoc": "^52.0.4",
"mocha": "^11.7.5",
"tsc-alias": "^1.8.16",
"tsx": "^4.21.0",
"typedoc": "~0.28.15",
"typedoc": "~0.28.16",
"typescript": "^5.9.3"
},
"dependencies": {
"commander": "~9.4.1",
"file-type": "^19.6.0",
"node-poppler": "^7.2.4",
"tmp": "^0.2.3",
"tslib": "^2.8.1",
"undici": "^6.23.0"
"undici": "^6.23.0",
"node-poppler": "^7.2.4"
},
"optionalDependencies": {
"sharp": "~0.34.5",
Expand Down
4 changes: 2 additions & 2 deletions tests/dependency/missingDependencies.integration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as mindee from "@/index.js";
import { InvoiceSplitterV1 } from "@/v1/product/index.js";
import { expect } from "chai";
import assert from "node:assert/strict";
import path from "path";
import { V1_PRODUCT_PATH } from "../index.js";

Expand All @@ -21,7 +21,7 @@ describe("Light Environment Sanity Check #omitOptionalDeps", function () {
mindee.v1.product.InvoiceSplitterV1, sample
);
const invoiceSplitterInference = response.document?.inference;
expect(invoiceSplitterInference).to.be.an.instanceof(InvoiceSplitterV1);
assert.ok(invoiceSplitterInference instanceof InvoiceSplitterV1);
await mindee.v1.extraction.extractInvoices(
sample,
invoiceSplitterInference as InvoiceSplitterV1
Expand Down
12 changes: 6 additions & 6 deletions tests/dependency/missingDependencies.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { expect } from "chai";
import assert from "node:assert/strict";

describe("Light Environment Sanity Check #omitOptionalDeps", function () {

it("should NOT have sharp installed", async function () {
try {
const moduleName = "sharp";
await import(moduleName);
expect.fail("sharp should not be installed in this environment, but it was found!");
assert.fail("sharp should not be installed in this environment, but it was found!");
} catch (error: any) {
const isModuleNotFound = error.code === "ERR_MODULE_NOT_FOUND";
const isSharpBinaryMissing = error.message && error.message.includes("Could not load the \"sharp\" module");
Expand All @@ -21,19 +21,19 @@ describe("Light Environment Sanity Check #omitOptionalDeps", function () {
try {
const moduleName = "pdf.js-extract";
await import(moduleName);
expect.fail("pdf.js-extract should not be installed, but it was found!");
assert.fail("pdf.js-extract should not be installed, but it was found!");
} catch (error: any) {
expect(error.code).to.equal("ERR_MODULE_NOT_FOUND");
assert.strictEqual(error.code, "ERR_MODULE_NOT_FOUND");
}
});

it("should NOT have @cantoo/pdf-lib installed", async function () {
try {
const moduleName = "@cantoo/pdf-lib";
await import(moduleName);
expect.fail("@cantoo/pdf-lib should not be installed, but it was found!");
assert.fail("@cantoo/pdf-lib should not be installed, but it was found!");
} catch (error: any) {
expect(error.code).to.equal("ERR_MODULE_NOT_FOUND");
assert.strictEqual(error.code, "ERR_MODULE_NOT_FOUND");
}
});
});
Loading