diff --git a/package-lock.json b/package-lock.json index 280217a3..2c2497e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2075,10 +2075,6 @@ "resolved": "packages/plugin-preload", "link": true }, - "node_modules/@jspsych/plugin-rdk": { - "resolved": "packages/plugin-rdk", - "link": true - }, "node_modules/@jspsych/plugin-reconstruction": { "resolved": "packages/plugin-reconstruction", "link": true @@ -2147,14 +2143,6 @@ "resolved": "packages/plugin-visual-search-circle", "link": true }, - "node_modules/@jspsych/plugin-vsl-animate-occlusion": { - "resolved": "packages/plugin-vsl-animate-occlusion", - "link": true - }, - "node_modules/@jspsych/plugin-vsl-grid-scene": { - "resolved": "packages/plugin-vsl-grid-scene", - "link": true - }, "node_modules/@jspsych/plugin-webgazer-calibrate": { "resolved": "packages/plugin-webgazer-calibrate", "link": true @@ -2167,6 +2155,10 @@ "resolved": "packages/plugin-webgazer-validate", "link": true }, + "node_modules/@jspsych/test-utils": { + "resolved": "packages/test-utils", + "link": true + }, "node_modules/@mapbox/node-pre-gyp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.5.tgz", @@ -3722,15 +3714,6 @@ "url": "https://bevry.me/fund" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4043,24 +4026,6 @@ "node": ">=0.10.0" } }, - "node_modules/chokidar/node_modules/fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "deprecated": "fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - }, - "engines": { - "node": ">= 4.0" - } - }, "node_modules/chokidar/node_modules/is-accessor-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", @@ -5181,12 +5146,6 @@ "bser": "2.1.1" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "optional": true - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -5564,19 +5523,6 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -6041,6 +5987,13 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" }, + "node_modules/growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "optional": true, + "peer": true + }, "node_modules/gulp": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz", @@ -6743,9 +6696,9 @@ } }, "node_modules/is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.7.0.tgz", + "integrity": "sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==", "dependencies": { "has": "^1.0.3" }, @@ -6797,6 +6750,22 @@ "node": ">=0.10.0" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "optional": true, + "peer": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -6968,6 +6937,19 @@ "node": ">=0.10.0" } }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "optional": true, + "peer": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -8837,6 +8819,37 @@ "node": ">=0.10.0" } }, + "node_modules/node-notifier": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-10.0.0.tgz", + "integrity": "sha512-ZTqP90y1eyb2xAZTa7j4AlAayTwh6cL8mn0nlJhLDq8itXGnJUmQGYOnpaMUvqZVfGo0vhU7KZ3HtDW6CT2SiQ==", + "optional": true, + "peer": true, + "dependencies": { + "growly": "^1.3.0", + "is-wsl": "^2.2.0", + "semver": "^7.3.5", + "shellwords": "^0.1.1", + "uuid": "^8.3.2", + "which": "^2.0.2" + } + }, + "node_modules/node-notifier/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "optional": true, + "peer": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/node-releases": { "version": "1.1.73", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.73.tgz", @@ -10335,6 +10348,13 @@ "node": ">=8" } }, + "node_modules/shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "optional": true, + "peer": true + }, "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -11408,6 +11428,16 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "optional": true, + "peer": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-to-istanbul": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.0.0.tgz", @@ -11827,7 +11857,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11840,7 +11871,8 @@ "auto-bind": "^4.0.0" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "packages/plugin-animation": { @@ -11848,7 +11880,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11859,7 +11892,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11870,7 +11904,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11881,7 +11916,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11892,7 +11928,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11903,7 +11940,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11914,7 +11952,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11925,7 +11964,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11936,7 +11976,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11947,7 +11988,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11958,7 +12000,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11969,7 +12012,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11980,7 +12024,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -11991,7 +12036,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12002,7 +12048,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12013,7 +12060,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12024,7 +12072,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12035,7 +12084,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12046,7 +12096,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12057,7 +12108,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12068,7 +12120,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12079,7 +12132,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12090,7 +12144,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12101,7 +12156,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12112,7 +12168,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12135,9 +12192,11 @@ "packages/plugin-rdk": { "name": "@jspsych/plugin-rdk", "version": "1.0.0", + "extraneous": true, "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12148,7 +12207,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12159,7 +12219,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12170,7 +12231,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12181,7 +12243,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12192,7 +12255,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12203,7 +12267,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12214,7 +12279,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12225,7 +12291,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12236,7 +12303,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12247,7 +12315,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12258,7 +12327,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12269,7 +12339,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12280,7 +12351,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12291,7 +12363,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12302,7 +12375,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12313,7 +12387,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12324,7 +12399,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12333,9 +12409,11 @@ "packages/plugin-vsl-animate-occlusion": { "name": "@jspsych/plugin-vsl-animate-occlusion", "version": "1.0.0", + "extraneous": true, "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12344,9 +12422,11 @@ "packages/plugin-vsl-grid-scene": { "name": "@jspsych/plugin-vsl-grid-scene", "version": "1.0.0", + "extraneous": true, "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12357,7 +12437,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12368,7 +12449,8 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -12379,7 +12461,20 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" + }, + "peerDependencies": { + "jspsych": ">=7" + } + }, + "packages/test-utils": { + "name": "@jspsych/test-utils", + "version": "0.1.0", + "license": "MIT", + "devDependencies": { + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" }, "peerDependencies": { "jspsych": ">=7" @@ -13741,7 +13836,7 @@ "@jspsych/config": { "version": "file:packages/config", "requires": { - "@babel/cli": "*", + "@babel/cli": "^7.15.4", "@babel/core": "^7.14.6", "@babel/preset-env": "^7.14.7", "@rollup/plugin-babel": "^5.3.0", @@ -13750,7 +13845,7 @@ "@rollup/plugin-node-resolve": "^13.0.0", "@types/gulp": "^4.0.9", "@types/jest": "^26.0.23", - "babel-preset-minify": "*", + "babel-preset-minify": "^0.5.1", "canvas": "^2.8.0", "gulp": "^4.0.2", "gulp-cli": "^2.3.0", @@ -13771,157 +13866,183 @@ "@jspsych/extension-webgazer": { "version": "file:packages/extension-webgazer", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-animation": { "version": "file:packages/plugin-animation", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-audio-button-response": { "version": "file:packages/plugin-audio-button-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-audio-keyboard-response": { "version": "file:packages/plugin-audio-keyboard-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-audio-slider-response": { "version": "file:packages/plugin-audio-slider-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-call-function": { "version": "file:packages/plugin-call-function", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-canvas-button-response": { "version": "file:packages/plugin-canvas-button-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-canvas-keyboard-response": { "version": "file:packages/plugin-canvas-keyboard-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-canvas-slider-response": { "version": "file:packages/plugin-canvas-slider-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-categorize-animation": { "version": "file:packages/plugin-categorize-animation", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-categorize-html": { "version": "file:packages/plugin-categorize-html", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-categorize-image": { "version": "file:packages/plugin-categorize-image", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-cloze": { "version": "file:packages/plugin-cloze", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-external-html": { "version": "file:packages/plugin-external-html", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-free-sort": { "version": "file:packages/plugin-free-sort", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-fullscreen": { "version": "file:packages/plugin-fullscreen", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-html-button-response": { "version": "file:packages/plugin-html-button-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-html-keyboard-response": { "version": "file:packages/plugin-html-keyboard-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-html-slider-response": { "version": "file:packages/plugin-html-slider-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-iat-html": { "version": "file:packages/plugin-iat-html", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-iat-image": { "version": "file:packages/plugin-iat-image", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-image-button-response": { "version": "file:packages/plugin-image-button-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-image-keyboard-response": { "version": "file:packages/plugin-image-keyboard-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-image-slider-response": { "version": "file:packages/plugin-image-slider-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-instructions": { "version": "file:packages/plugin-instructions", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-maxdiff": { "version": "file:packages/plugin-maxdiff", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-preload": { @@ -13933,142 +14054,151 @@ "@jspsych/plugin-video-keyboard-response": "*" } }, - "@jspsych/plugin-rdk": { - "version": "file:packages/plugin-rdk", - "requires": { - "@jspsych/config": "^0.1.0" - } - }, "@jspsych/plugin-reconstruction": { "version": "file:packages/plugin-reconstruction", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-resize": { "version": "file:packages/plugin-resize", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-same-different-html": { "version": "file:packages/plugin-same-different-html", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-same-different-image": { "version": "file:packages/plugin-same-different-image", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-serial-reaction-time": { "version": "file:packages/plugin-serial-reaction-time", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-serial-reaction-time-mouse": { "version": "file:packages/plugin-serial-reaction-time-mouse", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-survey-html-form": { "version": "file:packages/plugin-survey-html-form", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-survey-likert": { "version": "file:packages/plugin-survey-likert", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-survey-multi-choice": { "version": "file:packages/plugin-survey-multi-choice", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-survey-multi-select": { "version": "file:packages/plugin-survey-multi-select", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-survey-text": { "version": "file:packages/plugin-survey-text", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-template": { "version": "file:packages/plugin-template", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-video-button-response": { "version": "file:packages/plugin-video-button-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-video-keyboard-response": { "version": "file:packages/plugin-video-keyboard-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-video-slider-response": { "version": "file:packages/plugin-video-slider-response", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-virtual-chinrest": { "version": "file:packages/plugin-virtual-chinrest", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-visual-search-circle": { "version": "file:packages/plugin-visual-search-circle", "requires": { - "@jspsych/config": "^0.1.0" - } - }, - "@jspsych/plugin-vsl-animate-occlusion": { - "version": "file:packages/plugin-vsl-animate-occlusion", - "requires": { - "@jspsych/config": "^0.1.0" - } - }, - "@jspsych/plugin-vsl-grid-scene": { - "version": "file:packages/plugin-vsl-grid-scene", - "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-webgazer-calibrate": { "version": "file:packages/plugin-webgazer-calibrate", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-webgazer-init-camera": { "version": "file:packages/plugin-webgazer-init-camera", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@jspsych/plugin-webgazer-validate": { "version": "file:packages/plugin-webgazer-validate", "requires": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" + } + }, + "@jspsych/test-utils": { + "version": "file:packages/test-utils", + "requires": { + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } }, "@mapbox/node-pre-gyp": { @@ -15354,15 +15484,6 @@ "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.3.0.tgz", "integrity": "sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==" }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -15598,16 +15719,6 @@ "to-regex-range": "^2.1.0" } }, - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, "is-accessor-descriptor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", @@ -16496,12 +16607,6 @@ "bser": "2.1.1" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "optional": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -16800,12 +16905,6 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "optional": true - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -17176,6 +17275,13 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "optional": true, + "peer": true + }, "gulp": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz", @@ -17733,9 +17839,9 @@ } }, "is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.7.0.tgz", + "integrity": "sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==", "requires": { "has": "^1.0.3" } @@ -17774,6 +17880,13 @@ "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", "dev": true }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "optional": true, + "peer": true + }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -17894,6 +18007,16 @@ "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "optional": true, + "peer": true, + "requires": { + "is-docker": "^2.0.0" + } + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -18587,6 +18710,7 @@ "version": "file:packages/jspsych", "requires": { "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0", "auto-bind": "^4.0.0" } }, @@ -19332,6 +19456,33 @@ "resolved": "https://registry.npmjs.org/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz", "integrity": "sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=" }, + "node-notifier": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-10.0.0.tgz", + "integrity": "sha512-ZTqP90y1eyb2xAZTa7j4AlAayTwh6cL8mn0nlJhLDq8itXGnJUmQGYOnpaMUvqZVfGo0vhU7KZ3HtDW6CT2SiQ==", + "optional": true, + "peer": true, + "requires": { + "growly": "^1.3.0", + "is-wsl": "^2.2.0", + "semver": "^7.3.5", + "shellwords": "^0.1.1", + "uuid": "^8.3.2", + "which": "^2.0.2" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "optional": true, + "peer": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, "node-releases": { "version": "1.1.73", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.73.tgz", @@ -20486,6 +20637,13 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "optional": true, + "peer": true + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -21314,6 +21472,13 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "optional": true, + "peer": true + }, "v8-to-istanbul": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.0.0.tgz", diff --git a/packages/config/gulp.js b/packages/config/gulp.js index 602b7923..4d11c895 100644 --- a/packages/config/gulp.js +++ b/packages/config/gulp.js @@ -1,3 +1,5 @@ +import { sep as pathSeparator } from "path"; + import gulp from "gulp"; import rename from "gulp-rename"; import replace from "gulp-replace"; @@ -13,7 +15,7 @@ export const createCoreDistArchive = () => // Rename dist files .pipe( rename((path) => { - const packageName = path.dirname.split("/")[0]; + const packageName = path.dirname.split(pathSeparator)[0]; path.dirname = "/dist"; path.basename = packageName; diff --git a/packages/config/rollup.js b/packages/config/rollup.js index 97e11cff..af44a62c 100644 --- a/packages/config/rollup.js +++ b/packages/config/rollup.js @@ -7,7 +7,12 @@ import { terser } from "rollup-plugin-terser"; import typescript from "rollup-plugin-typescript2"; import ts from "typescript"; -const makeConfig = (outputOptions, globalOptions = {}, iifeOutputOptions = {}) => { +const makeConfig = ({ + outputOptions = {}, + globalOptions = {}, + iifeOutputOptions = {}, + nodeOnly = false, +}) => { const source = "src/index"; const destination = "dist/index"; @@ -39,34 +44,38 @@ const makeConfig = (outputOptions, globalOptions = {}, iifeOutputOptions = {}) = ...globalOptions, }); - return defineConfig([ + /** @type {import("rollup").OutputOptions} */ + const output = [ { - // Non-babel builds - ...commonConfig, - output: [ - { - // Build file to be used as an ES import - file: `${destination}.js`, - format: "esm", - ...outputOptions, - }, - { - // Build commonjs module (for tools that do not fully support ES6 modules) - file: `${destination}.cjs`, - format: "cjs", - ...outputOptions, - }, - { - // Build file to be used for tinkering in modern browsers - file: `${destination}.browser.js`, - format: "iife", - ...outputOptions, - ...iifeOutputOptions, - }, - ], + // Build file to be used as an ES import + file: `${destination}.js`, + format: "esm", + ...outputOptions, }, { - // Babel build + // Build commonjs module (for tools that do not fully support ES6 modules) + file: `${destination}.cjs`, + format: "cjs", + ...outputOptions, + }, + ]; + + if (!nodeOnly) { + output.push({ + // Build file to be used for tinkering in modern browsers + file: `${destination}.browser.js`, + format: "iife", + ...outputOptions, + ...iifeOutputOptions, + }); + } + + // Non-babel builds + const config = defineConfig([{ ...commonConfig, output }]); + + if (!nodeOnly) { + // Babel build + config.push({ ...commonConfig, plugins: commonConfig.plugins.concat( babel({ @@ -84,8 +93,10 @@ const makeConfig = (outputOptions, globalOptions = {}, iifeOutputOptions = {}) = ...iifeOutputOptions, }, ], - }, - ]); + }); + } + + return config; }; /** @@ -96,24 +107,32 @@ const makeConfig = (outputOptions, globalOptions = {}, iifeOutputOptions = {}) = * global scope in browser builds */ export const makeRollupConfig = (iifeName) => - makeConfig( - { + makeConfig({ + outputOptions: { exports: "default", globals: { jspsych: "jsPsychModule" }, }, - { external: ["jspsych"] }, - { name: iifeName } - ); + globalOptions: { external: ["jspsych"] }, + iifeOutputOptions: { name: iifeName }, + }); /** * Returns the rollup configuration for the core `jspsych` package. */ export const makeCoreRollupConfig = () => - makeConfig( - { + makeConfig({ + outputOptions: { exports: "named", name: "jsPsychModule", }, - {}, - { footer: "var initJsPsych = jsPsychModule.initJsPsych;" } - ); + iifeOutputOptions: { footer: "var initJsPsych = jsPsychModule.initJsPsych;" }, + }); + +/** + * Returns the rollup configuration for Node.js-only packages + */ +export const makeNodeRollupConfig = () => + makeConfig({ + globalOptions: { external: ["jspsych"] }, + nodeOnly: true, + }); diff --git a/packages/config/tsconfig.contrib.json b/packages/config/tsconfig.contrib.json index 4f38be33..07064963 100644 --- a/packages/config/tsconfig.contrib.json +++ b/packages/config/tsconfig.contrib.json @@ -1,9 +1,9 @@ { - // ts-config for the jspsych-dist monorepo + // tsconfig for the jspsych-contrib monorepo "extends": "@jspsych/config/tsconfig.json", "compilerOptions": { - // map jspsych-contrib package imports directly to their source files "paths": { + // map jspsych-contrib package imports directly to their source files "@jspsych-contrib/*": ["../*/src"] } } diff --git a/packages/config/tsconfig.core.json b/packages/config/tsconfig.core.json index 5ffb812d..50fedd53 100644 --- a/packages/config/tsconfig.core.json +++ b/packages/config/tsconfig.core.json @@ -4,7 +4,6 @@ "compilerOptions": { // map package imports directly to their source files "paths": { - "jspsych/tests": ["../jspsych/tests"], "jspsych": ["../jspsych/src"], "@jspsych/*": ["../*/src"] }, diff --git a/packages/config/tsconfig.json b/packages/config/tsconfig.json index 7c6033d2..dd88bc8c 100644 --- a/packages/config/tsconfig.json +++ b/packages/config/tsconfig.json @@ -1,6 +1,6 @@ { // shared base tsconfig for all jsPsych packages - // based on https://github.com/formium/tsdx/blob/462af2d002987f985695b98400e0344b8f2754b7/templates/basic/tsconfig.json<<<< + // based on https://github.com/formium/tsdx/blob/462af2d002987f985695b98400e0344b8f2754b7/templates/basic/tsconfig.json // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs "compilerOptions": { "target": "ES6", @@ -27,10 +27,7 @@ "skipLibCheck": true, // error out if import and file system have a casing mismatch. Recommended by TS "forceConsistentCasingInFileNames": true, - // do note emit build output when running `tsc` - "noEmit": true, - // allow resolving json modules in tests (needed for transitive imports of jspsych in tests; - // the jspsych package itself uses https://stackoverflow.com/a/61426303 instead) - "resolveJsonModule": true + // do not emit build output when running `tsc` + "noEmit": true } } diff --git a/packages/extension-webgazer/package.json b/packages/extension-webgazer/package.json index 0ed329bf..c86adf53 100644 --- a/packages/extension-webgazer/package.json +++ b/packages/extension-webgazer/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/jspsych/package.json b/packages/jspsych/package.json index 28926400..af879794 100644 --- a/packages/jspsych/package.json +++ b/packages/jspsych/package.json @@ -44,6 +44,7 @@ "auto-bind": "^4.0.0" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/jspsych/tests/core/case-sensitive-responses.test.ts b/packages/jspsych/tests/core/case-sensitive-responses.test.ts index 62585dc1..cf3288c3 100644 --- a/packages/jspsych/tests/core/case-sensitive-responses.test.ts +++ b/packages/jspsych/tests/core/case-sensitive-responses.test.ts @@ -1,6 +1,5 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; - -import { pressKey, startTimeline } from "../utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; describe("case_sensitive_responses parameter", () => { test("has a default value of false", async () => { diff --git a/packages/jspsych/tests/core/css-classes-parameter.test.ts b/packages/jspsych/tests/core/css-classes-parameter.test.ts index 97c0fea8..61dabd22 100644 --- a/packages/jspsych/tests/core/css-classes-parameter.test.ts +++ b/packages/jspsych/tests/core/css-classes-parameter.test.ts @@ -1,7 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; describe("The css_classes parameter for trials", () => { test("Adds a single CSS class to the root jsPsych element", async () => { diff --git a/packages/jspsych/tests/core/default-iti.test.ts b/packages/jspsych/tests/core/default-iti.test.ts index dd7bab2e..ff8a3a1c 100644 --- a/packages/jspsych/tests/core/default-iti.test.ts +++ b/packages/jspsych/tests/core/default-iti.test.ts @@ -1,7 +1,6 @@ import { jest } from "@jest/globals"; import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; - -import { pressKey, startTimeline } from "../utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; jest.useFakeTimers(); diff --git a/packages/jspsych/tests/core/default-parameters.test.ts b/packages/jspsych/tests/core/default-parameters.test.ts index 1ea6fc2f..23fd22c7 100644 --- a/packages/jspsych/tests/core/default-parameters.test.ts +++ b/packages/jspsych/tests/core/default-parameters.test.ts @@ -1,6 +1,5 @@ import surveyText from "@jspsych/plugin-survey-text"; - -import { startTimeline } from "../utils"; +import { startTimeline } from "@jspsych/test-utils"; describe("nested defaults", () => { test("work in basic situation", async () => { diff --git a/packages/jspsych/tests/core/endexperiment.test.ts b/packages/jspsych/tests/core/endexperiment.test.ts index 8e100755..ab0f0770 100644 --- a/packages/jspsych/tests/core/endexperiment.test.ts +++ b/packages/jspsych/tests/core/endexperiment.test.ts @@ -1,7 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { flushPromises, pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { flushPromises, pressKey, startTimeline } from "../utils"; test("works on basic timeline", async () => { const jsPsych = initJsPsych(); diff --git a/packages/jspsych/tests/core/events.test.ts b/packages/jspsych/tests/core/events.test.ts index dcfd52be..8feac710 100644 --- a/packages/jspsych/tests/core/events.test.ts +++ b/packages/jspsych/tests/core/events.test.ts @@ -1,8 +1,8 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; import htmlSliderResponse from "@jspsych/plugin-html-slider-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; jest.useFakeTimers(); diff --git a/packages/jspsych/tests/core/functions-as-parameters.test.ts b/packages/jspsych/tests/core/functions-as-parameters.test.ts index 28f1bf0d..3fd1ffe1 100644 --- a/packages/jspsych/tests/core/functions-as-parameters.test.ts +++ b/packages/jspsych/tests/core/functions-as-parameters.test.ts @@ -2,9 +2,9 @@ import cloze from "@jspsych/plugin-cloze"; import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; import surveyMultiChoice from "@jspsych/plugin-survey-multi-choice"; import surveyText from "@jspsych/plugin-survey-text"; +import { clickTarget, pressKey, startTimeline } from "@jspsych/test-utils"; import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "../../src"; -import { clickTarget, pressKey, startTimeline } from "../utils"; describe("standard use of function as parameter", () => { test("function value is used as parameter", async () => { diff --git a/packages/jspsych/tests/core/min-rt.test.ts b/packages/jspsych/tests/core/min-rt.test.ts index 03d2fa67..6cd5b3a0 100644 --- a/packages/jspsych/tests/core/min-rt.test.ts +++ b/packages/jspsych/tests/core/min-rt.test.ts @@ -1,6 +1,5 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; - -import { pressKey, startTimeline } from "../utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; jest.useFakeTimers("modern"); diff --git a/packages/jspsych/tests/core/progressbar.test.ts b/packages/jspsych/tests/core/progressbar.test.ts index 3e156b2c..32a1b394 100644 --- a/packages/jspsych/tests/core/progressbar.test.ts +++ b/packages/jspsych/tests/core/progressbar.test.ts @@ -1,7 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; describe("automatic progress bar", () => { test("progress bar does not display by default", async () => { diff --git a/packages/jspsych/tests/core/run.test.ts b/packages/jspsych/tests/core/run.test.ts index c3100282..23258657 100644 --- a/packages/jspsych/tests/core/run.test.ts +++ b/packages/jspsych/tests/core/run.test.ts @@ -1,6 +1,5 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; - -import { flushPromises, startTimeline } from "../utils"; +import { flushPromises, startTimeline } from "@jspsych/test-utils"; describe("jsPsych.run()", () => { beforeEach(() => { diff --git a/packages/jspsych/tests/core/timeline-variables.test.ts b/packages/jspsych/tests/core/timeline-variables.test.ts index 342148b8..2e783c43 100644 --- a/packages/jspsych/tests/core/timeline-variables.test.ts +++ b/packages/jspsych/tests/core/timeline-variables.test.ts @@ -1,9 +1,9 @@ import callFunction from "@jspsych/plugin-call-function"; import htmlButtonResponse from "@jspsych/plugin-html-button-response"; import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; describe("randomize order", () => {}); diff --git a/packages/jspsych/tests/core/timelines.test.ts b/packages/jspsych/tests/core/timelines.test.ts index 188f62ac..dd8a8f0b 100644 --- a/packages/jspsych/tests/core/timelines.test.ts +++ b/packages/jspsych/tests/core/timelines.test.ts @@ -1,7 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; describe("loop function", () => { test("repeats a timeline when returns true", async () => { diff --git a/packages/jspsych/tests/data/data-csv-conversion.test.ts b/packages/jspsych/tests/data/data-csv-conversion.test.ts index 72d75d82..a7d9ef0c 100644 --- a/packages/jspsych/tests/data/data-csv-conversion.test.ts +++ b/packages/jspsych/tests/data/data-csv-conversion.test.ts @@ -1,8 +1,7 @@ import sameDifferentHtml from "@jspsych/plugin-same-different-html"; import surveyMultiSelect from "@jspsych/plugin-survey-multi-select"; import surveyText from "@jspsych/plugin-survey-text"; - -import { clickTarget, pressKey, startTimeline } from "../utils"; +import { clickTarget, pressKey, startTimeline } from "@jspsych/test-utils"; jest.useFakeTimers(); diff --git a/packages/jspsych/tests/data/data-json-conversion.test.ts b/packages/jspsych/tests/data/data-json-conversion.test.ts index 96079ba4..0862f6a5 100644 --- a/packages/jspsych/tests/data/data-json-conversion.test.ts +++ b/packages/jspsych/tests/data/data-json-conversion.test.ts @@ -2,8 +2,7 @@ import instructions from "@jspsych/plugin-instructions"; import sameDifferentHtml from "@jspsych/plugin-same-different-html"; import surveyMultiSelect from "@jspsych/plugin-survey-multi-select"; import surveyText from "@jspsych/plugin-survey-text"; - -import { clickTarget, pressKey, startTimeline } from "../utils"; +import { clickTarget, pressKey, startTimeline } from "@jspsych/test-utils"; jest.useFakeTimers(); diff --git a/packages/jspsych/tests/data/datamodule.test.ts b/packages/jspsych/tests/data/datamodule.test.ts index 3c37552f..5fb3dfb9 100644 --- a/packages/jspsych/tests/data/datamodule.test.ts +++ b/packages/jspsych/tests/data/datamodule.test.ts @@ -1,7 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; describe("Basic data recording", () => { test("should be able to get rt after running experiment", async () => { diff --git a/packages/jspsych/tests/data/dataparameter.test.ts b/packages/jspsych/tests/data/dataparameter.test.ts index 966934e0..7de1fa9f 100644 --- a/packages/jspsych/tests/data/dataparameter.test.ts +++ b/packages/jspsych/tests/data/dataparameter.test.ts @@ -1,7 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; describe("The data parameter", () => { test("should record data to a trial", async () => { diff --git a/packages/jspsych/tests/data/interactions.test.ts b/packages/jspsych/tests/data/interactions.test.ts index 5bc03e62..23dffec7 100644 --- a/packages/jspsych/tests/data/interactions.test.ts +++ b/packages/jspsych/tests/data/interactions.test.ts @@ -1,7 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "../../src"; -import { pressKey, startTimeline } from "../utils"; describe("Data recording", () => { test("record focus events", async () => { diff --git a/packages/jspsych/tests/data/trialparameters.test.ts b/packages/jspsych/tests/data/trialparameters.test.ts index e306f4d0..a239e830 100644 --- a/packages/jspsych/tests/data/trialparameters.test.ts +++ b/packages/jspsych/tests/data/trialparameters.test.ts @@ -1,8 +1,7 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; import reconstruction from "@jspsych/plugin-reconstruction"; import surveyText from "@jspsych/plugin-survey-text"; - -import { clickTarget, pressKey, startTimeline } from "../utils"; +import { clickTarget, pressKey, startTimeline } from "@jspsych/test-utils"; describe("Trial parameters in the data", () => { test("Can be added by specifying the parameter with a value of true in save_trial_parameters", async () => { diff --git a/packages/jspsych/tests/extensions/extensions.test.ts b/packages/jspsych/tests/extensions/extensions.test.ts index 1e1f4dff..36416a54 100644 --- a/packages/jspsych/tests/extensions/extensions.test.ts +++ b/packages/jspsych/tests/extensions/extensions.test.ts @@ -1,12 +1,11 @@ import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response"; +import { pressKey } from "@jspsych/test-utils"; -import { JsPsych, initJsPsych } from "../../src"; -import { pressKey } from "../utils"; +import { initJsPsych } from "../../src"; import testExtension from "./test-extension"; jest.useFakeTimers(); -// https://github.com/jspsych/jsPsych/projects/6#card-64825201 describe("jsPsych.extensions", () => { test("initialize is called at start of experiment", async () => { const jsPsych = initJsPsych({ diff --git a/packages/jspsych/tests/extensions/test-extension.ts b/packages/jspsych/tests/extensions/test-extension.ts index d33d3ac1..598127e1 100644 --- a/packages/jspsych/tests/extensions/test-extension.ts +++ b/packages/jspsych/tests/extensions/test-extension.ts @@ -1,4 +1,4 @@ -import { JsPsych, JsPsychExtension } from "jspsych"; +import { JsPsych, JsPsychExtension } from "../../src"; class TestExtension implements JsPsychExtension { static info = { diff --git a/packages/jspsych/tests/pluginAPI/pluginapi.test.ts b/packages/jspsych/tests/pluginAPI/pluginapi.test.ts index 35cdc091..c55e5c76 100644 --- a/packages/jspsych/tests/pluginAPI/pluginapi.test.ts +++ b/packages/jspsych/tests/pluginAPI/pluginapi.test.ts @@ -1,6 +1,7 @@ +import { keyDown, keyUp, pressKey } from "@jspsych/test-utils"; + import { KeyboardListenerAPI } from "../../src/modules/plugin-api/KeyboardListenerAPI"; import { TimeoutAPI } from "../../src/modules/plugin-api/TimeoutAPI"; -import { keyDown, keyUp, pressKey } from "../utils"; jest.useFakeTimers(); diff --git a/packages/jspsych/tsconfig.json b/packages/jspsych/tsconfig.json index cdd38f85..87269ce9 100644 --- a/packages/jspsych/tsconfig.json +++ b/packages/jspsych/tsconfig.json @@ -4,5 +4,5 @@ "baseUrl": ".", "resolveJsonModule": false // using https://stackoverflow.com/a/61426303 instead }, - "include": ["src", "test", "global.d.ts"] + "include": ["src", "tests", "global.d.ts"] } diff --git a/packages/plugin-animation/package.json b/packages/plugin-animation/package.json index 615d3923..90f9b0f2 100644 --- a/packages/plugin-animation/package.json +++ b/packages/plugin-animation/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-animation/src/index.spec.ts b/packages/plugin-animation/src/index.spec.ts index 70295b5a..72c75b82 100644 --- a/packages/plugin-animation/src/index.spec.ts +++ b/packages/plugin-animation/src/index.spec.ts @@ -1,4 +1,4 @@ -import { startTimeline } from "jspsych/tests/utils"; +import { startTimeline } from "@jspsych/test-utils"; import animation from "."; diff --git a/packages/plugin-audio-button-response/package.json b/packages/plugin-audio-button-response/package.json index fea2d22c..62f25bd4 100644 --- a/packages/plugin-audio-button-response/package.json +++ b/packages/plugin-audio-button-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-audio-button-response/src/index.spec.ts b/packages/plugin-audio-button-response/src/index.spec.ts index 57634a8f..4405e2f3 100644 --- a/packages/plugin-audio-button-response/src/index.spec.ts +++ b/packages/plugin-audio-button-response/src/index.spec.ts @@ -1,5 +1,5 @@ +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import { initJsPsych } from "jspsych"; -import { clickTarget, startTimeline } from "jspsych/tests/utils"; import audioButtonResponse from "."; diff --git a/packages/plugin-audio-keyboard-response/package.json b/packages/plugin-audio-keyboard-response/package.json index 6a65b8ab..d88af96e 100644 --- a/packages/plugin-audio-keyboard-response/package.json +++ b/packages/plugin-audio-keyboard-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-audio-slider-response/package.json b/packages/plugin-audio-slider-response/package.json index 817f1bcf..bfb3ddf3 100644 --- a/packages/plugin-audio-slider-response/package.json +++ b/packages/plugin-audio-slider-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-call-function/package.json b/packages/plugin-call-function/package.json index a6dcf46e..6b99ef94 100644 --- a/packages/plugin-call-function/package.json +++ b/packages/plugin-call-function/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-call-function/src/index.spec.ts b/packages/plugin-call-function/src/index.spec.ts index 803b9beb..33df9bb4 100644 --- a/packages/plugin-call-function/src/index.spec.ts +++ b/packages/plugin-call-function/src/index.spec.ts @@ -1,4 +1,4 @@ -import { startTimeline } from "jspsych/tests/utils"; +import { startTimeline } from "@jspsych/test-utils"; import callFunction from "."; diff --git a/packages/plugin-canvas-button-response/package.json b/packages/plugin-canvas-button-response/package.json index 07214524..d6338c3d 100644 --- a/packages/plugin-canvas-button-response/package.json +++ b/packages/plugin-canvas-button-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-canvas-keyboard-response/package.json b/packages/plugin-canvas-keyboard-response/package.json index b424c3ae..bec99189 100644 --- a/packages/plugin-canvas-keyboard-response/package.json +++ b/packages/plugin-canvas-keyboard-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-canvas-slider-response/package.json b/packages/plugin-canvas-slider-response/package.json index 8537586b..b0ec7115 100644 --- a/packages/plugin-canvas-slider-response/package.json +++ b/packages/plugin-canvas-slider-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-categorize-animation/package.json b/packages/plugin-categorize-animation/package.json index cfd4cb2f..e2bc889e 100644 --- a/packages/plugin-categorize-animation/package.json +++ b/packages/plugin-categorize-animation/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-categorize-animation/src/index.spec.ts b/packages/plugin-categorize-animation/src/index.spec.ts index 642bf4fc..4fabe126 100644 --- a/packages/plugin-categorize-animation/src/index.spec.ts +++ b/packages/plugin-categorize-animation/src/index.spec.ts @@ -1,4 +1,4 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import categorizeAnimation from "."; diff --git a/packages/plugin-categorize-html/package.json b/packages/plugin-categorize-html/package.json index b081a94b..918dc8ee 100644 --- a/packages/plugin-categorize-html/package.json +++ b/packages/plugin-categorize-html/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-categorize-image/package.json b/packages/plugin-categorize-image/package.json index b07733f7..d8c96cb8 100644 --- a/packages/plugin-categorize-image/package.json +++ b/packages/plugin-categorize-image/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-cloze/package.json b/packages/plugin-cloze/package.json index 0ce16865..5727a169 100644 --- a/packages/plugin-cloze/package.json +++ b/packages/plugin-cloze/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-cloze/src/index.spec.ts b/packages/plugin-cloze/src/index.spec.ts index 0c2f4b58..d6fd380f 100644 --- a/packages/plugin-cloze/src/index.spec.ts +++ b/packages/plugin-cloze/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import cloze from "."; diff --git a/packages/plugin-external-html/package.json b/packages/plugin-external-html/package.json index 6002b334..0fbe7e94 100644 --- a/packages/plugin-external-html/package.json +++ b/packages/plugin-external-html/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-free-sort/package.json b/packages/plugin-free-sort/package.json index aee01ae9..20e2c752 100644 --- a/packages/plugin-free-sort/package.json +++ b/packages/plugin-free-sort/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-free-sort/src/index.spec.ts b/packages/plugin-free-sort/src/index.spec.ts index 7f3ef755..ec158f96 100644 --- a/packages/plugin-free-sort/src/index.spec.ts +++ b/packages/plugin-free-sort/src/index.spec.ts @@ -1,4 +1,4 @@ -import { startTimeline } from "jspsych/tests/utils"; +import { startTimeline } from "@jspsych/test-utils"; import freeSort from "."; diff --git a/packages/plugin-fullscreen/package.json b/packages/plugin-fullscreen/package.json index 02b5a03f..ffcb31b8 100644 --- a/packages/plugin-fullscreen/package.json +++ b/packages/plugin-fullscreen/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-fullscreen/src/index.spec.ts b/packages/plugin-fullscreen/src/index.spec.ts index fd4e8a1b..4cb54c1f 100644 --- a/packages/plugin-fullscreen/src/index.spec.ts +++ b/packages/plugin-fullscreen/src/index.spec.ts @@ -1,4 +1,4 @@ -import { startTimeline } from "jspsych/tests/utils"; +import { startTimeline } from "@jspsych/test-utils"; import fullscreen from "."; diff --git a/packages/plugin-html-button-response/package.json b/packages/plugin-html-button-response/package.json index 07f0376d..99525c02 100644 --- a/packages/plugin-html-button-response/package.json +++ b/packages/plugin-html-button-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-html-button-response/src/index.spec.ts b/packages/plugin-html-button-response/src/index.spec.ts index 054256eb..f768522a 100644 --- a/packages/plugin-html-button-response/src/index.spec.ts +++ b/packages/plugin-html-button-response/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import htmlButtonResponse from "."; diff --git a/packages/plugin-html-keyboard-response/package.json b/packages/plugin-html-keyboard-response/package.json index 131fdfe9..f8f1003b 100644 --- a/packages/plugin-html-keyboard-response/package.json +++ b/packages/plugin-html-keyboard-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-html-keyboard-response/src/index.spec.ts b/packages/plugin-html-keyboard-response/src/index.spec.ts index ca48406b..b2e7c5af 100644 --- a/packages/plugin-html-keyboard-response/src/index.spec.ts +++ b/packages/plugin-html-keyboard-response/src/index.spec.ts @@ -1,4 +1,4 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import htmlKeyboardResponse from "."; diff --git a/packages/plugin-html-slider-response/package.json b/packages/plugin-html-slider-response/package.json index 2fa403e0..f8cb71a4 100644 --- a/packages/plugin-html-slider-response/package.json +++ b/packages/plugin-html-slider-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-html-slider-response/src/index.spec.ts b/packages/plugin-html-slider-response/src/index.spec.ts index f59a100a..734d40f7 100644 --- a/packages/plugin-html-slider-response/src/index.spec.ts +++ b/packages/plugin-html-slider-response/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import htmlSliderResponse from "."; diff --git a/packages/plugin-iat-html/package.json b/packages/plugin-iat-html/package.json index 537984fb..12260081 100644 --- a/packages/plugin-iat-html/package.json +++ b/packages/plugin-iat-html/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-iat-html/src/index.spec.ts b/packages/plugin-iat-html/src/index.spec.ts index ada8334c..7029ce42 100644 --- a/packages/plugin-iat-html/src/index.spec.ts +++ b/packages/plugin-iat-html/src/index.spec.ts @@ -1,4 +1,4 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import iatHtml from "."; diff --git a/packages/plugin-iat-image/package.json b/packages/plugin-iat-image/package.json index 6b08351e..09138aa7 100644 --- a/packages/plugin-iat-image/package.json +++ b/packages/plugin-iat-image/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-iat-image/src/index.spec.ts b/packages/plugin-iat-image/src/index.spec.ts index d39d9adf..82b3e066 100644 --- a/packages/plugin-iat-image/src/index.spec.ts +++ b/packages/plugin-iat-image/src/index.spec.ts @@ -1,4 +1,4 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import iatImage from "."; diff --git a/packages/plugin-image-button-response/package.json b/packages/plugin-image-button-response/package.json index 16c2dd2c..c189bac7 100644 --- a/packages/plugin-image-button-response/package.json +++ b/packages/plugin-image-button-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-image-button-response/src/index.spec.ts b/packages/plugin-image-button-response/src/index.spec.ts index 98844a9a..91d7829a 100644 --- a/packages/plugin-image-button-response/src/index.spec.ts +++ b/packages/plugin-image-button-response/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import imageButtonResponse from "."; diff --git a/packages/plugin-image-keyboard-response/package.json b/packages/plugin-image-keyboard-response/package.json index 319cc2bb..995737f6 100644 --- a/packages/plugin-image-keyboard-response/package.json +++ b/packages/plugin-image-keyboard-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-image-keyboard-response/src/index.spec.ts b/packages/plugin-image-keyboard-response/src/index.spec.ts index dafc3a68..2c054527 100644 --- a/packages/plugin-image-keyboard-response/src/index.spec.ts +++ b/packages/plugin-image-keyboard-response/src/index.spec.ts @@ -1,4 +1,4 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import imageKeyboardResponse from "."; diff --git a/packages/plugin-image-slider-response/package.json b/packages/plugin-image-slider-response/package.json index 911b715c..7f9f5dcd 100644 --- a/packages/plugin-image-slider-response/package.json +++ b/packages/plugin-image-slider-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-image-slider-response/src/index.spec.ts b/packages/plugin-image-slider-response/src/index.spec.ts index 40eece84..6e086247 100644 --- a/packages/plugin-image-slider-response/src/index.spec.ts +++ b/packages/plugin-image-slider-response/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import imageSliderResponse from "."; diff --git a/packages/plugin-instructions/package.json b/packages/plugin-instructions/package.json index 016c39b5..afbfd1f4 100644 --- a/packages/plugin-instructions/package.json +++ b/packages/plugin-instructions/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-instructions/src/index.spec.ts b/packages/plugin-instructions/src/index.spec.ts index e3611e26..b6dfaa86 100644 --- a/packages/plugin-instructions/src/index.spec.ts +++ b/packages/plugin-instructions/src/index.spec.ts @@ -1,4 +1,4 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import instructions from "."; diff --git a/packages/plugin-maxdiff/package.json b/packages/plugin-maxdiff/package.json index 798c38aa..0a0e9bc5 100644 --- a/packages/plugin-maxdiff/package.json +++ b/packages/plugin-maxdiff/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-maxdiff/src/index.spec.ts b/packages/plugin-maxdiff/src/index.spec.ts index 4c8beda9..5941f3b3 100644 --- a/packages/plugin-maxdiff/src/index.spec.ts +++ b/packages/plugin-maxdiff/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import maxdiff from "."; diff --git a/packages/plugin-preload/src/index.spec.ts b/packages/plugin-preload/src/index.spec.ts index 2e33fba4..25814e68 100644 --- a/packages/plugin-preload/src/index.spec.ts +++ b/packages/plugin-preload/src/index.spec.ts @@ -1,8 +1,8 @@ import audioKeyboardResponse from "@jspsych/plugin-audio-keyboard-response"; import imageKeyboardResponse from "@jspsych/plugin-image-keyboard-response"; import videoKeyboardResponse from "@jspsych/plugin-video-keyboard-response"; +import { startTimeline } from "@jspsych/test-utils"; import { JsPsych, initJsPsych } from "jspsych"; -import { startTimeline } from "jspsych/tests/utils"; import preloadPlugin from "."; diff --git a/packages/plugin-rdk/jest.config.cjs b/packages/plugin-rdk/jest.config.cjs deleted file mode 100644 index 6ac19d5c..00000000 --- a/packages/plugin-rdk/jest.config.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("@jspsych/config/jest").makePackageConfig(__dirname); diff --git a/packages/plugin-rdk/rollup.config.mjs b/packages/plugin-rdk/rollup.config.mjs deleted file mode 100644 index 6c6b4c00..00000000 --- a/packages/plugin-rdk/rollup.config.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import { makeRollupConfig } from "@jspsych/config/rollup"; - -export default makeRollupConfig("jsPsychRdk"); diff --git a/packages/plugin-rdk/src/index.spec.ts b/packages/plugin-rdk/src/index.spec.ts deleted file mode 100644 index 3661f9ab..00000000 --- a/packages/plugin-rdk/src/index.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; - -import rdk from "."; - -describe("rdk plugin", () => { - test("choices and frame data are stored as arrays", async () => { - const { getData } = await startTimeline([ - { - type: rdk, - number_of_dots: 200, - RDK_type: 3, - choices: ["a", "l"], - correct_choice: "l", - coherent_direction: 0, - }, - ]); - - pressKey("l"); - const data = getData().values()[0]; - expect(data.choices).toStrictEqual(["a", "l"]); - expect(Array.isArray(data.frame_rate_array)).toBe(true); - }); - - test("responses are scored correctly", async () => { - const trial = { - type: rdk, - number_of_dots: 200, - RDK_type: 3, - choices: ["a", "l"], - correct_choice: "l", - coherent_direction: 0, - }; - - const { getData } = await startTimeline([trial, trial]); - - pressKey("l"); - pressKey("a"); - - expect(getData().values()).toEqual([ - expect.objectContaining({ response: "l", correct: true }), - expect.objectContaining({ response: "a", correct: false }), - ]); - }); -}); diff --git a/packages/plugin-rdk/src/index.ts b/packages/plugin-rdk/src/index.ts deleted file mode 100644 index 28f905d8..00000000 --- a/packages/plugin-rdk/src/index.ts +++ /dev/null @@ -1,1404 +0,0 @@ -import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; - -const info = { - name: "rdk", - parameters: { - /** Array containing the valid key(s) that the subject can press to indicate a response. */ - choices: { - type: ParameterType.KEYS, - pretty_name: "Choices", - default: "ALL_KEYS", - }, - /** Array containing the correct key(s) for that trial. */ - correct_choice: { - type: ParameterType.KEYS, // TO DO: docs says this can be array or string - need to allow both types here? - pretty_name: "Correct choice", - default: undefined, - }, - /** The length of stimulus presentation. */ - trial_duration: { - type: ParameterType.INT, - pretty_name: "Trial duration", - default: 500, - }, - /** If true, then any valid key will end the trial. */ - response_ends_trial: { - type: ParameterType.BOOL, - pretty_name: "Response ends trial", - default: true, - }, - /** The number of RDK apertures (If more than one, make sure to separate them by setting aperture_center_x and aperture_center_y for each RDK). */ - number_of_apertures: { - type: ParameterType.INT, - pretty_name: "Number of apertures", - default: 1, - }, - /** The number of dots per set in the stimulus. */ - number_of_dots: { - type: ParameterType.INT, - pretty_name: "Number of dots", - default: 300, - }, - /** The number of sets of dots to cycle through. */ - number_of_sets: { - type: ParameterType.INT, - pretty_name: "Number of sets", - default: 1, - }, - /** The direction of coherent motion in degrees. */ - coherent_direction: { - type: ParameterType.INT, - pretty_name: "Coherent direction", - default: 0, - }, - /** The proportion of dots moving in the coherent direction. */ - coherence: { - type: ParameterType.FLOAT, - pretty_name: "Coherence", - default: 0.5, - }, - /** The proportion of dots moving in the direction opposite of the coherent direction. */ - opposite_coherence: { - type: ParameterType.FLOAT, - pretty_name: "Opposite coherence", - default: 0, - }, - /** The radius of the dots in pixels */ - dot_radius: { - type: ParameterType.INT, - pretty_name: "Dot radius", - default: 2, - }, - /** The number of frames that pass before each dot disappears and reappears somewhere else. */ - dot_life: { - type: ParameterType.INT, - pretty_name: "Dot life", - default: -1, - }, - /** The distance in pixels each dot moves per frame. */ - move_distance: { - type: ParameterType.INT, - pretty_name: "Move distance", - default: 1, - }, - /** The width of the aperture in pixels. */ - aperture_width: { - type: ParameterType.INT, - pretty_name: "Aperture width", - default: 600, - }, - /** The height of the aperture in pixels. */ - aperture_height: { - type: ParameterType.INT, - pretty_name: "Aperture height", - default: 400, - }, - /** The color of the dots. */ - dot_color: { - type: ParameterType.STRING, - pretty_name: "Dot color", - default: "white", - }, - /** The background color of the stimulus. */ - background_color: { - type: ParameterType.STRING, - pretty_name: "Background color", - default: "gray", - }, - /** The type of RDK (refer to documentation for details). */ - RDK_type: { - type: ParameterType.INT, - pretty_name: "RDK type", - default: 3, - }, - /** The shape of the aperture. */ - aperture_type: { - type: ParameterType.INT, - pretty_name: "Aperture Type", - default: 2, - }, - /** The reinsertion rule for dots that move out of the aperture. */ - reinsert_type: { - type: ParameterType.INT, - pretty_name: "Reinsert type", - default: 2, - }, - /** The x-coordinate of the center of the aperture. */ - aperture_center_x: { - type: ParameterType.INT, - pretty_name: "Aperture center X", - default: window.innerWidth / 2, - }, - /** The y-coordinate of the center of the aperture. */ - aperture_center_y: { - type: ParameterType.INT, - pretty_name: "Aperture center Y", - default: window.innerHeight / 2, - }, - /** If true, then a fixation cross will be present in the middle of the screen. */ - fixation_cross: { - type: ParameterType.BOOL, - pretty_name: "Fixation cross", - default: false, - }, - /** The width of the fixation cross in pixels. */ - fixation_cross_width: { - type: ParameterType.INT, - pretty_name: "Fixation cross width", - default: 20, - }, - /** The height of the fixation cross in pixels. */ - fixation_cross_height: { - type: ParameterType.INT, - pretty_name: "Fixation cross height", - default: 20, - }, - /** The color of the fixation cross. */ - fixation_cross_color: { - type: ParameterType.STRING, - pretty_name: "Fixation cross color", - default: "black", - }, - /** The thickness of the fixation cross. */ - fixation_cross_thickness: { - type: ParameterType.INT, - pretty_name: "Fixation cross thickness", - default: 1, - }, - /** The presence of a border around the aperture. */ - border: { - type: ParameterType.BOOL, - pretty_name: "Border", - default: false, - }, - /** The thickness of the border in pixels. */ - border_thickness: { - type: ParameterType.INT, - pretty_name: "Border width", - default: 1, - }, - /** The color of the border. */ - border_color: { - type: ParameterType.STRING, - pretty_name: "Border Color", - default: 1, - }, - }, -}; - -type Info = typeof info; - -/** - * **RDK** - * - * jsPsych plugin for showing a random-dot kinematogram stimulus and recording a keyboard response - * - * @author Sivananda Rajananda - * @see {@link https://www.jspsych.org/plugins/jspsych-rdk/ RDK plugin documentation on jspsych.org} - * @copyright - * - * This code was created in the Consciousness and Metacognition Lab at UCLA, - * under the supervision of Brian Odegaard and Hakwan Lau - * - * We would appreciate it if you cited this paper when you use the RDK: - * Rajananda, S., Lau, H. & Odegaard, B., (2018). A Random-Dot Kinematogram for Web-Based Vision Research. Journal of Open Research Software. 6(1), p.6. DOI: [http://doi.org/10.5334/jors.194] - * - * ---------------------- - * - * Copyright (C) 2017 Sivananda Rajananda - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class RdkPlugin implements JsPsychPlugin { - static info = info; - - constructor(private jsPsych: JsPsych) {} - - trial(display_element: HTMLElement, trial: TrialType) { - //-------------------------------------- - //---------SET PARAMETERS BEGIN--------- - //-------------------------------------- - - //Note on '||' logical operator: If the first option is 'undefined', it evalutes to 'false' and the second option is returned as the assignment - // Note: trial properties are now read-only, so these params have all been changed to separate variables here and throughout trial function - var choices = assignParameterValue(trial.choices, []); - var correct_choice = assignParameterValue(trial.correct_choice, undefined); - var trial_duration = assignParameterValue(trial.trial_duration, 500); - var response_ends_trial = assignParameterValue(trial.response_ends_trial, true); - var number_of_apertures = assignParameterValue(trial.number_of_apertures, 1); - var number_of_dots = assignParameterValue(trial.number_of_dots, 300); - var number_of_sets = assignParameterValue(trial.number_of_sets, 1); - var coherent_direction = assignParameterValue(trial.coherent_direction, 0); - var coherence = assignParameterValue(trial.coherence, 0.5); - var opposite_coherence = assignParameterValue(trial.opposite_coherence, 0); - var dot_radius = assignParameterValue(trial.dot_radius, 2); - var dot_life = assignParameterValue(trial.dot_life, -1); - var move_distance = assignParameterValue(trial.move_distance, 1); - var aperture_width = assignParameterValue(trial.aperture_width, 600); - var aperture_height = assignParameterValue(trial.aperture_height, 400); - var dot_color = assignParameterValue(trial.dot_color, "white"); - var background_color = assignParameterValue(trial.background_color, "gray"); - var RDK_type = assignParameterValue(trial.RDK_type, 3); - var aperture_type = assignParameterValue(trial.aperture_type, 2); - var reinsert_type = assignParameterValue(trial.reinsert_type, 2); - var aperture_center_x = assignParameterValue(trial.aperture_center_x, window.innerWidth / 2); - var aperture_center_y = assignParameterValue(trial.aperture_center_y, window.innerHeight / 2); - var fixation_cross = assignParameterValue(trial.fixation_cross, false); - var fixation_cross_width = assignParameterValue(trial.fixation_cross_width, 20); - var fixation_cross_height = assignParameterValue(trial.fixation_cross_height, 20); - var fixation_cross_color = assignParameterValue(trial.fixation_cross_color, "black"); - var fixation_cross_thickness = assignParameterValue(trial.fixation_cross_thickness, 1); - var border = assignParameterValue(trial.border, false); - var border_thickness = assignParameterValue(trial.border_thickness, 1); - var border_color = assignParameterValue(trial.border_color, "black"); - - //For square and circle, set the aperture height == aperture width - if (apertureType == 1 || apertureType == 3) { - aperture_height = aperture_width; - } - - //Convert the parameter variables to those that the code below can use - - var nApertures = number_of_apertures; //The number of apertures - var nDots = number_of_dots; //Number of dots per set (equivalent to number of dots per frame) - var nSets = number_of_sets; //Number of sets to cycle through per frame - var coherentDirection = coherent_direction; //The direction of the coherentDots in degrees. Starts at 3 o'clock and goes counterclockwise (0 == rightwards, 90 == upwards, 180 == leftwards, 270 == downwards), range 0 - 360 - var coherence = coherence; //Proportion of dots to move together, range from 0 to 1 - var oppositeCoherence = opposite_coherence; // The coherence for the dots going the opposite direction as the coherent dots - var dotRadius = dot_radius; //Radius of each dot in pixels - var dotLife = dot_life; //How many frames a dot will keep following its trajectory before it is redrawn at a random location. -1 denotes infinite life (the dot will only be redrawn if it reaches the end of the aperture). - var moveDistance = move_distance; //How many pixels the dots move per frame - var apertureWidth = aperture_width; // How many pixels wide the aperture is. For square aperture this will be the both height and width. For circle, this will be the diameter. - var apertureHeight = aperture_height; //How many pixels high the aperture is. Only relevant for ellipse and rectangle apertures. For circle and square, this is ignored. - var dotColor = dot_color; //Color of the dots - var backgroundColor = background_color; //Color of the background - var apertureCenterX = aperture_center_x; // The x-coordinate of center of the aperture on the screen, in pixels - var apertureCenterY = aperture_center_y; // The y-coordinate of center of the aperture on the screen, in pixels - - /** RDK type parameter - ** See Fig. 1 in Scase, Braddick, and Raymond (1996) for a visual depiction of these different signal selection rules and noise types - - ------------------- - SUMMARY: - - Signal Selection rule: - -Same: Each dot is designated to be either a coherent dot (signal) or incoherent dot (noise) and will remain so throughout all frames in the display. Coherent dots will always move in the direction of coherent motion in all frames. - -Different: Each dot can be either a coherent dot (signal) or incoherent dot (noise) and will be designated randomly (weighted based on the coherence level) at each frame. Only the dots that are designated to be coherent dots will move in the direction of coherent motion, but only in that frame. In the next frame, each dot will be designated randomly again on whether it is a coherent or incoherent dot. - - Noise Type: - -Random position: The incoherent dots appear in a random location in the aperture in each frame - -Random walk: The incoherent dots will move in a random direction (designated randomly in each frame) in each frame. - -Random direction: Each incoherent dot has its own alternative direction of motion (designated randomly at the beginning of the trial), and moves in that direction in each frame. - - ------------------- - - 1 - same && random position - 2 - same && random walk - 3 - same && random direction - 4 - different && random position - 5 - different && random walk - 6 - different && random direction */ - - var RDK = RDK_type; - - /** - Shape of aperture - 1 - Circle - 2 - Ellipse - 3 - Square - 4 - Rectangle - */ - var apertureType = aperture_type; - - /* - Out of Bounds Decision - How we reinsert a dot that has moved outside the edges of the aperture: - 1 - Randomly appear anywhere in the aperture - 2 - Appear on the opposite edge of the aperture (Random if square or rectangle, reflected about origin in circle and ellipse) - */ - var reinsertType = reinsert_type; - - //Fixation Cross Parameters - var fixationCross = fixation_cross; //To display or not to display the cross - var fixationCrossWidth = fixation_cross_width; //The width of the fixation cross in pixels - var fixationCrossHeight = fixation_cross_height; //The height of the fixation cross in pixels - var fixationCrossColor = fixation_cross_color; //The color of the fixation cross - var fixationCrossThickness = fixation_cross_thickness; //The thickness of the fixation cross, must be positive number above 1 - - //Border Parameters - var border = border; //To display or not to display the border - var borderThickness = border_thickness; //The width of the border in pixels - var borderColor = border_color; //The color of the border - - //-------------------------------------- - //----------SET PARAMETERS END---------- - //-------------------------------------- - - //--------Set up Canvas begin------- - - //Create a canvas element and append it to the DOM - var canvas = document.createElement("canvas"); - display_element.appendChild(canvas); - - //The document body IS 'display_element' (i.e. .... ) - var body = document.getElementsByClassName("jspsych-display-element")[0] as HTMLElement; - - //Save the current settings to be restored later - var originalMargin = body.style.margin; - var originalPadding = body.style.padding; - var originalBackgroundColor = body.style.backgroundColor; - - //Remove the margins and paddings of the display_element - body.style.margin = "0"; - body.style.padding = "0"; - body.style.backgroundColor = backgroundColor; //Match the background of the display element to the background color of the canvas so that the removal of the canvas at the end of the trial is not noticed - - //Remove the margins and padding of the canvas - canvas.style.margin = "0"; - canvas.style.padding = "0"; - // use absolute positioning in top left corner to get rid of scroll bars - canvas.style.position = "absolute"; - canvas.style.top = "0"; - canvas.style.left = "0"; - - //Get the context of the canvas so that it can be painted on. - var ctx = canvas.getContext("2d"); - - //Declare variables for width and height, and also set the canvas width and height to the window width and height - var canvasWidth = (canvas.width = window.innerWidth); - var canvasHeight = (canvas.height = window.innerHeight); - - //Set the canvas background color - canvas.style.backgroundColor = backgroundColor; - - //--------Set up Canvas end------- - - //--------RDK variables and function calls begin-------- - - //This is the main part of the trial that makes everything run - - //Global variable for the current aperture number - var currentApertureNumber; - - //3D Array to hold the dots (1st D is Apertures, 2nd D is Sets, 3rd D is Dots) - var dotArray3d = []; - - //Variables for different apertures (initialized in setUpMultipleApertures function below) - var nDotsArray; - var nSetsArray; - var coherentDirectionArray; - var coherenceArray; - var oppositeCoherenceArray; - var dotRadiusArray; - var dotLifeArray; - var moveDistanceArray; - var apertureWidthArray; - var apertureHeightArray; - var dotColorArray; - var apertureCenterXArray; - var apertureCenterYArray; - var RDKArray; - var apertureTypeArray; - var reinsertTypeArray; - var fixationCrossArray; - var fixationCrossWidthArray; - var fixationCrossHeightArray; - var fixationCrossColorArray; - var fixationCrossThicknessArray; - var borderArray; - var borderThicknessArray; - var borderColorArray; - - //Set up the variables for the apertures - const setUpMultipleApertures = () => { - nDotsArray = setParameter(nDots); - nSetsArray = setParameter(nSets); - coherentDirectionArray = setParameter(coherentDirection); - coherenceArray = setParameter(coherence); - oppositeCoherenceArray = setParameter(oppositeCoherence); - dotRadiusArray = setParameter(dotRadius); - dotLifeArray = setParameter(dotLife); - moveDistanceArray = setParameter(moveDistance); - apertureWidthArray = setParameter(apertureWidth); - apertureHeightArray = setParameter(apertureHeight); - dotColorArray = setParameter(dotColor); - apertureCenterXArray = setParameter(apertureCenterX); - apertureCenterYArray = setParameter(apertureCenterY); - RDKArray = setParameter(RDK); - apertureTypeArray = setParameter(apertureType); - reinsertTypeArray = setParameter(reinsertType); - fixationCrossArray = setParameter(fixationCross); - fixationCrossWidthArray = setParameter(fixationCrossWidth); - fixationCrossHeightArray = setParameter(fixationCrossHeight); - fixationCrossColorArray = setParameter(fixationCrossColor); - fixationCrossThicknessArray = setParameter(fixationCrossThickness); - borderArray = setParameter(border); - borderThicknessArray = setParameter(borderThickness); - borderColorArray = setParameter(borderColor); - - currentSetArray = setParameter(0); //Always starts at zero - - //Loop through the number of apertures to make the dots - for (currentApertureNumber = 0; currentApertureNumber < nApertures; currentApertureNumber++) { - //Initialize the parameters to make the 2d dot array (one for each aperture); - initializeCurrentApertureParameters(currentApertureNumber); - - //Make each 2d array and push it into the 3d array - dotArray3d.push(makeDotArray2d()); - } - }; - - // Set up multiple apertures - setUpMultipleApertures(); - - //Declare aperture parameters for initialization based on shape (used in initializeApertureDimensions function below) - var horizontalAxis; - var verticalAxis; - - //Calculate the x and y jump sizes for coherent dots - var coherentJumpSizeX; - var coherentJumpSizeY; - - //Calculate the number of coherent, opposite coherent, and incoherent dots - var nCoherentDots; - var nOppositeCoherentDots; - var nIncoherentDots; - - //Make the array of arrays containing dot objects - var dotArray2d; - - var dotArray; //Declare a global variable to hold the current array - var currentSetArray; //Declare and initialize a global variable to cycle through the dot arrays - - //Initialize stopping condition for animateDotMotion function that runs in a loop - var stopDotMotion = false; - - //Variable to control the frame rate, to ensure that the first frame is skipped because it follows a different timing - var firstFrame = true; //Used to skip the first frame in animate function below (in animateDotMotion function) - - //Variable to start the timer when the time comes - var timerHasStarted = false; - - //Initialize object to store the response data. Default values of -1 are used if the trial times out and the subject has not pressed a valid key - var response = { - rt: -1, - key: "", - }; - - //Declare a global timeout ID to be initialized below in animateDotMotion function and to be used in after_response function - var timeoutID; - - //Declare global variable to be defined in startKeyboardListener function and to be used in end_trial function - var keyboardListener; - - //Declare global variable to store the frame rate of the trial - var frameRate: number | number[] = []; //How often the monitor refreshes, in ms. Currently an array to store all the intervals. Will be converted into a single number (the average) in end_trial function. - - //variable to store how many frames were presented. - var numberOfFrames = 0; - - //Function to start the keyboard listener - const startKeyboardListener = () => { - //Start the response listener if there are choices for keys - if (choices != "NO_KEYS") { - //Create the keyboard listener to listen for subjects' key response - keyboardListener = this.jsPsych.pluginAPI.getKeyboardResponse({ - callback_function: after_response, //Function to call once the subject presses a valid key - valid_responses: choices, //The keys that will be considered a valid response and cause the callback function to be called - rt_method: "performance", //The type of method to record timing information. - persist: false, //If set to false, keyboard listener will only trigger the first time a valid key is pressed. If set to true, it has to be explicitly cancelled by the cancelKeyboardResponse plugin API. - allow_held_key: false, //Only register the key once, after this getKeyboardResponse function is called. (Check JsPsych docs for better info under 'jsPsych.pluginAPI.getKeyboardResponse'). - }); - } - }; - - //Function to end the trial proper - const end_trial = () => { - //Stop the dot motion animation - stopDotMotion = true; - - //Store the number of frames - numberOfFrames = (frameRate as number[]).length; - - //Variable to store the frame rate array - var frameRateArray = frameRate; - - //Calculate the average frame rate - if (numberOfFrames > 0) { - //Check to make sure that the array is not empty - frameRate = - (frameRate as number[]).reduce((total, current) => total + current) / numberOfFrames; //Sum up all the elements in the array - } else { - frameRate = 0; //Set to zero if the subject presses an answer before a frame is shown (i.e. if frameRate is an empty array) - } - - //Kill the keyboard listener if keyboardListener has been defined - if (typeof keyboardListener !== "undefined") { - this.jsPsych.pluginAPI.cancelKeyboardResponse(keyboardListener); - } - - //Place all the data to be saved from this trial in one data object - var trial_data = { - rt: response.rt, //The response time - response: response.key, //The key that the subject pressed - correct: correctOrNot(), //If the subject response was correct - choices: choices, //The set of valid keys - correct_choice: correct_choice, //The correct choice - trial_duration: trial_duration, //The trial duration - response_ends_trial: response_ends_trial, //If the response ends the trial - number_of_apertures: number_of_apertures, - number_of_dots: number_of_dots, - number_of_sets: number_of_sets, - coherent_direction: coherent_direction, - coherence: coherence, - opposite_coherence: opposite_coherence, - dot_radius: dot_radius, - dot_life: dot_life, - move_distance: move_distance, - aperture_width: aperture_width, - aperture_height: aperture_height, - dot_color: dot_color, - background_color: background_color, - RDK_type: RDK_type, - aperture_type: aperture_type, - reinsert_type: reinsert_type, - frame_rate: frameRate, //The average frame rate for the trial - frame_rate_array: frameRateArray, //The array of ms per frame in this trial - number_of_frames: numberOfFrames, //The number of frames in this trial - aperture_center_x: aperture_center_x, - aperture_center_y: aperture_center_y, - fixation_cross: fixation_cross, - fixation_cross_width: fixation_cross_width, - fixation_cross_height: fixation_cross_height, - fixation_cross_color: fixation_cross_color, - fixation_cross_thickness: fixation_cross_thickness, - border: border, - border_thickness: border_thickness, - border_color: border_color, - canvas_width: canvasWidth, - canvas_height: canvasHeight, - }; - - //Remove the canvas as the child of the display_element element - display_element.innerHTML = ""; - - //Restore the settings to JsPsych defaults - body.style.margin = originalMargin; - body.style.padding = originalPadding; - body.style.backgroundColor = originalBackgroundColor; - - //End this trial and move on to the next trial - this.jsPsych.finishTrial(trial_data); - }; //End of end_trial - - //This runs the dot motion simulation, updating it according to the frame refresh rate of the screen. - animateDotMotion(); - - //--------RDK variables and function calls end-------- - - //------------------------------------- - //-----------FUNCTIONS BEGIN----------- - //------------------------------------- - - //----JsPsych Functions Begin---- - - //Function to record the first response by the subject - function after_response(info) { - //If the response has not been recorded, record it - if (response.key == "") { - response = info; //Replace the response object created above - } - - //If the parameter is set such that the response ends the trial, then kill the timeout and end the trial - if (response_ends_trial) { - window.clearTimeout(timeoutID); - end_trial(); - } - } //End of after_response - - //Function that determines if the response is correct - const correctOrNot = () => { - //Check that the correct_choice has been defined - if (typeof correct_choice !== "undefined") { - // if single character, convert to array for simplicity - if (!Array.isArray(correct_choice)) { - correct_choice = [correct_choice]; - } - if (typeof correct_choice[0] === "string" || correct_choice[0] instanceof String) { - var key_in_choices = correct_choice.every((x: string) => { - return this.jsPsych.pluginAPI.compareKeys(x, response.key); - }); - return key_in_choices; //If the response is included in the correct_choice array, return true. Else, return false. - } - //Else if the elements are numbers (javascript character codes) - else if (typeof correct_choice[0] === "number") { - console.error("Error in RDK plugin: correct_choice value must be a string."); - return false; // added due to TS error: not all code paths return a value - } else { - return false; // added due to TS error: not all code paths return a value - } - } else { - return false; // added due to TS error: not all code paths return a value - } - }; - - //----JsPsych Functions End---- - - //----RDK Functions Begin---- - - //Function to set the parameters of the array - // @ts-expect-error: not all code paths return a value - function setParameter(originalVariable) { - //Check if it is an array and its length matches the aperture then return the original array - if (originalVariable.constructor === Array && originalVariable.length === nApertures) { - return originalVariable; - } - //Else if it is not an array, we make it an array with duplicate values - else if (originalVariable.constructor !== Array) { - var tempArray = []; - - //Make a for loop and duplicate the values - for (var i = 0; i < nApertures; i++) { - tempArray.push(originalVariable); - } - return tempArray; - } - //Else if the array is not long enough, then print out that error message - else if (originalVariable.constructor === Array && originalVariable.length !== nApertures) { - console.error( - "If you have more than one aperture, please ensure that arrays that are passed in as parameters are the same length as the number of apertures. Else you can use a single value without the array" - ); - } - //Else print a generic error - else { - console.error( - "A parameter is incorrectly set. Please ensure that the nApertures parameter is set to the correct value (if using more than one aperture), and all others parameters are set correctly." - ); - } - } - - //Function to set the global variables to the current aperture so that the correct dots are updated and drawn - function initializeCurrentApertureParameters(currentApertureNumber?) { - //Set the global variables to that relevant to the current aperture - nDots = nDotsArray[currentApertureNumber]; - nSets = nSetsArray[currentApertureNumber]; - coherentDirection = coherentDirectionArray[currentApertureNumber]; - coherence = coherenceArray[currentApertureNumber]; - oppositeCoherence = oppositeCoherenceArray[currentApertureNumber]; - dotRadius = dotRadiusArray[currentApertureNumber]; - dotLife = dotLifeArray[currentApertureNumber]; - moveDistance = moveDistanceArray[currentApertureNumber]; - apertureWidth = apertureWidthArray[currentApertureNumber]; - apertureHeight = apertureHeightArray[currentApertureNumber]; - dotColor = dotColorArray[currentApertureNumber]; - apertureCenterX = apertureCenterXArray[currentApertureNumber]; - apertureCenterY = apertureCenterYArray[currentApertureNumber]; - RDK = RDKArray[currentApertureNumber]; - apertureType = apertureTypeArray[currentApertureNumber]; - reinsertType = reinsertTypeArray[currentApertureNumber]; - fixationCross = fixationCrossArray[currentApertureNumber]; - fixationCrossWidth = fixationCrossWidthArray[currentApertureNumber]; - fixationCrossHeight = fixationCrossHeightArray[currentApertureNumber]; - fixationCrossColor = fixationCrossColorArray[currentApertureNumber]; - fixationCrossThickness = fixationCrossThicknessArray[currentApertureNumber]; - border = borderArray[currentApertureNumber]; - borderThickness = borderThicknessArray[currentApertureNumber]; - borderColor = borderColorArray[currentApertureNumber]; - - //Calculate the x and y jump sizes for coherent dots - coherentJumpSizeX = calculateCoherentJumpSizeX(coherentDirection); - coherentJumpSizeY = calculateCoherentJumpSizeY(coherentDirection); - - //Initialize the aperture parameters - initializeApertureDimensions(); - - //Calculate the number of coherent, opposite coherent, and incoherent dots - nCoherentDots = nDots * coherence; - nOppositeCoherentDots = nDots * oppositeCoherence; - nIncoherentDots = nDots - (nCoherentDots + nOppositeCoherentDots); - - //If the 3d array has been made, then choose the 2d array and the current set - dotArray2d = dotArray3d.length !== 0 ? dotArray3d[currentApertureNumber] : undefined; - } // End of initializeCurrentApertureParameters - - //Calculate coherent jump size in the x direction - function calculateCoherentJumpSizeX(coherentDirection) { - var angleInRadians = (coherentDirection * Math.PI) / 180; - return moveDistance * Math.cos(angleInRadians); - } - - //Calculate coherent jump size in the y direction - function calculateCoherentJumpSizeY(coherentDirection) { - var angleInRadians = (-coherentDirection * Math.PI) / 180; //Negative sign because the y-axis is flipped on screen - return moveDistance * Math.sin(angleInRadians); - } - - //Initialize the parameters for the aperture for further calculation - function initializeApertureDimensions() { - //For circle and square - if (apertureType == 1 || apertureType == 3) { - horizontalAxis = verticalAxis = apertureWidth / 2; - } - //For ellipse and rectangle - else if (apertureType == 2 || apertureType == 4) { - horizontalAxis = apertureWidth / 2; - verticalAxis = apertureHeight / 2; - } - } - - //Make the 2d array, which is an array of array of dots - function makeDotArray2d() { - //Declare an array to hold the sets of dot arrays - var tempArray = []; - //Loop for each set of dot array - for (var i = 0; i < nSets; i++) { - tempArray.push(makeDotArray()); //Make a dot array and push it into the 2d array - } - return tempArray; - } - - //Make the dot array - function makeDotArray() { - var tempArray = []; - for (var i = 0; i < nDots; i++) { - //Initialize a dot to be modified and inserted into the array - var dot = { - x: 0, //x coordinate - y: 0, //y coordinate - vx: 0, //coherent x jumpsize (if any) - vy: 0, //coherent y jumpsize (if any) - vx2: 0, //incoherent (random) x jumpsize (if any) - vy2: 0, //incoherent (random) y jumpsize (if any) - latestXMove: 0, //Stores the latest x move direction for the dot (to be used in reinsertOnOppositeEdge function below) - latestYMove: 0, //Stores the latest y move direction for the dot (to be used in reinsertOnOppositeEdge function below) - lifeCount: Math.floor(randomNumberBetween(0, dotLife)), //Counter for the dot's life. Updates every time it is shown in a frame - updateType: "", //String to determine how this dot is updated - }; - - //randomly set the x and y coordinates - dot = resetLocation(dot); - - //For the same && random position RDK type - if (RDK == 1) { - //For coherent dots - if (i < nCoherentDots) { - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "constant direction"; - } - //For opposite coherent dots - else if (i >= nCoherentDots && i < nCoherentDots + nOppositeCoherentDots) { - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "opposite direction"; - } - //For incoherent dots - else { - dot.updateType = "random position"; - } - } //End of RDK==1 - - //For the same && random walk RDK type - if (RDK == 2) { - //For coherent dots - if (i < nCoherentDots) { - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "constant direction"; - } - //For opposite coherent dots - else if (i >= nCoherentDots && i < nCoherentDots + nOppositeCoherentDots) { - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "opposite direction"; - } - //For incoherent dots - else { - dot.updateType = "random walk"; - } - } //End of RDK==2 - - //For the same && random direction RDK type - if (RDK == 3) { - //For coherent dots - if (i < nCoherentDots) { - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "constant direction"; - } - //For opposite coherent dots - else if (i >= nCoherentDots && i < nCoherentDots + nOppositeCoherentDots) { - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "opposite direction"; - } - //For incoherent dots - else { - setvx2vy2(dot); // Set dot.vx2 and dot.vy2 - dot.updateType = "random direction"; - } - } //End of RDK==3 - - //For the different && random position RDK type - if (RDK == 4) { - //For all dots - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "constant direction or opposite direction or random position"; - } //End of RDK==4 - - //For the different && random walk RDK type - if (RDK == 5) { - //For all dots - dot = setvxvy(dot); // Set dot.vx and dot.vy - dot.updateType = "constant direction or opposite direction or random walk"; - } //End of RDK==5 - - //For the different && random direction RDK type - if (RDK == 6) { - //For all dots - dot = setvxvy(dot); // Set dot.vx and dot.vy - //Each dot will have its own alternate direction of motion - setvx2vy2(dot); // Set dot.vx2 and dot.vy2 - dot.updateType = "constant direction or opposite direction or random direction"; - } //End of RDK==6 - - tempArray.push(dot); - } //End of for loop - return tempArray; - } - - //Function to update all the dots all the apertures and then draw them - function updateAndDraw() { - //Three for loops that do things in sequence: clear, update, and draw dots. - - // Clear all the current dots - for (currentApertureNumber = 0; currentApertureNumber < nApertures; currentApertureNumber++) { - //Initialize the variables for each parameter - initializeCurrentApertureParameters(currentApertureNumber); - - //Clear the canvas by drawing over the current dots - clearDots(); - } - - // Update all the relevant dots - for (currentApertureNumber = 0; currentApertureNumber < nApertures; currentApertureNumber++) { - //Initialize the variables for each parameter - initializeCurrentApertureParameters(currentApertureNumber); - - //Update the dots - updateDots(); - } - - // Draw all the relevant dots on the canvas - for (currentApertureNumber = 0; currentApertureNumber < nApertures; currentApertureNumber++) { - //Initialize the variables for each parameter - initializeCurrentApertureParameters(currentApertureNumber); - - //Draw on the canvas - draw(); - } - } - - //Function that clears the dots on the canvas by drawing over it with the color of the baclground - function clearDots() { - //Load in the current set of dot array for easy handling - var dotArray = dotArray2d[currentSetArray[currentApertureNumber]]; - - //Loop through the dots one by one and draw them - for (var i = 0; i < nDots; i++) { - const dot = dotArray[i]; - ctx.beginPath(); - ctx.arc(dot.x, dot.y, dotRadius + 1, 0, Math.PI * 2); - ctx.fillStyle = backgroundColor; - ctx.fill(); - } - } - - //Draw the dots on the canvas after they're updated - function draw() { - //Load in the current set of dot array for easy handling - var dotArray = dotArray2d[currentSetArray[currentApertureNumber]]; - - //Loop through the dots one by one and draw them - for (var i = 0; i < nDots; i++) { - const dot = dotArray[i]; - ctx.beginPath(); - ctx.arc(dot.x, dot.y, dotRadius, 0, Math.PI * 2); - ctx.fillStyle = dotColor; - ctx.fill(); - } - - //Draw the fixation cross if we want it - if (fixationCross === true) { - //Horizontal line - ctx.beginPath(); - ctx.lineWidth = fixationCrossThickness; - ctx.moveTo(canvasWidth / 2 - fixationCrossWidth, canvasHeight / 2); - ctx.lineTo(canvasWidth / 2 + fixationCrossWidth, canvasHeight / 2); - ctx.strokeStyle = fixationCrossColor; - ctx.stroke(); - - //Vertical line - ctx.beginPath(); - ctx.lineWidth = fixationCrossThickness; - ctx.moveTo(canvasWidth / 2, canvasHeight / 2 - fixationCrossHeight); - ctx.lineTo(canvasWidth / 2, canvasHeight / 2 + fixationCrossHeight); - ctx.strokeStyle = fixationCrossColor; - ctx.stroke(); - } - - //Draw the border if we want it - if (border === true) { - //For circle and ellipse - if (apertureType === 1 || apertureType === 2) { - ctx.lineWidth = borderThickness; - ctx.strokeStyle = borderColor; - ctx.beginPath(); - ctx.ellipse( - apertureCenterX, - apertureCenterY, - horizontalAxis + borderThickness / 2, - verticalAxis + borderThickness / 2, - 0, - 0, - Math.PI * 2 - ); - ctx.stroke(); - } //End of if circle or ellipse - - //For square and rectangle - if (apertureType === 3 || apertureType === 4) { - ctx.lineWidth = borderThickness; - ctx.strokeStyle = borderColor; - ctx.strokeRect( - apertureCenterX - horizontalAxis - borderThickness / 2, - apertureCenterY - verticalAxis - borderThickness / 2, - horizontalAxis * 2 + borderThickness, - verticalAxis * 2 + borderThickness - ); - } //End of if square or - } //End of if border === true - } //End of draw - - //Update the dots with their new location - function updateDots() { - //Cycle through to the next set of dots - if (currentSetArray[currentApertureNumber] == nSets - 1) { - currentSetArray[currentApertureNumber] = 0; - } else { - currentSetArray[currentApertureNumber] = currentSetArray[currentApertureNumber] + 1; - } - - //Load in the current set of dot array for easy handling - var dotArray = dotArray2d[currentSetArray[currentApertureNumber]]; - - //Load in the current set of dot array for easy handling - //dotArray = dotArray2d[currentSetArray[currentApertureNumber]]; //Global variable, so the draw function also uses this array - - //Loop through the dots one by one and update them accordingly - for (var i = 0; i < nDots; i++) { - var dot = dotArray[i]; //Load the current dot into the variable for easy handling - - //Generate a random value - var randomValue = Math.random(); - - //Update based on the dot's update type - if (dot.updateType == "constant direction") { - dot = constantDirectionUpdate(dot); - } else if (dot.updateType == "opposite direction") { - dot = oppositeDirectionUpdate(dot); - } else if (dot.updateType == "random position") { - dot = resetLocation(dot); - } else if (dot.updateType == "random walk") { - dot = randomWalkUpdate(dot); - } else if (dot.updateType == "random direction") { - dot = randomDirectionUpdate(dot); - } else if ( - dot.updateType == "constant direction or opposite direction or random position" - ) { - //Randomly select if the dot goes in a constant direction or random position, weighted based on the coherence level - if (randomValue < coherence) { - dot = constantDirectionUpdate(dot); - } else if (randomValue >= coherence && randomValue < coherence + oppositeCoherence) { - dot = oppositeDirectionUpdate(dot); - } else { - dot = resetLocation(dot); - } - } else if (dot.updateType == "constant direction or opposite direction or random walk") { - //Randomly select if the dot goes in a constant direction or random walk, weighted based on the coherence level - if (randomValue < coherence) { - dot = constantDirectionUpdate(dot); - } else if (randomValue >= coherence && randomValue < coherence + oppositeCoherence) { - dot = oppositeDirectionUpdate(dot); - } else { - dot = randomWalkUpdate(dot); - } - } else if ( - dot.updateType == "constant direction or opposite direction or random direction" - ) { - //Randomly select if the dot goes in a constant direction or random direction, weighted based on the coherence level - if (randomValue < coherence) { - dot = constantDirectionUpdate(dot); - } else if (randomValue >= coherence && randomValue < coherence + oppositeCoherence) { - dot = oppositeDirectionUpdate(dot); - } else { - dot = randomDirectionUpdate(dot); - } - } //End of if dot.updateType == ... - - //Increment the life count - dot.lifeCount++; - - //Check if out of bounds or if life ended - if (lifeEnded(dot)) { - dot = resetLocation(dot); - } - - //If it goes out of bounds, do what is necessary (reinsert randomly or reinsert on the opposite edge) based on the parameter chosen - if (outOfBounds(dot)) { - switch (reinsertType) { - case 1: - dot = resetLocation(dot); - break; - case 2: - dot = reinsertOnOppositeEdge(dot); - break; - } //End of switch statement - } //End of if - } //End of for loop - } //End of updateDots function - - //Function to check if dot life has ended - function lifeEnded(dot) { - //If we want infinite dot life - if (dotLife < 0) { - dot.lifeCount = 0; //resetting to zero to save memory. Otherwise it might increment to huge numbers. - return false; - } - //Else if the dot's life has reached its end - else if (dot.lifeCount >= dotLife) { - dot.lifeCount = 0; - return true; - } - //Else the dot's life has not reached its end - else { - return false; - } - } - - //Function to check if dot is out of bounds - // @ts-expect-error - function outOfBounds(dot) { - //For circle and ellipse - if (apertureType == 1 || apertureType == 2) { - if ( - dot.x < xValueNegative(dot.y) || - dot.x > xValuePositive(dot.y) || - dot.y < yValueNegative(dot.x) || - dot.y > yValuePositive(dot.x) - ) { - return true; - } else { - return false; - } - } - //For square and rectangle - if (apertureType == 3 || apertureType == 4) { - if ( - dot.x < apertureCenterX - horizontalAxis || - dot.x > apertureCenterX + horizontalAxis || - dot.y < apertureCenterY - verticalAxis || - dot.y > apertureCenterY + verticalAxis - ) { - return true; - } else { - return false; - } - } - } - - //Set the vx and vy for the dot to the coherent jump sizes of the X and Y directions - function setvxvy(dot) { - dot.vx = coherentJumpSizeX; - dot.vy = coherentJumpSizeY; - return dot; - } - - //Set the vx2 and vy2 based on a random angle - function setvx2vy2(dot) { - //Generate a random angle of movement - var theta = randomNumberBetween(-Math.PI, Math.PI); - //Update properties vx2 and vy2 with the alternate directions - dot.vx2 = Math.cos(theta) * moveDistance; - dot.vy2 = -Math.sin(theta) * moveDistance; - return dot; - } - - //Updates the x and y coordinates by moving it in the x and y coherent directions - function constantDirectionUpdate(dot) { - dot.x += dot.vx; - dot.y += dot.vy; - dot.latestXMove = dot.vx; - dot.latestYMove = dot.vy; - return dot; - } - - //Updates the x and y coordinates by moving it in the opposite x and y coherent directions - function oppositeDirectionUpdate(dot) { - dot.x -= dot.vx; - dot.y -= dot.vy; - dot.latestXMove = -dot.vx; - dot.latestYMove = -dot.vy; - return dot; - } - - //Creates a new angle to move towards and updates the x and y coordinates - function randomWalkUpdate(dot) { - //Generate a random angle of movement - var theta = randomNumberBetween(-Math.PI, Math.PI); - //Generate the movement from the angle - dot.latestXMove = Math.cos(theta) * moveDistance; - dot.latestYMove = -Math.sin(theta) * moveDistance; - //Update x and y coordinates with the new location - dot.x += dot.latestXMove; - dot.y += dot.latestYMove; - return dot; - } - - //Updates the x and y coordinates with the alternative move direction - function randomDirectionUpdate(dot) { - dot.x += dot.vx2; - dot.y += dot.vy2; - dot.latestXMove = dot.vx2; - dot.latestYMove = dot.vy2; - return dot; - } - - //Calculates a random position on the opposite edge to reinsert the dot - function reinsertOnOppositeEdge(dot) { - //If it is a circle or ellipse - if (apertureType == 1 || apertureType == 2) { - //Bring the dot back into the aperture by moving back one step - dot.x -= dot.latestXMove; - dot.y -= dot.latestYMove; - - //Move the dot to the position relative to the origin to be reflected about the origin - dot.x -= apertureCenterX; - dot.y -= apertureCenterY; - - //Reflect the dot about the origin - dot.x = -dot.x; - dot.y = -dot.y; - - //Move the dot back to the center of the screen - dot.x += apertureCenterX; - dot.y += apertureCenterY; - } //End of if apertureType == 1 | == 2 - - //If it is a square or rectangle, re-insert on one of the opposite edges - if (apertureType == 3 || apertureType == 4) { - /** The formula for calculating whether a dot appears from the vertical edge (left or right edges) is dependent on the direction of the dot and the ratio of the vertical and horizontal edge lengths. - E.g. - Aperture is 100 px high and 200px wide - Dot is moving 3 px in x direction and 4px in y direction - Weight on vertical edge (sides) = (100/(100+200)) * (|3| / (|3| + |4|)) = 1/7 - Weight on horizontal edge (top or bottom) = (200/(100+200)) * (|4| / (|3| + |4|)) = 8/21 - - The weights above are the ratios to one another. - E.g. (cont.) - Ratio (vertical edge : horizontal edge) == (1/7 : 8/21) - Total probability space = 1/7 + 8/21 = 11/21 - Probability that dot appears on vertical edge = (1/7)/(11/21) = 3/11 - Probability that dot appears on horizontal edge = (8/21)/(11/21) = 8/11 - */ - - //Get the absolute values of the latest X and Y moves and store them in variables for easy handling. - var absX = Math.abs(dot.latestXMove); - var absY = Math.abs(dot.latestYMove); - //Calculate the direction weights based on direction the dot was moving - var weightInXDirection = absX / (absX + absY); - var weightInYDirection = absY / (absX + absY); - //Calculate the weight of the edge the dot should appear from, based on direction of dot and ratio of the aperture edges - var weightOnVerticalEdge = - (verticalAxis / (verticalAxis + horizontalAxis)) * weightInXDirection; - var weightOnHorizontalEdge = - (horizontalAxis / (verticalAxis + horizontalAxis)) * weightInYDirection; - - //Generate a bounded random number to determine if the dot should appear on the vertical edge or the horizontal edge - if ( - weightOnVerticalEdge > - (weightOnHorizontalEdge + weightOnVerticalEdge) * Math.random() - ) { - //If yes, appear on the left or right edge (vertical edge) - if (dot.latestXMove < 0) { - //If dots move left, appear on right edge - dot.x = apertureCenterX + horizontalAxis; - dot.y = randomNumberBetween( - apertureCenterY - verticalAxis, - apertureCenterY + verticalAxis - ); - } else { - //Else dots move right, so they should appear on the left edge - dot.x = apertureCenterX - horizontalAxis; - dot.y = randomNumberBetween( - apertureCenterY - verticalAxis, - apertureCenterY + verticalAxis - ); - } - } else { - //Else appear on the top or bottom edge (horizontal edge) - if (dot.latestYMove < 0) { - //If dots move upwards, then appear on bottom edge - dot.y = apertureCenterY + verticalAxis; - dot.x = randomNumberBetween( - apertureCenterX - horizontalAxis, - apertureCenterX + horizontalAxis - ); - } else { - //If dots move downwards, then appear on top edge - dot.y = apertureCenterY - verticalAxis; - dot.x = randomNumberBetween( - apertureCenterX - horizontalAxis, - apertureCenterX + horizontalAxis - ); - } - } - } //End of apertureType == 3 - return dot; - } //End of reinsertOnOppositeEdge - - //Calculate the POSITIVE y value of a point on the edge of the ellipse given an x-value - function yValuePositive(x: number) { - x = x - apertureCenterX; //Bring it back to the (0,0) center to calculate accurately (ignore the y-coordinate because it is not necessary for calculation) - return ( - verticalAxis * Math.sqrt(1 - Math.pow(x, 2) / Math.pow(horizontalAxis, 2)) + apertureCenterY - ); //Calculated the positive y value and added apertureCenterY to recenter it on the screen - } - - //Calculate the NEGATIVE y value of a point on the edge of the ellipse given an x-value - function yValueNegative(x: number) { - x = x - apertureCenterX; //Bring it back to the (0,0) center to calculate accurately (ignore the y-coordinate because it is not necessary for calculation) - return ( - -verticalAxis * Math.sqrt(1 - Math.pow(x, 2) / Math.pow(horizontalAxis, 2)) + - apertureCenterY - ); //Calculated the negative y value and added apertureCenterY to recenter it on the screen - } - - //Calculate the POSITIVE x value of a point on the edge of the ellipse given a y-value - function xValuePositive(y: number) { - y = y - apertureCenterY; //Bring it back to the (0,0) center to calculate accurately (ignore the x-coordinate because it is not necessary for calculation) - return ( - horizontalAxis * Math.sqrt(1 - Math.pow(y, 2) / Math.pow(verticalAxis, 2)) + apertureCenterX - ); //Calculated the positive x value and added apertureCenterX to recenter it on the screen - } - - //Calculate the NEGATIVE x value of a point on the edge of the ellipse given a y-value - function xValueNegative(y: number) { - y = y - apertureCenterY; //Bring it back to the (0,0) center to calculate accurately (ignore the x-coordinate because it is not necessary for calculation) - return ( - -horizontalAxis * Math.sqrt(1 - Math.pow(y, 2) / Math.pow(verticalAxis, 2)) + - apertureCenterX - ); //Calculated the negative x value and added apertureCenterX to recenter it on the screen - } - - //Calculate a random x and y coordinate in the ellipse - function resetLocation(dot) { - //For circle and ellipse - if (apertureType == 1 || apertureType == 2) { - var phi = randomNumberBetween(-Math.PI, Math.PI); - var rho = Math.random(); - - var x = Math.sqrt(rho) * Math.cos(phi); - var y = Math.sqrt(rho) * Math.sin(phi); - - x = x * horizontalAxis + apertureCenterX; - y = y * verticalAxis + apertureCenterY; - - dot.x = x; - dot.y = y; - } - //For square and rectangle - else if (apertureType == 3 || apertureType == 4) { - dot.x = randomNumberBetween( - apertureCenterX - horizontalAxis, - apertureCenterX + horizontalAxis - ); //Between the left and right edges of the square / rectangle - dot.y = randomNumberBetween(apertureCenterY - verticalAxis, apertureCenterY + verticalAxis); //Between the top and bottom edges of the square / rectangle - } - - return dot; - } - - //Generates a random number (with decimals) between 2 values - function randomNumberBetween(lowerBound, upperBound) { - return lowerBound + Math.random() * (upperBound - lowerBound); - } - - //Function to make the dots move on the canvas - function animateDotMotion() { - //frameRequestID saves a long integer that is the ID of this frame request. The ID is then used to terminate the request below. - var frameRequestID = window.requestAnimationFrame(animate); - - //Start to listen to subject's key responses - startKeyboardListener(); - - //Delare a timestamp - var previousTimestamp; - - function animate() { - //If stopping condition has been reached, then stop the animation - if (stopDotMotion) { - window.cancelAnimationFrame(frameRequestID); //Cancels the frame request - } - //Else continue with another frame request - else { - frameRequestID = window.requestAnimationFrame(animate); //Calls for another frame request - - //If the timer has not been started and it is set, then start the timer - if (!timerHasStarted && trial_duration > 0) { - //If the trial duration is set, then set a timer to count down and call the end_trial function when the time is up - //(If the subject did not press a valid keyboard response within the trial duration, then this will end the trial) - timeoutID = window.setTimeout(end_trial, trial_duration); //This timeoutID is then used to cancel the timeout should the subject press a valid key - //The timer has started, so we set the variable to true so it does not start more timers - timerHasStarted = true; - } - - updateAndDraw(); //Update and draw each of the dots in their respective apertures - - //If this is before the first frame, then start the timestamp - if (previousTimestamp === undefined) { - previousTimestamp = performance.now(); - } - //Else calculate the time and push it into the array - else { - var currentTimeStamp = performance.now(); //Variable to hold current timestamp - (frameRate as number[]).push(Math.round(currentTimeStamp - previousTimestamp)); //Push the interval into the frameRate array - previousTimestamp = currentTimeStamp; //Reset the timestamp - } - } - } - } - - //----RDK Functions End---- - - //----General Functions Begin//---- - - //Function to assign the default values for the staircase parameters - function assignParameterValue(argument, defaultValue) { - return typeof argument !== "undefined" ? argument : defaultValue; - } - - //----General Functions End//---- - - //------------------------------------- - //-----------FUNCTIONS END------------- - //------------------------------------- - } -} - -export default RdkPlugin; diff --git a/packages/plugin-reconstruction/package.json b/packages/plugin-reconstruction/package.json index 1a3b92f5..15608d0b 100644 --- a/packages/plugin-reconstruction/package.json +++ b/packages/plugin-reconstruction/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-reconstruction/src/index.spec.ts b/packages/plugin-reconstruction/src/index.spec.ts index de947be7..e4905f18 100644 --- a/packages/plugin-reconstruction/src/index.spec.ts +++ b/packages/plugin-reconstruction/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, pressKey, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, pressKey, startTimeline } from "@jspsych/test-utils"; import reconstruction from "."; diff --git a/packages/plugin-resize/package.json b/packages/plugin-resize/package.json index 7efe7f5b..07f38122 100644 --- a/packages/plugin-resize/package.json +++ b/packages/plugin-resize/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-same-different-html/package.json b/packages/plugin-same-different-html/package.json index 705fa5f3..a49228c5 100644 --- a/packages/plugin-same-different-html/package.json +++ b/packages/plugin-same-different-html/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-same-different-image/package.json b/packages/plugin-same-different-image/package.json index 8a089359..565c601d 100644 --- a/packages/plugin-same-different-image/package.json +++ b/packages/plugin-same-different-image/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-serial-reaction-time-mouse/package.json b/packages/plugin-serial-reaction-time-mouse/package.json index 08171d68..d6d64928 100644 --- a/packages/plugin-serial-reaction-time-mouse/package.json +++ b/packages/plugin-serial-reaction-time-mouse/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-serial-reaction-time-mouse/src/index.spec.ts b/packages/plugin-serial-reaction-time-mouse/src/index.spec.ts index 8544c0c0..ac37469c 100644 --- a/packages/plugin-serial-reaction-time-mouse/src/index.spec.ts +++ b/packages/plugin-serial-reaction-time-mouse/src/index.spec.ts @@ -1,4 +1,4 @@ -import { mouseDownMouseUpTarget, startTimeline } from "jspsych/tests/utils"; +import { mouseDownMouseUpTarget, startTimeline } from "@jspsych/test-utils"; import serialReactionTimeMouse from "."; diff --git a/packages/plugin-serial-reaction-time/package.json b/packages/plugin-serial-reaction-time/package.json index cd2342e4..6a1473c3 100644 --- a/packages/plugin-serial-reaction-time/package.json +++ b/packages/plugin-serial-reaction-time/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-serial-reaction-time/src/index.spec.ts b/packages/plugin-serial-reaction-time/src/index.spec.ts index da5087c5..726b14d3 100644 --- a/packages/plugin-serial-reaction-time/src/index.spec.ts +++ b/packages/plugin-serial-reaction-time/src/index.spec.ts @@ -1,4 +1,4 @@ -import { pressKey, startTimeline } from "jspsych/tests/utils"; +import { pressKey, startTimeline } from "@jspsych/test-utils"; import serialReactionTime from "."; diff --git a/packages/plugin-survey-html-form/package.json b/packages/plugin-survey-html-form/package.json index 870be158..c3c60525 100644 --- a/packages/plugin-survey-html-form/package.json +++ b/packages/plugin-survey-html-form/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-survey-html-form/src/index.spec.ts b/packages/plugin-survey-html-form/src/index.spec.ts index 38dea467..7da0d232 100644 --- a/packages/plugin-survey-html-form/src/index.spec.ts +++ b/packages/plugin-survey-html-form/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import surveyHtmlForm from "."; diff --git a/packages/plugin-survey-likert/package.json b/packages/plugin-survey-likert/package.json index 563f4b30..0b7ba091 100644 --- a/packages/plugin-survey-likert/package.json +++ b/packages/plugin-survey-likert/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-survey-likert/src/index.spec.ts b/packages/plugin-survey-likert/src/index.spec.ts index b9887d7a..75ee5f9c 100644 --- a/packages/plugin-survey-likert/src/index.spec.ts +++ b/packages/plugin-survey-likert/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import surveyLikert from "."; diff --git a/packages/plugin-survey-multi-choice/package.json b/packages/plugin-survey-multi-choice/package.json index aab4d441..b229651c 100644 --- a/packages/plugin-survey-multi-choice/package.json +++ b/packages/plugin-survey-multi-choice/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-survey-multi-choice/src/index.spec.ts b/packages/plugin-survey-multi-choice/src/index.spec.ts index 6736951e..7bfe545b 100644 --- a/packages/plugin-survey-multi-choice/src/index.spec.ts +++ b/packages/plugin-survey-multi-choice/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import surveyMultiChoice from "."; diff --git a/packages/plugin-survey-multi-select/package.json b/packages/plugin-survey-multi-select/package.json index 9834478e..736f607c 100644 --- a/packages/plugin-survey-multi-select/package.json +++ b/packages/plugin-survey-multi-select/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-survey-multi-select/src/index.spec.ts b/packages/plugin-survey-multi-select/src/index.spec.ts index 6e1094af..ff81568f 100644 --- a/packages/plugin-survey-multi-select/src/index.spec.ts +++ b/packages/plugin-survey-multi-select/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import surveyMultiSelect from "."; diff --git a/packages/plugin-survey-text/package.json b/packages/plugin-survey-text/package.json index 0d260bb1..118f58c5 100644 --- a/packages/plugin-survey-text/package.json +++ b/packages/plugin-survey-text/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-survey-text/src/index.spec.ts b/packages/plugin-survey-text/src/index.spec.ts index 62d86744..798876d6 100644 --- a/packages/plugin-survey-text/src/index.spec.ts +++ b/packages/plugin-survey-text/src/index.spec.ts @@ -1,4 +1,4 @@ -import { clickTarget, startTimeline } from "jspsych/tests/utils"; +import { clickTarget, startTimeline } from "@jspsych/test-utils"; import surveyText from "."; diff --git a/packages/plugin-template/package.json b/packages/plugin-template/package.json index ed54e98a..0a5be4dc 100644 --- a/packages/plugin-template/package.json +++ b/packages/plugin-template/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-video-button-response/package.json b/packages/plugin-video-button-response/package.json index 5de13f3e..545c9dff 100644 --- a/packages/plugin-video-button-response/package.json +++ b/packages/plugin-video-button-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-video-keyboard-response/package.json b/packages/plugin-video-keyboard-response/package.json index 727050d2..4f8cdfd8 100644 --- a/packages/plugin-video-keyboard-response/package.json +++ b/packages/plugin-video-keyboard-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-video-slider-response/package.json b/packages/plugin-video-slider-response/package.json index 0a5b6d20..20c5f735 100644 --- a/packages/plugin-video-slider-response/package.json +++ b/packages/plugin-video-slider-response/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-virtual-chinrest/package.json b/packages/plugin-virtual-chinrest/package.json index 46cdc770..f3290e82 100644 --- a/packages/plugin-virtual-chinrest/package.json +++ b/packages/plugin-virtual-chinrest/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-visual-search-circle/package.json b/packages/plugin-visual-search-circle/package.json index e09fc5ac..aaa1696c 100644 --- a/packages/plugin-visual-search-circle/package.json +++ b/packages/plugin-visual-search-circle/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-vsl-animate-occlusion/jest.config.cjs b/packages/plugin-vsl-animate-occlusion/jest.config.cjs deleted file mode 100644 index 6ac19d5c..00000000 --- a/packages/plugin-vsl-animate-occlusion/jest.config.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("@jspsych/config/jest").makePackageConfig(__dirname); diff --git a/packages/plugin-vsl-animate-occlusion/package.json b/packages/plugin-vsl-animate-occlusion/package.json deleted file mode 100644 index 1b2a9d77..00000000 --- a/packages/plugin-vsl-animate-occlusion/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@jspsych/plugin-vsl-animate-occlusion", - "version": "1.0.0", - "description": "", - "type": "module", - "main": "dist/index.cjs", - "exports": { - "import": "./dist/index.js", - "require": "./dist/index.cjs" - }, - "typings": "dist/index.d.ts", - "unpkg": "dist/index.browser.min.js", - "files": [ - "src", - "dist" - ], - "source": "src/index.ts", - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "npm test -- --watch", - "tsc": "tsc", - "build": "rollup --config", - "build:watch": "npm run build -- --watch" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/jspsych/jsPsych.git" - }, - "author": "Josh de Leeuw", - "license": "MIT", - "bugs": { - "url": "https://github.com/jspsych/jsPsych/issues" - }, - "homepage": "https://github.com/jspsych/jsPsych#readme", - "peerDependencies": { - "jspsych": ">=7" - }, - "devDependencies": { - "@jspsych/config": "^0.1.0" - } -} diff --git a/packages/plugin-vsl-animate-occlusion/rollup.config.mjs b/packages/plugin-vsl-animate-occlusion/rollup.config.mjs deleted file mode 100644 index f94d3426..00000000 --- a/packages/plugin-vsl-animate-occlusion/rollup.config.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import { makeRollupConfig } from "@jspsych/config/rollup"; - -export default makeRollupConfig("jsPsychVslAnimateOcclusion"); diff --git a/packages/plugin-vsl-animate-occlusion/src/index.ts b/packages/plugin-vsl-animate-occlusion/src/index.ts deleted file mode 100644 index 21db80e6..00000000 --- a/packages/plugin-vsl-animate-occlusion/src/index.ts +++ /dev/null @@ -1,223 +0,0 @@ -import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; - -const info = { - name: "vsl-animate-occlusion", - parameters: { - /** Array containing path(s) to image file(s). */ - stimuli: { - type: ParameterType.IMAGE, - pretty_name: "Stimuli", - default: undefined, - array: true, - }, - /** Array containing the key(s) that the subject is allowed to press in order to respond to the stimulus. */ - choices: { - type: ParameterType.KEYS, - pretty_name: "Choices", - default: "ALL_KEYS", - }, - /** Array specifying the width and height of the area that the animation will display in. */ - canvas_size: { - type: ParameterType.INT, - pretty_name: "Canvas size", - array: true, - default: [400, 400], - }, - /** Array specifying the width and height of the images to show. */ - image_size: { - type: ParameterType.INT, - pretty_name: "Image size", - array: true, - default: [100, 100], - }, - /** Which direction the stimulus should move first. */ - initial_direction: { - type: ParameterType.SELECT, - pretty_name: "Initial direction", - choices: ["left", "right"], - default: "left", - }, - /** If true, display a rectangle in the center of the screen that is just wide enough to occlude the image completely as it passes behind. */ - occlude_center: { - type: ParameterType.BOOL, - pretty_name: "Occlude center", - default: true, - }, - /** How long it takes for a stimulus in the sequence to make a complete cycle. */ - cycle_duration: { - type: ParameterType.INT, - pretty_name: "Cycle duration", - default: 1000, - }, - /** How long to wait before the stimuli starts moving from behind the center rectangle. */ - pre_movement_duration: { - type: ParameterType.INT, - pretty_name: "Pre movement duration", - default: 500, - }, - }, -}; - -type Info = typeof info; - -/** - * **vsl-animate-occlusion** - * - * jsPsych plugin for showing animations that mimic the experiment described in - * Fiser, J., & Aslin, R. N. (2002). Statistical learning of higher-order - * temporal structure from visual shape sequences. Journal of Experimental - * Psychology: Learning, Memory, and Cognition, 28(3), 458. - * - * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-vsl-animate-occlusion/ vsl-animate-occlusion plugin documentation on jspsych.org} - */ -class VslAnimateOcclusionPlugin implements JsPsychPlugin { - static info = info; - - constructor(private jsPsych: JsPsych) {} - - trial(display_element: HTMLElement, trial: TrialType) { - // variable to keep track of timing info and responses - var start_time: number; - var responses = []; - - var directions = [ - [ - { - params: { - x: trial.canvas_size[0] - trial.image_size[0], - }, - ms: trial.cycle_duration / 2, - }, - { - params: { - x: trial.canvas_size[0] / 2 - trial.image_size[0] / 2, - }, - ms: trial.cycle_duration / 2, - }, - ], - [ - { - params: { - x: 0, - }, - ms: trial.cycle_duration / 2, - }, - { - params: { - x: trial.canvas_size[0] / 2 - trial.image_size[0] / 2, - }, - ms: trial.cycle_duration / 2, - }, - ], - ]; - - var which_image = 0; - var next_direction = trial.initial_direction == "right" ? 0 : 1; - - function next_step() { - if (trial.stimuli.length == which_image) { - endTrial(); - } else { - var d = directions[next_direction]; - next_direction === 0 ? (next_direction = 1) : (next_direction = 0); - var i = trial.stimuli[which_image]; - which_image++; - - // @ts-expect-error What is `mina`? - c.animate(d[0].params, d[0].ms, mina.linear, function () { - // @ts-expect-error What is `mina`? - c.animate(d[1].params, d[1].ms, mina.linear, function () { - next_step(); - }); - }); - - c.attr({ - href: i, - }); - - // start timer for this trial - start_time = performance.now(); - } - } - - display_element.innerHTML = - ""; - - // @ts-expect-error What is `Snap`? - var paper = Snap("#jspsych-vsl-animate-occlusion-canvas"); - - var c = paper - .image( - trial.stimuli[which_image], - trial.canvas_size[0] / 2 - trial.image_size[0] / 2, - trial.canvas_size[1] / 2 - trial.image_size[1] / 2, - trial.image_size[0], - trial.image_size[1] - ) - .attr({ - id: "jspsych-vsl-animate-occlusion-moving-image", - }); - - display_element - .querySelector("#jspsych-vsl-animate-occlusion-moving-image") - .removeAttribute("preserveAspectRatio"); - - if (trial.occlude_center) { - paper - .rect( - trial.canvas_size[0] / 2 - trial.image_size[0] / 2, - 0, - trial.image_size[0], - trial.canvas_size[1] - ) - .attr({ - fill: "#000", - }); - } - - // add key listener - var after_response = function (info: { key: string; rt: number }) { - responses.push({ - key: info.key, - stimulus: which_image - 1, - rt: info.rt, - }); - }; - - var key_listener = this.jsPsych.pluginAPI.getKeyboardResponse({ - callback_function: after_response, - valid_responses: trial.choices, - rt_method: "performance", - persist: true, - allow_held_key: false, - }); - - if (trial.pre_movement_duration > 0) { - this.jsPsych.pluginAPI.setTimeout(function () { - next_step(); - }, trial.pre_movement_duration); - } else { - next_step(); - } - - const endTrial = () => { - display_element.innerHTML = ""; - - this.jsPsych.pluginAPI.cancelKeyboardResponse(key_listener); - - var trial_data = { - stimuli: trial.stimuli, - response: responses, - }; - - this.jsPsych.finishTrial(trial_data); - }; - } -} - -export default VslAnimateOcclusionPlugin; diff --git a/packages/plugin-vsl-animate-occlusion/tsconfig.json b/packages/plugin-vsl-animate-occlusion/tsconfig.json deleted file mode 100644 index 588f0448..00000000 --- a/packages/plugin-vsl-animate-occlusion/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "@jspsych/config/tsconfig.core.json", - "compilerOptions": { - "baseUrl": "." - }, - "include": ["src"] -} diff --git a/packages/plugin-vsl-grid-scene/jest.config.cjs b/packages/plugin-vsl-grid-scene/jest.config.cjs deleted file mode 100644 index 6ac19d5c..00000000 --- a/packages/plugin-vsl-grid-scene/jest.config.cjs +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("@jspsych/config/jest").makePackageConfig(__dirname); diff --git a/packages/plugin-vsl-grid-scene/package.json b/packages/plugin-vsl-grid-scene/package.json deleted file mode 100644 index 8255e7ba..00000000 --- a/packages/plugin-vsl-grid-scene/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@jspsych/plugin-vsl-grid-scene", - "version": "1.0.0", - "description": "", - "type": "module", - "main": "dist/index.cjs", - "exports": { - "import": "./dist/index.js", - "require": "./dist/index.cjs" - }, - "typings": "dist/index.d.ts", - "unpkg": "dist/index.browser.min.js", - "files": [ - "src", - "dist" - ], - "source": "src/index.ts", - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "npm test -- --watch", - "tsc": "tsc", - "build": "rollup --config", - "build:watch": "npm run build -- --watch" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/jspsych/jsPsych.git" - }, - "author": "Josh de Leeuw", - "license": "MIT", - "bugs": { - "url": "https://github.com/jspsych/jsPsych/issues" - }, - "homepage": "https://github.com/jspsych/jsPsych#readme", - "peerDependencies": { - "jspsych": ">=7" - }, - "devDependencies": { - "@jspsych/config": "^0.1.0" - } -} diff --git a/packages/plugin-vsl-grid-scene/rollup.config.mjs b/packages/plugin-vsl-grid-scene/rollup.config.mjs deleted file mode 100644 index 19931da0..00000000 --- a/packages/plugin-vsl-grid-scene/rollup.config.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import { makeRollupConfig } from "@jspsych/config/rollup"; - -export default makeRollupConfig("jsPsychVslGridScene"); diff --git a/packages/plugin-vsl-grid-scene/src/index.ts b/packages/plugin-vsl-grid-scene/src/index.ts deleted file mode 100644 index 6fef6c91..00000000 --- a/packages/plugin-vsl-grid-scene/src/index.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych"; - -const info = { - name: "vsl-grid-scene", - parameters: { - /** An array of images that defines a grid. */ - stimuli: { - type: ParameterType.IMAGE, - pretty_name: "Stimuli", - array: true, - default: undefined, - }, - /** Array specifying the width and height of the images to show. */ - image_size: { - type: ParameterType.INT, - pretty_name: "Image size", - array: true, - default: [100, 100], - }, - /** How long to show the stimulus for in milliseconds. */ - trial_duration: { - type: ParameterType.INT, - pretty_name: "Trial duration", - default: 2000, - }, - }, -}; - -type Info = typeof info; - -/** - * **vsl-grid-scene** - * - * jsPsych plugin for showing scenes that mimic the experiments described in - * Fiser, J., & Aslin, R. N. (2001). Unsupervised statistical learning of - * higher-order spatial structures from visual scenes. Psychological science, - * 12(6), 499-504. - * - * @author Josh de Leeuw - * @see {@link https://www.jspsych.org/plugins/jspsych-vsl-grid-scene/ vsl-grid-scene plugin documentation on jspsych.org} - */ -class VslGridScenePlugin implements JsPsychPlugin { - static info = info; - - constructor(private jsPsych: JsPsych) {} - - trial(display_element: HTMLElement, trial: TrialType) { - display_element.innerHTML = VslGridScenePlugin.generate_stimulus( - trial.stimuli, - trial.image_size - ); - - this.jsPsych.pluginAPI.setTimeout(function () { - endTrial(); - }, trial.trial_duration); - - const endTrial = () => { - display_element.innerHTML = ""; - - var trial_data = { - stimulus: trial.stimuli, - }; - - this.jsPsych.finishTrial(trial_data); - }; - } - - static generate_stimulus(pattern, image_size: number[]) { - var nrows = pattern.length; - var ncols = pattern[0].length; - - // create blank element to hold code that we generate - var html = '
'; - - // create table - html += - ''; - - for (var row = 0; row < nrows; row++) { - html += - ''; - - for (var col = 0; col < ncols; col++) { - html += - '"; - } - html += ""; - } - - html += "
' + - '
'; - if (pattern[row][col] !== 0) { - html += - "'; - } - html += "
"; - html += "
"; - html += "
"; - - return html; - } -} - -export default VslGridScenePlugin; diff --git a/packages/plugin-vsl-grid-scene/tsconfig.json b/packages/plugin-vsl-grid-scene/tsconfig.json deleted file mode 100644 index 588f0448..00000000 --- a/packages/plugin-vsl-grid-scene/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "@jspsych/config/tsconfig.core.json", - "compilerOptions": { - "baseUrl": "." - }, - "include": ["src"] -} diff --git a/packages/plugin-webgazer-calibrate/package.json b/packages/plugin-webgazer-calibrate/package.json index feece7e6..d274ab2f 100644 --- a/packages/plugin-webgazer-calibrate/package.json +++ b/packages/plugin-webgazer-calibrate/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-webgazer-init-camera/package.json b/packages/plugin-webgazer-init-camera/package.json index 932822fe..60891553 100644 --- a/packages/plugin-webgazer-init-camera/package.json +++ b/packages/plugin-webgazer-init-camera/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/plugin-webgazer-validate/package.json b/packages/plugin-webgazer-validate/package.json index 1aa1aa7f..13787b13 100644 --- a/packages/plugin-webgazer-validate/package.json +++ b/packages/plugin-webgazer-validate/package.json @@ -36,6 +36,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/test-utils/README.md b/packages/test-utils/README.md new file mode 100644 index 00000000..d4f382e8 --- /dev/null +++ b/packages/test-utils/README.md @@ -0,0 +1 @@ +# Test utility functions for jsPsych-related test cases diff --git a/packages/plugin-rdk/package.json b/packages/test-utils/package.json similarity index 71% rename from packages/plugin-rdk/package.json rename to packages/test-utils/package.json index bd30f579..e9c7f07a 100644 --- a/packages/plugin-rdk/package.json +++ b/packages/test-utils/package.json @@ -1,7 +1,7 @@ { - "name": "@jspsych/plugin-rdk", - "version": "1.0.0", - "description": "RDK plugin for JsPsych", + "name": "@jspsych/test-utils", + "version": "0.1.0", + "description": "Test utility functions for jsPsych-related test cases", "type": "module", "main": "dist/index.cjs", "exports": { @@ -9,15 +9,12 @@ "require": "./dist/index.cjs" }, "typings": "dist/index.d.ts", - "unpkg": "dist/index.browser.min.js", "files": [ "src", "dist" ], "source": "src/index.ts", "scripts": { - "test": "jest", - "test:watch": "npm test -- --watch", "tsc": "tsc", "build": "rollup --config", "build:watch": "npm run build -- --watch" @@ -26,7 +23,7 @@ "type": "git", "url": "git+https://github.com/jspsych/jsPsych.git" }, - "author": "Sivananda Rajananda", + "author": "bjoluc ", "license": "MIT", "bugs": { "url": "https://github.com/jspsych/jsPsych/issues" @@ -36,6 +33,7 @@ "jspsych": ">=7" }, "devDependencies": { - "@jspsych/config": "^0.1.0" + "@jspsych/config": "^0.1.0", + "@jspsych/test-utils": "^0.1.0" } } diff --git a/packages/test-utils/rollup.config.mjs b/packages/test-utils/rollup.config.mjs new file mode 100644 index 00000000..22296de3 --- /dev/null +++ b/packages/test-utils/rollup.config.mjs @@ -0,0 +1,3 @@ +import { makeNodeRollupConfig } from "@jspsych/config/rollup"; + +export default makeNodeRollupConfig(); diff --git a/packages/jspsych/tests/utils.ts b/packages/test-utils/src/index.ts similarity index 98% rename from packages/jspsych/tests/utils.ts rename to packages/test-utils/src/index.ts index 94d3a3d6..d9ee0b53 100644 --- a/packages/jspsych/tests/utils.ts +++ b/packages/test-utils/src/index.ts @@ -1,6 +1,6 @@ import { setImmediate as flushMicroTasks } from "timers"; -import { JsPsych } from "../src"; +import { JsPsych } from "jspsych"; export function dispatchEvent(event: Event) { document.body.dispatchEvent(event); diff --git a/packages/plugin-rdk/tsconfig.json b/packages/test-utils/tsconfig.json similarity index 100% rename from packages/plugin-rdk/tsconfig.json rename to packages/test-utils/tsconfig.json