diff --git a/.github/workflows/push-actions.yml b/.github/workflows/push-actions.yml index 8f81a7cf..497c5985 100644 --- a/.github/workflows/push-actions.yml +++ b/.github/workflows/push-actions.yml @@ -15,7 +15,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: "20.11.0" + node-version: "20.15.0" cache: "npm" - name: Install X11 dependencies for robotjs (needed for unit testing on input-mask tests) run: sudo apt-get install libxtst-dev libpng++-dev xvfb @@ -35,7 +35,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: "20.11.0" + node-version: "20.15.0" cache: "npm" - name: Set up JDK 11 for x64 uses: actions/setup-java@v4 diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..4c69ec51 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +engine-strict=true +chromedriver_force_download=true diff --git a/.nvmrc b/.nvmrc index f48de772..c12134be 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v20.4.0 \ No newline at end of file +v20.15.0 diff --git a/README.md b/README.md index 98c2f127..c0b33b4f 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A place to learn and share with developers what makes web work accessible. This - nvm: A Node version manager. It allows you to install several versions of node on the same machine and change versions easily. - [Here are instructions in how to install nvm](https://github.com/nvm-sh/nvm#usage) - - After installing nvm, install a Node version >= 18 using nvm, ideally `nvm install 20.11.0` + - After installing nvm, install a Node version >= 20.15.0 using nvm, ideally `nvm install 20.15.0` - npm: a Node Package Manager, usually installed alongside Node - More info: [Downloading and installing Node.js and NPM](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) - Lynx: A text-only browser used for testing for how a website will work without graphics turned on. @@ -74,6 +74,17 @@ A place to learn and share with developers what makes web work accessible. This ```sh git clone git@github.com:PublicisSapient/enable-a11y.git cd enable-a11y + ``` + + ```sh + nvm use + ``` + + This instructs nvm to use the Node version specified in the `.nvmrc` file located in the project root directory. + + > Note: If the specified version has not been installed yet, nvm will advise to install it after running the command above. + + ```sh npm clean-install ``` diff --git a/bin/validate-node-version.mjs b/bin/validate-node-version.mjs new file mode 100644 index 00000000..6e84b06a --- /dev/null +++ b/bin/validate-node-version.mjs @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +import chalk from 'chalk'; +import { execSync } from 'child_process'; +import fs from 'fs'; +import path from 'path'; + +async function getRunningVersion() { + const terminalCmd = 'node --version'; + + try { + return execSync(terminalCmd).toString().trim(); + } catch (e) { + console.log(chalk.red(`Node version validation failed while running ${terminalCmd}`), e); + } +} + +async function validateVersion() { + const directory = path.resolve(); + let runningVersion; + + try { + const filePath = path.resolve(directory, '.nvmrc'); + const fileMetadata = await fs.promises.stat(filePath); + const fileContent = fs.readFileSync(filePath, "utf8"); + let specVersion; + + if (fileMetadata) { + specVersion = fileContent.startsWith("v") ? fileContent : `v${fileContent};` + runningVersion = (await getRunningVersion()).trim(); + + if (runningVersion.trim() !== specVersion.trim()) { + console.log(chalk.red(`Your Node version ${runningVersion} does not match the specified version ${specVersion} \rfound in the .nvmrc file in your project root`) ); + console.log('\n-------------\n'); + console.log(chalk.red('Run command "nvm use" followed by "npm ci" in your terminal before running "npm run start" again.\n')); + process.exit(1); + } + } + + + } catch (e) { + if (e.code !== "ENOENT") { + console.log(chalk.red('An unexpected error occurred while validating your Node version.\n')); + console.error(e); + process.exit(1); + } + console.log(chalk.red('Make sure the ".nvmrc" file from the Git repository is present in your project root directory\n')); + console.error(e); + process.exit(1); + } +} + +validateVersion(); diff --git a/js/test/combobox.test.js b/js/test/combobox.test.js index f0994545..3f311173 100644 --- a/js/test/combobox.test.js +++ b/js/test/combobox.test.js @@ -29,9 +29,6 @@ const testAutosuggestions = async ( // Assertions to test the autosuggestion options expect(allContainSubstring).toBeTruthy(); expect(suggestions.length).toBe(expectedCount); - console.log( - `Suggestions after typing '${typeText}': ${suggestions.join(', ')}`, - ); }; describe("All combobox's Attributes Test", () => { diff --git a/js/test/horizontal-scroll.test.js b/js/test/horizontal-scroll.test.js index 611a9ac7..8694dd01 100644 --- a/js/test/horizontal-scroll.test.js +++ b/js/test/horizontal-scroll.test.js @@ -35,12 +35,6 @@ describe('Test Horizontal Scrolling on all pages on Enable', () => { }; }); - if (!domInfo.doesPageHorizontallyScroll) { - console.log( - `isWrapChecked: (${domInfo.isWrapChecked}), scrollWidth: ${domInfo.scrollWidth}, clientWidth: ${domInfo.clientWidth}.`, - ); - } - expect(domInfo.doesPageHorizontallyScroll).toBe(false); } @@ -72,10 +66,6 @@ describe('Test Horizontal Scrolling on all pages on Enable', () => { } }); - console.log( - `has checkbox: ${hasCheckbox}, filename: ${filename}, isDesktop: ${isDesktop}`, - ); - if (hasCheckbox) { // press space and check if it's unchecked. await page.keyboard.press('Space'); diff --git a/package-lock.json b/package-lock.json index bc7c1c31..caf0653c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,8 @@ "@prettier/plugin-php": "^0.22.2", "accessibility-js-routines": "^3.4.1", "babel-preset-env": "^1.7.0", - "chromedriver": "^126.0.4", + "chalk": "^5.3.0", + "chromedriver": "^128.0.1", "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", @@ -70,6 +71,10 @@ "vnu-jar": "^23.4.11", "webpack-cli": "^5.1.4", "wget-improved": "^3.4.0" + }, + "engines": { + "node": ">=20.10.0 <=20.16.0", + "npm": ">=10.2.3 <=10.8.1" } }, "node_modules/@ampproject/remapping": { @@ -586,6 +591,19 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/parser": { "version": "7.25.4", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.4.tgz", @@ -4278,7 +4296,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "license": "MIT", "dependencies": { "color-convert": "^1.9.0" }, @@ -6478,17 +6495,14 @@ } }, "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "engines": { - "node": ">=4" + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/chalk-template": { @@ -6506,18 +6520,6 @@ "url": "https://github.com/chalk/chalk-template?sponsor=1" } }, - "node_modules/chalk-template/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/char-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", @@ -6667,15 +6669,14 @@ } }, "node_modules/chromedriver": { - "version": "126.0.5", - "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-126.0.5.tgz", - "integrity": "sha512-xXVxwxd8CJ6yg2KEvFqLQi7V0RvF78xFnLB+xo9g9MoJNHMQccD7b4OWaxtKDy5RXrMgQ6Jb6vUN3SjTYXHLEQ==", + "version": "128.0.1", + "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-128.0.1.tgz", + "integrity": "sha512-UmWqZXXAyuRa37pE+lnU46vJcCM/y0ddF015LHxycEOYfuqsK7k9ZxJuXCQNWbws9e7FAMQj/GJZT92WPgis0g==", "dev": true, "hasInstallScript": true, - "license": "Apache-2.0", "dependencies": { "@testim/chrome-version": "^1.1.4", - "axios": "^1.6.7", + "axios": "^1.7.4", "compare-versions": "^6.1.0", "extract-zip": "^2.0.1", "proxy-agent": "^6.4.0", @@ -7040,7 +7041,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "license": "MIT", "dependencies": { "color-name": "1.1.3" } @@ -7048,8 +7048,7 @@ "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "license": "MIT" + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "node_modules/color-support": { "version": "1.1.3", @@ -12812,6 +12811,19 @@ "node": ">=6" } }, + "node_modules/inquirer-autosubmit-prompt/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/inquirer-autosubmit-prompt/node_modules/cli-width": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", @@ -17321,6 +17333,19 @@ "node": ">=4" } }, + "node_modules/listr-verbose-renderer/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/listr-verbose-renderer/node_modules/date-fns": { "version": "1.30.1", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", @@ -17878,18 +17903,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-symbols/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/log-update": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/log-update/-/log-update-2.3.0.tgz", @@ -18859,18 +18872,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/np/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/np/node_modules/cli-boxes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", diff --git a/package.json b/package.json index c0268725..10114d99 100644 --- a/package.json +++ b/package.json @@ -49,13 +49,14 @@ "format": "npx prettier . --write", "format-check": "npx prettier . --check", "eslint": "eslint .", - "server": "node bin/promote-node-modules-to-server.js && concurrently --kill-others \"less-watch-compiler\" \"npm-watch\" \"node bin/server.js\" ", + "server": "npm run validate:version && node bin/promote-node-modules-to-server.js && concurrently --kill-others \"less-watch-compiler\" \"npm-watch\" \"node bin/server.js\" ", "start": "npm run server", "stylelint": "npx stylelint \"**/*.less\"", "stylelint:fix": "npx stylelint \"**/*.less\" --fix", "watch": "npm-watch", "convert-modules-to-libs": "bash bin/convert-modules-to-libs.sh", - "prepare": "node .husky/install.mjs" + "prepare": "node .husky/install.mjs", + "validate:version": "node bin/validate-node-version.mjs" }, "jest": { "verbose": true, @@ -94,7 +95,8 @@ "@prettier/plugin-php": "^0.22.2", "accessibility-js-routines": "^3.4.1", "babel-preset-env": "^1.7.0", - "chromedriver": "^126.0.4", + "chalk": "^5.3.0", + "chromedriver": "^128.0.1", "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", @@ -149,14 +151,11 @@ }, "lint-staged": { "*.{js,jsx,ts,tsx,css,less}": [ - "eslint --fix", - "npm run stylelint", - "git add" + "eslint", + "npm run stylelint" ], "*.{js,jsx,ts,tsx,json}": [ - "prettier --write", - "npm test", - "git add" + "prettier" ] }, "bin": { @@ -164,5 +163,9 @@ }, "overrides": { "graceful-fs": "^4.2.11" + }, + "engines": { + "npm": ">=10.2.3 <=10.8.1", + "node": ">=20.10.0 <=20.16.0" } } diff --git a/sitemap.txt b/sitemap.txt index 7f05ff61..635f0562 100644 --- a/sitemap.txt +++ b/sitemap.txt @@ -2,6 +2,7 @@ https://www.useragentman.com/enable/index.php https://www.useragentman.com/enable/accessible-text-svg.php https://www.useragentman.com/enable/alert.php https://www.useragentman.com/enable/animated-gif-with-pause-button.php +https://www.useragentman.com/enable/audio-player.php https://www.useragentman.com/enable/button.php https://www.useragentman.com/enable/carousel.php https://www.useragentman.com/enable/checkbox.php