diff --git a/configs/mocha-config-devtools/index.test.ts b/configs/mocha-config-devtools/index.test.ts new file mode 100644 index 00000000..8eebcc9f --- /dev/null +++ b/configs/mocha-config-devtools/index.test.ts @@ -0,0 +1,8 @@ +import assert from 'assert'; + +describe('mocha-config-devtools/base', function () { + it('can run a ts file', function () { + // This file will just not run if ts-node is not set up correctly + assert(true); + }); +}); diff --git a/configs/mocha-config-devtools/package.json b/configs/mocha-config-devtools/package.json index b6c7b4a1..f8cf59eb 100644 --- a/configs/mocha-config-devtools/package.json +++ b/configs/mocha-config-devtools/package.json @@ -4,13 +4,11 @@ "description": "Shared mocha mocha configuration for Devtools packages", "license": "SSPL", "main": "index.js", - "devDependencies": { - "@mongodb-js/prettier-config-devtools": "^1.0.0", - "prettier": "^2.3.2" - }, "scripts": { "prettier": "prettier", "lint": "npm run prettier -- --check .", + "test": "mocha --config ./index.js index.test.ts && mocha --config ./react.js react.test.ts", + "test-ci": "npm run test", "check": "npm run lint", "check-ci": "npm run lint", "reformat": "npm run prettier -- --write ." @@ -23,15 +21,23 @@ "publishConfig": { "access": "public" }, + "devDependencies": { + "@mongodb-js/prettier-config-devtools": "^1.0.0", + "prettier": "^2.3.2", + "react": ">=16" + }, + "peerDependencies": { + "react": ">=16" + }, "dependencies": { "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0", "chai": "^4.3.4", "chai-dom": "^1.9.0", "chai-enzyme": "^1.0.0-beta.1", "enzyme": "^3.11.0", - "global-jsdom": "^8.3.0", - "jsdom": "^21.1.0", + "global-jsdom": "^9.1.0", "identity-obj-proxy": "^3.0.0", + "jsdom": "^22.1.0", "react-16-node-hanging-test-fix": "^1.0.0", "sinon-chai": "^3.7.0", "ts-node": "^10.9.1", diff --git a/configs/mocha-config-devtools/react.test.ts b/configs/mocha-config-devtools/react.test.ts new file mode 100644 index 00000000..61c50cf5 --- /dev/null +++ b/configs/mocha-config-devtools/react.test.ts @@ -0,0 +1,10 @@ +import assert from 'assert'; + +describe('mocha-config-devtools/react', function () { + it('has jsdom', function () { + assert(!!globalThis.window); + assert(!!globalThis.document); + document.body.appendChild(document.createTextNode('Hello world!')); + assert(document.body.innerHTML === 'Hello world!'); + }); +}); diff --git a/package-lock.json b/package-lock.json index 94ff27fa..7ba2afe1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,9 +62,9 @@ "chai-dom": "^1.9.0", "chai-enzyme": "^1.0.0-beta.1", "enzyme": "^3.11.0", - "global-jsdom": "^8.3.0", + "global-jsdom": "^9.1.0", "identity-obj-proxy": "^3.0.0", - "jsdom": "^21.1.0", + "jsdom": "^22.1.0", "react-16-node-hanging-test-fix": "^1.0.0", "sinon-chai": "^3.7.0", "ts-node": "^10.9.1", @@ -72,7 +72,11 @@ }, "devDependencies": { "@mongodb-js/prettier-config-devtools": "^1.0.0", - "prettier": "^2.3.2" + "prettier": "^2.3.2", + "react": ">=16" + }, + "peerDependencies": { + "react": ">=16" } }, "configs/mocha-config-devtools/node_modules/prettier": { @@ -4788,26 +4792,6 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-globals": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", - "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", - "dependencies": { - "acorn": "^8.1.0", - "acorn-walk": "^8.0.2" - } - }, - "node_modules/acorn-globals/node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/acorn-import-assertions": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", @@ -7680,34 +7664,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/escodegen": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", - "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/escodegen/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "engines": { - "node": ">=4.0" - } - }, "node_modules/eslint": { "version": "7.32.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", @@ -8973,14 +8929,14 @@ "dev": true }, "node_modules/global-jsdom": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/global-jsdom/-/global-jsdom-8.5.0.tgz", - "integrity": "sha512-ZuV3KygW6sVnEp/zYWscLhi/EJakk0z6kwoBL2/P3VPJW2wxvB+e4mcrUkazx6zC0JinceB0r6uMi8kZS97uzg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/global-jsdom/-/global-jsdom-9.1.0.tgz", + "integrity": "sha512-mNjpiQBgCTApFeRZxU3L01pjzulHIbwtk+5rGDdqUDACTupvhHywpgaZtXNMn/97HofZzHEoXdNR5qFNgjZCSg==", "engines": { - "node": ">=12" + "node": ">=16" }, "peerDependencies": { - "jsdom": ">=10.0.0 || <20" + "jsdom": ">=22 <23" } }, "node_modules/globals": { @@ -10423,18 +10379,15 @@ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" }, "node_modules/jsdom": { - "version": "21.1.2", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.2.tgz", - "integrity": "sha512-sCpFmK2jv+1sjff4u7fzft+pUh2KSUbUrEHYHyfSIbGTIcmnjyp83qg6qLwdJ/I3LpTXx33ACxeRL7Lsyc6lGQ==", + "version": "22.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.1.0.tgz", + "integrity": "sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==", "dependencies": { "abab": "^2.0.6", - "acorn": "^8.8.2", - "acorn-globals": "^7.0.0", "cssstyle": "^3.0.0", "data-urls": "^4.0.0", "decimal.js": "^10.4.3", "domexception": "^4.0.0", - "escodegen": "^2.0.0", "form-data": "^4.0.0", "html-encoding-sniffer": "^3.0.0", "http-proxy-agent": "^5.0.0", @@ -10455,7 +10408,7 @@ "xml-name-validator": "^4.0.0" }, "engines": { - "node": ">=14" + "node": ">=16" }, "peerDependencies": { "canvas": "^2.5.0" @@ -10474,17 +10427,6 @@ "node": ">= 10" } }, - "node_modules/jsdom/node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/jsdom/node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -15591,6 +15533,18 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react-16-node-hanging-test-fix": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/react-16-node-hanging-test-fix/-/react-16-node-hanging-test-fix-1.0.0.tgz", @@ -16910,7 +16864,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "devOptional": true, + "dev": true, "engines": { "node": ">=0.10.0" } @@ -21936,10 +21890,11 @@ "chai-dom": "^1.9.0", "chai-enzyme": "^1.0.0-beta.1", "enzyme": "^3.11.0", - "global-jsdom": "^8.3.0", + "global-jsdom": "^9.1.0", "identity-obj-proxy": "^3.0.0", - "jsdom": "^21.1.0", + "jsdom": "^22.1.0", "prettier": "^2.3.2", + "react": ">=16", "react-16-node-hanging-test-fix": "^1.0.0", "sinon-chai": "^3.7.0", "ts-node": "^10.9.1", @@ -23893,22 +23848,6 @@ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, - "acorn-globals": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", - "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", - "requires": { - "acorn": "^8.1.0", - "acorn-walk": "^8.0.2" - }, - "dependencies": { - "acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==" - } - } - }, "acorn-import-assertions": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", @@ -26096,24 +26035,6 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, - "escodegen": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", - "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", - "requires": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "source-map": "~0.6.1" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" - } - } - }, "eslint": { "version": "7.32.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", @@ -27060,9 +26981,9 @@ "dev": true }, "global-jsdom": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/global-jsdom/-/global-jsdom-8.5.0.tgz", - "integrity": "sha512-ZuV3KygW6sVnEp/zYWscLhi/EJakk0z6kwoBL2/P3VPJW2wxvB+e4mcrUkazx6zC0JinceB0r6uMi8kZS97uzg==" + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/global-jsdom/-/global-jsdom-9.1.0.tgz", + "integrity": "sha512-mNjpiQBgCTApFeRZxU3L01pjzulHIbwtk+5rGDdqUDACTupvhHywpgaZtXNMn/97HofZzHEoXdNR5qFNgjZCSg==" }, "globals": { "version": "11.12.0", @@ -28098,18 +28019,15 @@ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" }, "jsdom": { - "version": "21.1.2", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-21.1.2.tgz", - "integrity": "sha512-sCpFmK2jv+1sjff4u7fzft+pUh2KSUbUrEHYHyfSIbGTIcmnjyp83qg6qLwdJ/I3LpTXx33ACxeRL7Lsyc6lGQ==", + "version": "22.1.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.1.0.tgz", + "integrity": "sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==", "requires": { "abab": "^2.0.6", - "acorn": "^8.8.2", - "acorn-globals": "^7.0.0", "cssstyle": "^3.0.0", "data-urls": "^4.0.0", "decimal.js": "^10.4.3", "domexception": "^4.0.0", - "escodegen": "^2.0.0", "form-data": "^4.0.0", "html-encoding-sniffer": "^3.0.0", "http-proxy-agent": "^5.0.0", @@ -28135,11 +28053,6 @@ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==" }, - "acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==" - }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -32110,6 +32023,15 @@ "safe-buffer": "^5.1.0" } }, + "react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dev": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, "react-16-node-hanging-test-fix": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/react-16-node-hanging-test-fix/-/react-16-node-hanging-test-fix-1.0.0.tgz", @@ -33130,7 +33052,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "devOptional": true + "dev": true }, "source-map-js": { "version": "1.0.2",