Skip to content

Commit

Permalink
should be relasable.
Browse files Browse the repository at this point in the history
  • Loading branch information
UrielCh committed Jan 1, 2023
1 parent 45e1d3f commit d65ad93
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion install/compileLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ async function compileLib(args) {
if (buildOptions.extra.jobs) {
JOBS = buildOptions.extra.jobs;
}
if (buildOptions.disableAutoBuild || env.OPENCV4NODEJS_DISABLE_AUTOBUILD || npmEnv.disableAutoBuild) {
if (buildOptions.disableAutoBuild || toBool(env.OPENCV4NODEJS_DISABLE_AUTOBUILD) || npmEnv.disableAutoBuild) {
const summery = opencv_build_1.OpenCVBuildEnv.autoLocatePrebuild();
log.info('envAutodetect', `autodetect ${pc.green('%d')} changes`, summery.changes);
for (const txt of summery.summery) {
Expand Down
2 changes: 1 addition & 1 deletion install/compileLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export async function compileLib(args: string[]) {
JOBS = buildOptions.extra.jobs;
}

if (buildOptions.disableAutoBuild || env.OPENCV4NODEJS_DISABLE_AUTOBUILD || npmEnv.disableAutoBuild) {
if (buildOptions.disableAutoBuild || toBool(env.OPENCV4NODEJS_DISABLE_AUTOBUILD) || npmEnv.disableAutoBuild) {
const summery = OpenCVBuildEnv.autoLocatePrebuild();
log.info('envAutodetect', `autodetect ${pc.green('%d')} changes`, summery.changes)
for (const txt of summery.summery) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@
"install_4_6_0_cuda_30XX": "npm run build && cross-env OPENCV4NODEJS_DISABLE_AUTOBUILD= node bin/install.js --keepsource --version 4.6.0 --cuda --cudaArch=8.6",
"test": "cd test && pnpm install && pnpm run test",
"samples": "cd examples && pnpm install && npm run build && node ./src/templateMatch/multiMatchBench.js && node ./src/templateMatch/multiMatchColision.js && node ./src/applyColorMap.js && node ./src/asyncMatchFeatures.js && node ./src/faceDetect/asyncFaceDetection.js",
"do-build": "npm run build && node bin/install.js --version 4.5.5 --jobs MAX build",
"do-rebuild": "npm run build && node bin/install.js --version 4.5.5 --jobs MAX rebuild",
"do-build": "npm run build && node bin/install.js --version 4.6.0 --jobs MAX build",
"do-rebuild": "npm run build && node bin/install.js --version 4.6.0 --jobs MAX rebuild",
"lint": "eslint examples/**/*.ts lib/**/*.ts typings/**/*.ts ",
"clean": "node-gyp clean",
"cleanjs": "rimraf {install,lib,examples}/**/*.{d.ts,js,map}",
"build-debug": "npm run build && BINDINGS_DEBUG=true node bin/install.js rebuild"
},
"dependencies": {
"@u4/opencv-build": "0.6.1",
"@u4/opencv-build": "0.6.3",
"@u4/tiny-glob": "^0.3.2",
"nan": "^2.17.0",
"native-node-utils": "^0.2.7",
Expand Down
16 changes: 6 additions & 10 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion test/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const xmodules = [
];

describe('cv', () => {
const toTest = {
const toTest: {[key: string]: boolean} = {
core: true,
imgproc: false, // to fix
calib3d: true,
Expand Down
2 changes: 2 additions & 0 deletions test/tests/io/ioTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default function (args: TestContext) {
const ext = '.png';
const flags = [cv.IMWRITE_PNG_COMPRESSION];
generateAPITests({
prefix: 'io imencode png',
getDut: () => cv,
methodName: 'imencode',
getRequiredArgs: () => ([
Expand All @@ -102,6 +103,7 @@ export default function (args: TestContext) {
const ext = '.jpg';
const flags = [cv.IMWRITE_JPEG_QUALITY];
generateAPITests({
prefix: 'io imencode jpg',
getDut: () => cv,
methodName: 'imencode',
getRequiredArgs: () => ([
Expand Down
1 change: 1 addition & 0 deletions test/tests/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
export type OpenCV = typeof cv

export interface APITestOpts {
prefix?: string,
getDut?: () => any,
methodName?: string,
methodNameSpace?: string,
Expand Down
21 changes: 11 additions & 10 deletions test/utils/generateAPITests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const generateAPITests = (opts: Partial<APITestOpts>): void => {
getOptionalArgsMap().forEach(([k, v]: [string, any]) => { optionalArgsObject[k] = v; });
return optionalArgsObject;
};
const prefix = opts.prefix ? `${opts.prefix} ` : '';
const hasRequiredArgs = !!opts.getRequiredArgs;
const hasOptArgs = !!getOptionalArg || !!getOptionalArgsMap;
const hasOptArgsObject = !!getOptionalArgsMap;
Expand Down Expand Up @@ -77,7 +78,7 @@ export const generateAPITests = (opts: Partial<APITestOpts>): void => {
const isAsync = isCallbacked || isPromised;

const method = isAsync ? methodNameAsync : methodName;
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);

const getErrPrefix = () => `${(methodNameSpace ? `${methodNameSpace}::` : '')}${capitalize(method)} - Error:`;
const typeErrMsg = (argN) => `${getErrPrefix()} expected argument ${argN} to be of type`;
Expand Down Expand Up @@ -132,36 +133,36 @@ export const generateAPITests = (opts: Partial<APITestOpts>): void => {
return done();
};

it('should be callable with required args', (done: DoneError) => {
it(`${prefix}should be callable with required args`, (done: DoneError) => {
const args = getRequiredArgs().slice();
expectSuccess(args, done);
});

if (hasRequiredArgs) {
it('should throw if required arg invalid', (done: DoneError) => {
it(`${prefix}should throw if required arg invalid`, (done: DoneError) => {
const args = [undefined];
expectError(args, typeErrMsg(0), done);
});
}

if (hasOptArgs) {
it('should be callable with optional args', (done: DoneError) => {
it(`${prefix}should be callable with optional args`, (done: DoneError) => {
const args = getRequiredArgs().slice().concat(getOptionalArgs());
expectSuccess(args, done);
});

it('should throw if opt arg invalid', (done: DoneError) => {
it(`${prefix}should throw if opt arg invalid`, (done: DoneError) => {
const args = getRequiredArgs().slice().concat(undefined);
expectError(args, typeErrMsg(getRequiredArgs().length), done);
});

if (hasOptArgsObject) {
it('should be callable with optional args object', (done: DoneError) => {
it(`${prefix}should be callable with optional args object`, (done: DoneError) => {
const args = getRequiredArgs().slice().concat(getOptionalArgsObject());
expectSuccess(args, done);
});

it('should throw if opt arg object prop invalid', (done: DoneError) => {
it(`${prefix}should throw if opt arg object prop invalid`, (done: DoneError) => {
const prop = getOptionalArgsMap()[0][0];
const args = getRequiredArgs().slice().concat({
[prop]: undefined,
Expand Down Expand Up @@ -190,12 +191,12 @@ export const generateAPITests = (opts: Partial<APITestOpts>): void => {
});

if (hasAsync) {
describe('async', () => {
describe(`${prefix}async`, () => {
if (hasRequiredArgs) {
asyncFuncShouldRequireArgs(() => getDut()[methodNameAsync]());
}

describe('callbacked', () => {
describe(`${prefix}callbacked`, () => {
if (beforeHook) {
beforeEach(() => beforeHook());
}
Expand All @@ -208,7 +209,7 @@ export const generateAPITests = (opts: Partial<APITestOpts>): void => {
otherAsyncCallbackedTests();
});

describe('promisified', () => {
describe(`${prefix}promisified`, () => {
if (beforeHook) {
beforeEach(() => beforeHook());
}
Expand Down

0 comments on commit d65ad93

Please sign in to comment.