@neurodevs/ndx-native 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.regressionproof.json +7 -0
- package/.vscode/launch.json +52 -57
- package/.vscode/settings.json +62 -66
- package/.vscode/tasks.json +123 -129
- package/README.md +1 -0
- package/build/.spruce/settings.json +7 -7
- package/build/__tests__/AbstractPackageTest.d.ts +1 -0
- package/build/__tests__/AbstractPackageTest.js +1 -0
- package/build/__tests__/AbstractPackageTest.js.map +1 -1
- package/build/__tests__/impl/LabrecorderAdapter.test.d.ts +1 -1
- package/build/__tests__/impl/LabrecorderAdapter.test.js +9 -9
- package/build/__tests__/impl/LabrecorderAdapter.test.js.map +1 -1
- package/build/__tests__/impl/LiblslAdapter.test.d.ts +3 -4
- package/build/__tests__/impl/LiblslAdapter.test.js +18 -26
- package/build/__tests__/impl/LiblslAdapter.test.js.map +1 -1
- package/build/__tests__/impl/LibndxAdapter.test.d.ts +35 -0
- package/build/__tests__/impl/LibndxAdapter.test.js +258 -0
- package/build/__tests__/impl/LibndxAdapter.test.js.map +1 -0
- package/build/__tests__/impl/LibxdfAdapter.test.d.ts +1 -2
- package/build/__tests__/impl/LibxdfAdapter.test.js +5 -6
- package/build/__tests__/impl/LibxdfAdapter.test.js.map +1 -1
- package/build/impl/LiblslAdapter.d.ts +7 -9
- package/build/impl/LiblslAdapter.js +111 -117
- package/build/impl/LiblslAdapter.js.map +1 -1
- package/build/impl/LibndxAdapter.d.ts +57 -0
- package/build/impl/LibndxAdapter.js +145 -0
- package/build/impl/LibndxAdapter.js.map +1 -0
- package/build/impl/LibxdfAdapter.d.ts +3 -3
- package/build/impl/LibxdfAdapter.js +10 -7
- package/build/impl/LibxdfAdapter.js.map +1 -1
- package/build/index.d.ts +6 -2
- package/build/index.js +8 -3
- package/build/index.js.map +1 -1
- package/build/lib/{handleError.d.ts → handleLslError.d.ts} +1 -1
- package/build/lib/{handleError.js → handleLslError.js} +2 -2
- package/build/lib/handleLslError.js.map +1 -0
- package/build/testDoubles/Libndx/FakeLibndx.d.ts +22 -0
- package/build/testDoubles/Libndx/FakeLibndx.js +58 -0
- package/build/testDoubles/Libndx/FakeLibndx.js.map +1 -0
- package/build/types.d.ts +2 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/eslint.config.js +3 -0
- package/package.json +15 -31
- package/prettier.config.js +3 -0
- package/src/.spruce/settings.json +7 -7
- package/src/__tests__/AbstractPackageTest.ts +2 -0
- package/src/__tests__/impl/LabrecorderAdapter.test.ts +27 -11
- package/src/__tests__/impl/LiblslAdapter.test.ts +19 -26
- package/src/__tests__/impl/LibndxAdapter.test.ts +279 -0
- package/src/__tests__/impl/LibxdfAdapter.test.ts +5 -6
- package/src/impl/LiblslAdapter.ts +119 -127
- package/src/impl/LibndxAdapter.ts +204 -0
- package/src/impl/LibxdfAdapter.ts +13 -15
- package/src/index.ts +11 -3
- package/src/lib/{handleError.ts → handleLslError.ts} +1 -1
- package/src/testDoubles/Libndx/FakeLibndx.ts +74 -0
- package/src/types.ts +7 -0
- package/tsconfig.json +24 -27
- package/build/lib/handleError.js.map +0 -1
- package/eslint.config.mjs +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibxdfAdapter.js","sourceRoot":"","sources":["../../src/impl/LibxdfAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EACH,oBAAoB,GAEvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"LibxdfAdapter.js","sourceRoot":"","sources":["../../src/impl/LibxdfAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EACH,oBAAoB,GAEvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,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AAC,kBAAkB,CAAC,UAAkB;QACtD,MAAM,SAAS,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC7C,OAAO,MAAM,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;IACnE,CAAC;IAEO,MAAM,CAAC,oBAAoB;QAC/B,OAAO,oBAAoB,CAAC,MAAM,EAAE,CAAA;IACxC,CAAC"}
|
package/build/index.d.ts
CHANGED
|
@@ -6,12 +6,16 @@ export { default as LiblslAdapter } from './impl/LiblslAdapter.js';
|
|
|
6
6
|
export * from './impl/LiblslAdapter.js';
|
|
7
7
|
export { default as FakeLiblsl } from './testDoubles/Liblsl/FakeLiblsl.js';
|
|
8
8
|
export * from './testDoubles/Liblsl/FakeLiblsl.js';
|
|
9
|
+
export { default as LibndxAdapter } from './impl/LibndxAdapter.js';
|
|
10
|
+
export * from './impl/LibndxAdapter.js';
|
|
11
|
+
export { default as FakeLibndx } from './testDoubles/Libndx/FakeLibndx.js';
|
|
12
|
+
export * from './testDoubles/Libndx/FakeLibndx.js';
|
|
9
13
|
export { default as LibxdfAdapter } from './impl/LibxdfAdapter.js';
|
|
10
14
|
export * from './impl/LibxdfAdapter.js';
|
|
11
15
|
export { default as FakeLibxdf } from './testDoubles/Libxdf/FakeLibxdf.js';
|
|
12
16
|
export * from './testDoubles/Libxdf/FakeLibxdf.js';
|
|
13
17
|
export { default as SpyLibxdf } from './testDoubles/Libxdf/SpyLibxdf.js';
|
|
14
18
|
export * from './testDoubles/Libxdf/SpyLibxdf.js';
|
|
15
|
-
export { default as
|
|
16
|
-
export * from './lib/
|
|
19
|
+
export { default as handleLslError } from './lib/handleLslError.js';
|
|
20
|
+
export * from './lib/handleLslError.js';
|
|
17
21
|
export * from './consts.js';
|
package/build/index.js
CHANGED
|
@@ -8,6 +8,11 @@ export { default as LiblslAdapter } from './impl/LiblslAdapter.js';
|
|
|
8
8
|
export * from './impl/LiblslAdapter.js';
|
|
9
9
|
export { default as FakeLiblsl } from './testDoubles/Liblsl/FakeLiblsl.js';
|
|
10
10
|
export * from './testDoubles/Liblsl/FakeLiblsl.js';
|
|
11
|
+
// Libndx
|
|
12
|
+
export { default as LibndxAdapter } from './impl/LibndxAdapter.js';
|
|
13
|
+
export * from './impl/LibndxAdapter.js';
|
|
14
|
+
export { default as FakeLibndx } from './testDoubles/Libndx/FakeLibndx.js';
|
|
15
|
+
export * from './testDoubles/Libndx/FakeLibndx.js';
|
|
11
16
|
// Libxdf
|
|
12
17
|
export { default as LibxdfAdapter } from './impl/LibxdfAdapter.js';
|
|
13
18
|
export * from './impl/LibxdfAdapter.js';
|
|
@@ -15,9 +20,9 @@ export { default as FakeLibxdf } from './testDoubles/Libxdf/FakeLibxdf.js';
|
|
|
15
20
|
export * from './testDoubles/Libxdf/FakeLibxdf.js';
|
|
16
21
|
export { default as SpyLibxdf } from './testDoubles/Libxdf/SpyLibxdf.js';
|
|
17
22
|
export * from './testDoubles/Libxdf/SpyLibxdf.js';
|
|
18
|
-
//
|
|
19
|
-
export { default as
|
|
20
|
-
export * from './lib/
|
|
23
|
+
// handleLslError
|
|
24
|
+
export { default as handleLslError } from './lib/handleLslError.js';
|
|
25
|
+
export * from './lib/handleLslError.js';
|
|
21
26
|
// consts
|
|
22
27
|
export * from './consts.js';
|
|
23
28
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAC5E,cAAc,8BAA8B,CAAA;AAE5C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8CAA8C,CAAA;AACzF,cAAc,8CAA8C,CAAA;AAE5D,SAAS;AAET,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAClE,cAAc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A;AAElD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mCAAmC,CAAA;AACxE,cAAc,mCAAmC,CAAA;AAEjD,iBAAiB;AAEjB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACnE,cAAc,yBAAyB,CAAA;AAEvC,SAAS;AAET,cAAc,aAAa,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function
|
|
1
|
+
export default function handleLslError(errorCode) {
|
|
2
2
|
switch (errorCode) {
|
|
3
3
|
case 0:
|
|
4
4
|
return;
|
|
@@ -22,4 +22,4 @@ export var LslErrorCode;
|
|
|
22
22
|
LslErrorCode[LslErrorCode["BadArgument"] = -3] = "BadArgument";
|
|
23
23
|
LslErrorCode[LslErrorCode["InternalError"] = -4] = "InternalError";
|
|
24
24
|
})(LslErrorCode || (LslErrorCode = {}));
|
|
25
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=handleLslError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleLslError.js","sourceRoot":"","sources":["../../src/lib/handleLslError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,SAAiB;IACpD,QAAQ,SAAS,EAAE,CAAC;QAChB,KAAK,CAAC;YACF,OAAM;QACV,KAAK,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;QACpE,KAAK,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;QACvD,KAAK,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;QACnE,KAAK,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC7D;YACI,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAChE,CAAC;AACL,CAAC;AAED,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACpB,2CAAM,CAAA;IACN,sDAAY,CAAA;IACZ,gDAAS,CAAA;IACT,8DAAgB,CAAA;IAChB,kEAAkB,CAAA;AACtB,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BleBackendOptions, FtdiBackendOptions, Libndx, LibndxAdapterOptions } from '../../impl/LibndxAdapter.js';
|
|
2
|
+
export default class FakeLibndx implements Libndx {
|
|
3
|
+
static callsToConstructor: (LibndxAdapterOptions | undefined)[];
|
|
4
|
+
static callsToCreateBleBackend: BleBackendOptions[];
|
|
5
|
+
static callsToStartBleBackend: BleBackendOptions[];
|
|
6
|
+
static callsToStopBleBacked: BleBackendOptions[];
|
|
7
|
+
static callsToDestroyBleBackend: BleBackendOptions[];
|
|
8
|
+
static callsToCreateFtdiBackend: FtdiBackendOptions[];
|
|
9
|
+
static callsToStartFtdiBackend: FtdiBackendOptions[];
|
|
10
|
+
static callsToStopFtdiBackend: FtdiBackendOptions[];
|
|
11
|
+
static callsToDestroyFtdiBackend: FtdiBackendOptions[];
|
|
12
|
+
constructor(options?: LibndxAdapterOptions);
|
|
13
|
+
createBleBackend(options: BleBackendOptions): string;
|
|
14
|
+
startBleBackend(options: BleBackendOptions): string;
|
|
15
|
+
stopBleBackend(options: BleBackendOptions): string;
|
|
16
|
+
destroyBleBackend(options: BleBackendOptions): string;
|
|
17
|
+
createFtdiBackend(options: FtdiBackendOptions): string;
|
|
18
|
+
startFtdiBackend(options: FtdiBackendOptions): string;
|
|
19
|
+
stopFtdiBackend(options: FtdiBackendOptions): string;
|
|
20
|
+
destroyFtdiBackend(options: FtdiBackendOptions): string;
|
|
21
|
+
static resetTestDouble(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default class FakeLibndx {
|
|
2
|
+
static callsToConstructor = [];
|
|
3
|
+
static callsToCreateBleBackend = [];
|
|
4
|
+
static callsToStartBleBackend = [];
|
|
5
|
+
static callsToStopBleBacked = [];
|
|
6
|
+
static callsToDestroyBleBackend = [];
|
|
7
|
+
static callsToCreateFtdiBackend = [];
|
|
8
|
+
static callsToStartFtdiBackend = [];
|
|
9
|
+
static callsToStopFtdiBackend = [];
|
|
10
|
+
static callsToDestroyFtdiBackend = [];
|
|
11
|
+
constructor(options) {
|
|
12
|
+
FakeLibndx.callsToConstructor.push(options);
|
|
13
|
+
}
|
|
14
|
+
createBleBackend(options) {
|
|
15
|
+
FakeLibndx.callsToCreateBleBackend.push(options);
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
startBleBackend(options) {
|
|
19
|
+
FakeLibndx.callsToStartBleBackend.push(options);
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
stopBleBackend(options) {
|
|
23
|
+
FakeLibndx.callsToStopBleBacked.push(options);
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
destroyBleBackend(options) {
|
|
27
|
+
FakeLibndx.callsToDestroyBleBackend.push(options);
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
createFtdiBackend(options) {
|
|
31
|
+
FakeLibndx.callsToCreateFtdiBackend.push(options);
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
startFtdiBackend(options) {
|
|
35
|
+
FakeLibndx.callsToStartFtdiBackend.push(options);
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
stopFtdiBackend(options) {
|
|
39
|
+
FakeLibndx.callsToStopFtdiBackend.push(options);
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
destroyFtdiBackend(options) {
|
|
43
|
+
FakeLibndx.callsToDestroyFtdiBackend.push(options);
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
static resetTestDouble() {
|
|
47
|
+
FakeLibndx.callsToConstructor = [];
|
|
48
|
+
FakeLibndx.callsToCreateBleBackend = [];
|
|
49
|
+
FakeLibndx.callsToStartBleBackend = [];
|
|
50
|
+
FakeLibndx.callsToStopBleBacked = [];
|
|
51
|
+
FakeLibndx.callsToDestroyBleBackend = [];
|
|
52
|
+
FakeLibndx.callsToCreateFtdiBackend = [];
|
|
53
|
+
FakeLibndx.callsToStartFtdiBackend = [];
|
|
54
|
+
FakeLibndx.callsToStopFtdiBackend = [];
|
|
55
|
+
FakeLibndx.callsToDestroyFtdiBackend = [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=FakeLibndx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FakeLibndx.js","sourceRoot":"","sources":["../../../src/testDoubles/Libndx/FakeLibndx.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,OAAO,UAAU;IACpB,MAAM,CAAC,kBAAkB,GAAyC,EAAE,CAAA;IACpE,MAAM,CAAC,uBAAuB,GAAwB,EAAE,CAAA;IACxD,MAAM,CAAC,sBAAsB,GAAwB,EAAE,CAAA;IACvD,MAAM,CAAC,oBAAoB,GAAwB,EAAE,CAAA;IACrD,MAAM,CAAC,wBAAwB,GAAwB,EAAE,CAAA;IACzD,MAAM,CAAC,wBAAwB,GAAyB,EAAE,CAAA;IAC1D,MAAM,CAAC,uBAAuB,GAAyB,EAAE,CAAA;IACzD,MAAM,CAAC,sBAAsB,GAAyB,EAAE,CAAA;IACxD,MAAM,CAAC,yBAAyB,GAAyB,EAAE,CAAA;IAElE,YAAmB,OAA8B;QAC7C,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;IAEM,gBAAgB,CAAC,OAA0B;QAC9C,UAAU,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAChD,OAAO,EAAE,CAAA;IACb,CAAC;IAEM,eAAe,CAAC,OAA0B;QAC7C,UAAU,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/C,OAAO,EAAE,CAAA;IACb,CAAC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|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/eslint.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neurodevs/ndx-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Native Node.js adapters for LSL, XDF, and LabRecorder",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -20,10 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"main": "build/index.js",
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build.ci": "yarn run build.tsc && yarn run
|
|
24
|
-
"build.dev": "yarn run build.tsc --sourceMap ; yarn run
|
|
23
|
+
"build.ci": "yarn run build.tsc && yarn run lint",
|
|
24
|
+
"build.dev": "yarn run build.tsc --sourceMap ; yarn run fix.lint ; prettier --write .",
|
|
25
25
|
"build.copy-files": "mkdir -p build && rsync -avzq --exclude='*.ts' ./src/ ./build/",
|
|
26
|
-
"build.resolve-paths": "resolve-path-aliases --target build --patterns '**/*.js,**/*.d.ts'",
|
|
27
26
|
"build.tsc": "yarn run build.copy-files && tsc",
|
|
28
27
|
"clean": "yarn run clean.build",
|
|
29
28
|
"clean.all": "yarn run clean.dependencies && yarn run clean.build",
|
|
@@ -31,54 +30,39 @@
|
|
|
31
30
|
"clean.dependencies": "rm -rf node_modules/ package-lock.json yarn.lock",
|
|
32
31
|
"fix.lint": "eslint --fix --cache '**/*.ts'",
|
|
33
32
|
"lint": "eslint --cache '**/*.ts'",
|
|
34
|
-
"lint.tsc": "tsc -p . --noEmit",
|
|
35
|
-
"post.watch.build": "yarn run build.copy-files && yarn run build.resolve-paths",
|
|
36
33
|
"rebuild": "yarn run clean.all && yarn install && yarn run build.dev",
|
|
37
34
|
"update.dependencies": "yarn run clean.dependencies && yarn",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"watch.build.dev": "tsc-watch --sourceMap --onCompilationComplete 'yarn run post.watch.build'",
|
|
41
|
-
"watch.rebuild": "yarn run clean.all && yarn install && yarn run watch.build.dev",
|
|
42
|
-
"watch.tsc": "tsc -w"
|
|
35
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
36
|
+
"watch.build.dev": "tsc-watch --sourceMap --onCompilationComplete 'yarn run build.copy-files'"
|
|
43
37
|
},
|
|
44
38
|
"dependencies": {
|
|
45
39
|
"@neurodevs/node-mangled-names": "^1.0.1",
|
|
46
40
|
"ffi-rs": "^1.3.1"
|
|
47
41
|
},
|
|
48
42
|
"devDependencies": {
|
|
43
|
+
"@neurodevs/eslint-config-ndx": "^1.0.1",
|
|
49
44
|
"@neurodevs/generate-id": "^1.1.2",
|
|
50
45
|
"@neurodevs/node-tdd": "^0.2.5",
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"eslint": "^9.39.2",
|
|
55
|
-
"eslint-config-spruce": "^11.2.26",
|
|
46
|
+
"@neurodevs/prettier-config-ndx": "^1.0.1",
|
|
47
|
+
"@regressionproof/cli": "^0.9.4",
|
|
48
|
+
"@regressionproof/jest-reporter": "^0.9.4",
|
|
56
49
|
"jest": "^30.2.0",
|
|
57
50
|
"jest-circus": "^30.2.0",
|
|
58
51
|
"prettier": "^3.8.1",
|
|
59
|
-
"ts-node": "^10.9.2",
|
|
60
52
|
"tsc-watch": "^7.2.0",
|
|
61
53
|
"typescript": "^5.9.3"
|
|
62
54
|
},
|
|
63
|
-
"skill": {
|
|
64
|
-
"namespace": "ndx-native"
|
|
65
|
-
},
|
|
66
55
|
"jest": {
|
|
67
56
|
"testRunner": "jest-circus/runner",
|
|
68
57
|
"maxWorkers": 4,
|
|
69
|
-
"testTimeout":
|
|
58
|
+
"testTimeout": 5000,
|
|
70
59
|
"testEnvironment": "node",
|
|
71
|
-
"testPathIgnorePatterns": [
|
|
72
|
-
"<rootDir>/tmp/",
|
|
73
|
-
"<rootDir>/src/",
|
|
74
|
-
"<rootDir>/node_modules/",
|
|
75
|
-
"<rootDir>/build/__tests__/testDirsAndFiles/"
|
|
76
|
-
],
|
|
77
60
|
"testMatch": [
|
|
78
|
-
"
|
|
61
|
+
"<rootDir>/build/__tests__/**/*.test.js?(x)"
|
|
79
62
|
],
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
63
|
+
"reporters": [
|
|
64
|
+
"default",
|
|
65
|
+
"@regressionproof/jest-reporter"
|
|
66
|
+
]
|
|
83
67
|
}
|
|
84
68
|
}
|
|
@@ -10,6 +10,8 @@ export default abstract class AbstractPackageTest extends AbstractModuleTest {
|
|
|
10
10
|
protected static readonly channelCount = this.channelNames.length
|
|
11
11
|
protected static readonly chunkSize = 2
|
|
12
12
|
|
|
13
|
+
protected static readonly fakeErrorMessage = 'Fake error message!'
|
|
14
|
+
|
|
13
15
|
protected static async beforeEach() {
|
|
14
16
|
await super.beforeEach()
|
|
15
17
|
}
|
|
@@ -38,16 +38,20 @@ export default class LabrecorderAdapterTest extends AbstractPackageTest {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@test()
|
|
41
|
-
protected static async
|
|
42
|
-
assert.isTruthy(this.instance, '
|
|
41
|
+
protected static async createsInstance() {
|
|
42
|
+
assert.isTruthy(this.instance, 'Failed to create instance!')
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
@test()
|
|
46
46
|
protected static async callsFfiRsOpenWithRequiredOptions() {
|
|
47
|
-
assert.isEqualDeep(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
assert.isEqualDeep(
|
|
48
|
+
this.ffiRsOpenOptions,
|
|
49
|
+
{
|
|
50
|
+
library: 'labrecorder',
|
|
51
|
+
path: this.labrecorderPath,
|
|
52
|
+
},
|
|
53
|
+
'Did not pass valid options to ffiRsOpen!'
|
|
54
|
+
)
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
@test()
|
|
@@ -81,7 +85,7 @@ export default class LabrecorderAdapterTest extends AbstractPackageTest {
|
|
|
81
85
|
],
|
|
82
86
|
},
|
|
83
87
|
},
|
|
84
|
-
'
|
|
88
|
+
'Did not pass valid options to ffiRsDefine!'
|
|
85
89
|
)
|
|
86
90
|
}
|
|
87
91
|
|
|
@@ -96,7 +100,7 @@ export default class LabrecorderAdapterTest extends AbstractPackageTest {
|
|
|
96
100
|
watchFor: this.watchFor,
|
|
97
101
|
watchForCount: this.watchFor.length,
|
|
98
102
|
},
|
|
99
|
-
'
|
|
103
|
+
'Did not create a recording!'
|
|
100
104
|
)
|
|
101
105
|
}
|
|
102
106
|
|
|
@@ -107,7 +111,11 @@ export default class LabrecorderAdapterTest extends AbstractPackageTest {
|
|
|
107
111
|
|
|
108
112
|
const { path } = this.ffiRsOpenOptions ?? {}
|
|
109
113
|
|
|
110
|
-
assert.isEqual(
|
|
114
|
+
assert.isEqual(
|
|
115
|
+
path,
|
|
116
|
+
defaultLabrecorderPath,
|
|
117
|
+
'Did not use default macOS path!'
|
|
118
|
+
)
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
@test()
|
|
@@ -115,14 +123,22 @@ export default class LabrecorderAdapterTest extends AbstractPackageTest {
|
|
|
115
123
|
const recording = this.createRecording()
|
|
116
124
|
this.stopRecording(recording)
|
|
117
125
|
|
|
118
|
-
assert.isEqualDeep(
|
|
126
|
+
assert.isEqualDeep(
|
|
127
|
+
this.callsToRecordingStop[0],
|
|
128
|
+
recording,
|
|
129
|
+
'Did not stop recording!'
|
|
130
|
+
)
|
|
119
131
|
}
|
|
120
132
|
|
|
121
133
|
@test()
|
|
122
134
|
protected static async deleteRecordingCallsBindings() {
|
|
123
135
|
const recording = this.createAndDeleteRecording()
|
|
124
136
|
|
|
125
|
-
assert.isEqualDeep(
|
|
137
|
+
assert.isEqualDeep(
|
|
138
|
+
this.callsToRecordingDelete[0],
|
|
139
|
+
recording,
|
|
140
|
+
'Did not delete recording!'
|
|
141
|
+
)
|
|
126
142
|
}
|
|
127
143
|
|
|
128
144
|
private static createAndDeleteRecording() {
|
|
@@ -133,7 +133,7 @@ export default class LiblslAdapterTest extends AbstractPackageTest {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
@test()
|
|
136
|
-
protected static async
|
|
136
|
+
protected static async callsFfiRsOpenWithRequiredOptions() {
|
|
137
137
|
assert.isEqualDeep(this.ffiRsOpenOptions, {
|
|
138
138
|
library: 'lsl',
|
|
139
139
|
path: process.env.LIBLSL_PATH,
|
|
@@ -141,27 +141,13 @@ export default class LiblslAdapterTest extends AbstractPackageTest {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
@test()
|
|
144
|
-
protected static async
|
|
145
|
-
const liblsl = LiblslAdapter.getInstance()
|
|
146
|
-
//@ts-ignore
|
|
147
|
-
assert.isInstanceOf(liblsl, LiblslAdapter)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
@test()
|
|
151
|
-
protected static async singletonIsTheSame() {
|
|
152
|
-
assert.isEqual(LiblslAdapter.getInstance(), LiblslAdapter.getInstance())
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@test()
|
|
156
|
-
protected static canSetInstance() {
|
|
157
|
-
const fake = new FakeLiblsl()
|
|
158
|
-
LiblslAdapter.setInstance(fake)
|
|
159
|
-
assert.isEqual(LiblslAdapter.getInstance(), fake)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
@test()
|
|
163
|
-
protected static async createsExpectedBindingsWithFfiRs() {
|
|
144
|
+
protected static async callsFfiRsDefineWithRequiredOptions() {
|
|
164
145
|
assert.isEqualDeep(this.ffiRsDefineOptions, {
|
|
146
|
+
lsl_local_clock: {
|
|
147
|
+
library: 'lsl',
|
|
148
|
+
retType: DataType.Double,
|
|
149
|
+
paramsType: [],
|
|
150
|
+
},
|
|
165
151
|
lsl_create_streaminfo: {
|
|
166
152
|
library: 'lsl',
|
|
167
153
|
retType: DataType.External,
|
|
@@ -251,14 +237,21 @@ export default class LiblslAdapterTest extends AbstractPackageTest {
|
|
|
251
237
|
DataType.String,
|
|
252
238
|
],
|
|
253
239
|
},
|
|
254
|
-
lsl_local_clock: {
|
|
255
|
-
library: 'lsl',
|
|
256
|
-
retType: DataType.Double,
|
|
257
|
-
paramsType: [],
|
|
258
|
-
},
|
|
259
240
|
})
|
|
260
241
|
}
|
|
261
242
|
|
|
243
|
+
@test()
|
|
244
|
+
protected static async getInstanceReturnsASingleton() {
|
|
245
|
+
assert.isEqual(LiblslAdapter.getInstance(), LiblslAdapter.getInstance())
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@test()
|
|
249
|
+
protected static canSetInstance() {
|
|
250
|
+
const fake = new FakeLiblsl()
|
|
251
|
+
LiblslAdapter.setInstance(fake)
|
|
252
|
+
assert.isEqual(LiblslAdapter.getInstance(), fake)
|
|
253
|
+
}
|
|
254
|
+
|
|
262
255
|
@test()
|
|
263
256
|
protected static async createsStreamInfoWithRequiredParams() {
|
|
264
257
|
const options = this.generateRandomCreateStreamInfoOptions()
|