From 901964a6a3cdcce676f8c5212bc38dab5c3ea85b Mon Sep 17 00:00:00 2001 From: ishan kumar <289112142+ishan-one8@users.noreply.github.com> Date: Sat, 3 Oct 2026 15:30:18 +0530 Subject: [PATCH] docs: point setup at .nvmrc and document how to run the tests --- README.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4d24fe499..ad2b3e5d1 100644 --- a/README.md +++ b/README.md @@ -37,16 +37,22 @@ Ensure that the "Enable CORS" option is turned on in your Rocket.Chat server. Yo #### Prerequisites -- **Node.js**: Version 22 (LTS) is required. Use [Node Version Manager (NVM)](https://github.com/nvm-sh/nvm) for easy switching between Node.js versions. - - To install and use the correct Node.js version, execute the following commands with the specific version number: +- **Node.js**: the required version is pinned in [`.nvmrc`](.nvmrc) at the repo root. Instead of copying a version number by hand, let [NVM](https://github.com/nvm-sh/nvm) read it for you — run these from the repo root: ```bash - nvm install - nvm use + nvm install + nvm use ``` - Replace `` with the required Node.js version + With no argument, both commands read `.nvmrc`, so they stay correct whenever the pinned version changes. + + `yarn` verifies this before it installs anything: a `preinstall` hook (`scripts/node-check.js`) compares your Node major version against `.nvmrc` and stops with a message like + + ``` + Error: Required Node.js major version is 24, but found v22.11.0. + ``` + + If you see that, run `nvm install && nvm use` from the repo root and install again. - **Yarn Workspaces**: Ensure Yarn workspaces are enabled. If not, run: @@ -70,6 +76,26 @@ After installing dependencies, build the packages (`auth`, `api`, and `react`) b yarn build ``` +#### Running the Tests + +Tests live alongside the package they cover, and **each package is run from its own directory**. Babel and the test runners resolve their configuration from the current working directory, so running them from the repo root will not pick up a package's `babel.config.js`. + +`packages/layout_editor` uses Node's built-in test runner: + +```bash +cd packages/layout_editor +yarn test +``` + +`packages/e2e-react` holds the Playwright end-to-end suite. It needs a running Rocket.Chat server and a built `react` package: + +```bash +cd packages/e2e-react +yarn test +``` + +`packages/react` contains `src/index.test.js`, but it cannot be run on `develop` as things stand — see [#1191](https://github.com/RocketChat/EmbeddedChat/issues/1191). + #### Starting Storybook for React Navigate to the `react` package directory and start Storybook with the following commands: