https://github.com/arbisoft/session-portal-frontend
https://github.com/arbisoft/session-portal-frontend
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/arbisoft/session-portal-frontend
- Owner: arbisoft
- Created: 2024-10-24T12:08:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-17T12:52:06.000Z (7 months ago)
- Last Synced: 2025-11-17T14:18:44.923Z (7 months ago)
- Language: TypeScript
- Size: 1.67 MB
- Stars: 0
- Watchers: 4
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README







# Arbisoft Sessions Portal Frontend
## Getting Started
1. Clone repository
```bash
git clone https://github.com/arbisoft/session-portal-frontend.git session-portal
```
2. Install dependencies
```bash
cd session-portal
npm install
```
3. Copy example environment file
```bash
cp example.env.local .env.local
```
4. Run development server
```bash
npm run dev
```
## For Testing
### Installation
```bash
npx playwright install
```
### Running tests
1. Run development server
```bash
npm run dev
```
1. Run Playwright
```bash
npx playwright test --ui
```
or
```bash
npx playwright test
```
## Jest Configuration Overview
### 1. **Next.js Jest Setup**
- The configuration uses `next/jest` to load the Next.js app's configuration (`next.config.js`) and environment variables (`.env`) into the test environment.
- The `dir: "./"` option specifies the root directory of the Next.js app.
```typescript
const createJestConfig = nextJest({
dir: "./",
});
```
### 2. **Custom Jest Configuration**
The following custom settings are applied to the Jest configuration:
- **`coverageProvider: "v8"`**: Uses the V8 engine for code coverage analysis, which is faster and more reliable.
- **`testEnvironment: "jsdom"`**: Sets the test environment to `jsdom`, enabling DOM-based testing for components.
- **`setupFilesAfterEnv`**: Specifies a setup file (`jest.setup.ts`) to run before each test. This is useful for configuring global test setups, such as mocking libraries or initializing test utilities.
```typescript
setupFilesAfterEnv: ["/jest.setup.ts"],
```
- **`moduleNameMapper`**: Maps CSS and SCSS files to `identity-obj-proxy` to avoid errors when importing styles in tests.
```typescript
moduleNameMapper: {
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
},
```
- **`testMatch`**: Defines the pattern for locating test files. It includes:
- Files in the `__tests__` directory.
- Files with `.test.[jt]s(x)?` or `.spec.[jt]s(x)?` extensions.
```typescript
testMatch: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(test).[jt]s?(x)"],
```
- Ensure your test files follow the naming conventions specified in `testMatch`.
- **`coverageThreshold`**: Sets minimum coverage thresholds for the entire project:
- Branches: 80%
- Functions: 80%
- Lines: 80%
- Statements: -10 (no threshold, but included for reference)
```typescript
coverageThreshold: {
global: { branches: 80, functions: 80, lines: 80, statements: -10 },
},
```
- **`coverageDirectory`**: Specifies the directory where coverage reports will be saved.
```typescript
coverageDirectory: "./coverage/",
```
### 3. **View Coverage**:
After running tests, check the `./coverage/` directory for detailed coverage reports.
# **Using `nvm use` to Switch to Node.js 22 LTS**
## **Overview**
This guide explains how to use `nvm` (Node Version Manager) to switch to **Node.js 22 LTS** and ensure that the correct version is being used in your project.
## **1. Install NVM (If Not Installed)**
If you don’t have `nvm` installed, follow these steps:
### **For macOS & Linux:**
Run the following command:
```sh
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
```
Then restart your terminal or run:
```sh
source ~/.nvm/nvm.sh
```
### **For Windows:**
Use **nvm-windows**: [Download Here](https://github.com/coreybutler/nvm-windows/releases)
## **2. Verify NVM Installation**
To check if `nvm` is installed, run:
```sh
nvm --version
```
You should see the version number displayed.
## **3. Install and Use Node.js 22 LTS**
Run the following command to install Node.js 22 LTS:
```sh
nvm install 22
```
Once installed, switch to Node.js 22:
```sh
nvm use 22
```
To verify that the correct version is active, run:
```sh
node -v
```
This should output something like:
```sh
v22.x.x
```
## **4. Set Node.js 22 as the Default Version (Optional)**
If you want Node.js 22 LTS to be the default version when opening a new terminal, set it globally:
```sh
nvm alias default 22
```
Now, every time you open a new terminal session, Node.js 22 will be used.
## **6. Troubleshooting**
- If `nvm use 22` does not work, make sure you have installed Node.js 22 using `nvm install 22`.
- If `nvm` commands are not recognized, restart your terminal or run:
```sh
source ~/.nvm/nvm.sh
```
- On Windows, ensure you're using `nvm-windows` and check `nvm list` for installed versions.
## Inspiration
Boilerplate Inspiration (https://github.com/brocoders/extensive-react-boilerplate).