Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit 56d62dc

Browse files
exclude async hooks test when node major version >= 8
1 parent 21dcae7 commit 56d62dc

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

test/tests/core/core.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('core', () => {
8484
const points2 = [
8585
[0, 0], [1000, 900], [-1000, -900], [-1100, -1000], [1100, 1000], [10, 10]
8686
].map(([x, y]) => new cv.Point(x, y));
87-
87+
8888
const k = 3;
8989
const termCriteria = new cv.TermCriteria(cv.termCriteria.COUNT, 100, 0.8);
9090
const attempts = 10;
@@ -119,12 +119,12 @@ describe('core', () => {
119119
expect(ret.centers[l2].x).to.equal(-1050);
120120
expect(ret.centers[l2].y).to.equal(-950);
121121
});
122-
122+
123123
// related to https://github.com/justadudewhohacks/opencv4nodejs/issues/379
124124
const points3 = [
125125
[255, 0, 0], [255, 0, 0], [255, 0, 255], [255, 0, 255], [255, 255, 255]
126-
].map(([x, y, z]) => new cv.Point(x, y, z));
127-
126+
].map(([x, y, z]) => new cv.Point(x, y, z));
127+
128128
it('should return correct centers with Point3', () => {
129129
const ret = cv.kmeans(points3, k, termCriteria, attempts, flags);
130130

@@ -144,10 +144,10 @@ describe('core', () => {
144144
it('should raise error for invalid type', () => {
145145
const points3 = [
146146
[255, 0, 0], [255, 0, 0], [255, 0, 255], [255, 0, 255], [255, 255, 255]
147-
].map(([x, y, z]) => new cv.Vec(x, y, z));
148-
147+
].map(([x, y, z]) => new cv.Vec(x, y, z));
148+
149149
let err;
150-
150+
151151
try {
152152
cv.kmeans(points3, k, termCriteria, attempts, flags);
153153
} catch(e){
@@ -157,7 +157,7 @@ describe('core', () => {
157157
expect(err.message).to.equal("Core::Kmeans - expected arg0 to be an Array of Points");
158158
});
159159
});
160-
160+
161161
describe('cartToPolar', () => {
162162
const x = new cv.Mat([[0, 1, 100]], cv.CV_32F);
163163
const y = new cv.Mat([[0, 1, 100]], cv.CV_32F);
@@ -267,7 +267,7 @@ describe('core', () => {
267267
});
268268
});
269269

270-
if (asyncHooks) {
270+
if (asyncHooks && utils.getNodeMajorVersion() > 8) {
271271
describe('async_hooks', () => {
272272
it('should trigger `init` callback in async_hooks', () => {
273273
let typeFound = false

test/utils/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ const testUtils = require('./testUtils');
22
const matTestUtils = require('./matTestUtils');
33
const defaultTests = require('./defaultTests');
44

5+
const getNodeMajorVersion = () => parseInt(process.version.split('.')[0].slice(1))
6+
57
module.exports = Object.assign(
68
{},
79
testUtils,
810
matTestUtils,
9-
defaultTests
11+
defaultTests,
12+
getNodeMajorVersion
1013
);

0 commit comments

Comments
 (0)