fix: repair pipe test and document Bash NVM setup
This commit is contained in:
1 parent
326575e55d
commit
1d660a3c40
5 files changed
+119
-56
No files matched your search
@@ -89,7 +89,9 @@ Do not manually edit generated output or installed dependencies:
|
|||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
- Node.js must use the `lts/jod` NVM alias, as declared in `.nvmrc`.
|
- Node.js must use the `lts/jod` NVM alias, as declared in `.nvmrc`.
|
||||||
- Before every npm command, run `nvm use lts/jod` in the same shell session. Agent terminal calls do not share shell state, so combine this with the npm command when necessary (for example, `nvm use lts/jod && npm run build`).
|
- Documented commands target Bash on Linux, macOS, or Windows WSL. Use Bash explicitly for agent commands; fish's `nvm.fish` is unavailable in Bash.
|
||||||
|
- Before every npm command, explicitly load Bash NVM and select Node in the same shell session: `export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"; . "$NVM_DIR/nvm.sh" && nvm use lts/jod && npm run build`. Do not rely on `.bashrc` loading in noninteractive shells or fall back to system Node.
|
||||||
|
- If `${NVM_DIR:-$HOME/.nvm}/nvm.sh` is missing, ask the user for permission before installing Bash NVM. Follow `docs/development.md#shell-and-nvm-setup` after approval. Keep existing fish NVM separate.
|
||||||
- Install exact dependencies: `npm ci`
|
- Install exact dependencies: `npm ci`
|
||||||
- Start the Ionic development server: `npm start`
|
- Start the Ionic development server: `npm start`
|
||||||
- Build the web application: `npm run build`
|
- Build the web application: `npm run build`
|
||||||
|
|||||||
@@ -35,39 +35,52 @@ For desktop development, also install:
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Select the project Node.js version before running any npm command. `.nvmrc` declares `lts/jod`:
|
These commands target **Bash** (Linux, macOS, or Windows WSL). From fish,
|
||||||
|
start `bash` first. Follow the [shell and NVM setup](docs/development.md#shell-and-nvm-setup)
|
||||||
|
before continuing. If Bash NVM is missing, agents must ask permission before
|
||||||
|
installing it. `.nvmrc` declares `lts/jod`:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
nvm install
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
nvm use
|
. "$NVM_DIR/nvm.sh"
|
||||||
npm ci
|
nvm install lts/jod
|
||||||
|
nvm use lts/jod && npm ci
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `nvm use` again after opening a new shell or after switching Node.js versions for another project.
|
Each npm command block loads Bash NVM explicitly and selects the required Node
|
||||||
|
version, including in fresh noninteractive shells.
|
||||||
|
|
||||||
If Ionic CLI is not already installed:
|
If Ionic CLI is not already installed:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm install --global @ionic/cli
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm install --global @ionic/cli
|
||||||
```
|
```
|
||||||
|
|
||||||
## Web development
|
## Web development
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm start
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
Build the Angular application:
|
Build the Angular application:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run build
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
Run linting and tests:
|
Run linting and tests:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run lint
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
npm test
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run lint
|
||||||
|
nvm use lts/jod && npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
`npm test` starts Karma in its configured mode and may remain open in watch mode.
|
`npm test` starts Karma in its configured mode and may remain open in watch mode.
|
||||||
@@ -82,15 +95,19 @@ For VS Code, the recommended extension is `esbenp.prettier-vscode`. Use **Format
|
|||||||
|
|
||||||
The Tauri CLI is available through:
|
The Tauri CLI is available through:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run tauri -- <command>
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run tauri -- <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run tauri -- dev
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
npm run tauri -- build
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run tauri -- dev
|
||||||
|
nvm use lts/jod && npm run tauri -- build
|
||||||
```
|
```
|
||||||
|
|
||||||
> Tauri development intentionally uses `http://localhost:8103`. The current `npm start` script does not explicitly select that port, so verify that Ionic is listening on `8103` when using `tauri dev`.
|
> Tauri development intentionally uses `http://localhost:8103`. The current `npm start` script does not explicitly select that port, so verify that Ionic is listening on `8103` when using `tauri dev`.
|
||||||
|
|||||||
+48
-17
@@ -9,26 +9,51 @@
|
|||||||
- npm
|
- npm
|
||||||
- Ionic CLI available as `ionic`
|
- Ionic CLI available as `ionic`
|
||||||
|
|
||||||
Select the project Node.js version before running any npm command:
|
### Shell and NVM setup
|
||||||
|
|
||||||
```sh
|
The command examples in this repository target **Bash** on Linux, macOS,
|
||||||
nvm install
|
or Windows WSL. If your usual shell is fish, start `bash` before using them.
|
||||||
nvm use
|
`nvm.fish` is a separate implementation; its functions are unavailable in Bash.
|
||||||
|
|
||||||
|
Check for the Bash NVM installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
test -s "${NVM_DIR:-$HOME/.nvm}/nvm.sh"
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `nvm use` again in every new shell and after switching versions for another project. Agent terminal commands start separate shell processes, so they must activate Jod in the same command invocation as the npm command when shell state is not retained.
|
If this check fails, agents must ask the user for permission before installing
|
||||||
|
NVM. After approval, follow the official
|
||||||
|
[NVM installation instructions](https://github.com/nvm-sh/nvm#installing-and-updating).
|
||||||
|
Use the default `~/.nvm` location, or set `NVM_DIR` to your existing Bash NVM
|
||||||
|
installation. Keep an existing fish installation separate.
|
||||||
|
|
||||||
|
After NVM is installed, install the required Node release from the project root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm install lts/jod
|
||||||
|
```
|
||||||
|
|
||||||
|
Every npm command block below explicitly loads NVM and selects `lts/jod`.
|
||||||
|
This also works in noninteractive Bash sessions that do not load `.bashrc`.
|
||||||
|
Run each block from the project root. Stop if loading NVM or selecting Node fails;
|
||||||
|
do not fall back to the system Node version.
|
||||||
|
|
||||||
Install exact project dependencies with:
|
Install exact project dependencies with:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
nvm use lts/jod
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
npm ci
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm ci
|
||||||
```
|
```
|
||||||
|
|
||||||
If needed, install Ionic CLI globally:
|
If needed, install Ionic CLI globally:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm install --global @ionic/cli
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm install --global @ionic/cli
|
||||||
```
|
```
|
||||||
|
|
||||||
The committed `.nvmrc` uses the named `lts/jod` alias. Do not replace it with another Node release or add `.tool-versions` unless the team intentionally changes version-management tools.
|
The committed `.nvmrc` uses the named `lts/jod` alias. Do not replace it with another Node release or add `.tool-versions` unless the team intentionally changes version-management tools.
|
||||||
@@ -41,14 +66,18 @@ Install Rust stable and the Tauri 2 prerequisites for your operating system. `sr
|
|||||||
|
|
||||||
Start the Ionic development server:
|
Start the Ionic development server:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm start
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
Build the Angular application:
|
Build the Angular application:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run build
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
The production web output is generated under `www/`. Do not edit that directory manually.
|
The production web output is generated under `www/`. Do not edit that directory manually.
|
||||||
@@ -74,9 +103,11 @@ Prettier is currently an editor workflow; the repository does not declare a Pret
|
|||||||
|
|
||||||
Run Tauri commands through the npm script:
|
Run Tauri commands through the npm script:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run tauri dev
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
npm run tauri build
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run tauri dev
|
||||||
|
nvm use lts/jod && npm run tauri build
|
||||||
```
|
```
|
||||||
|
|
||||||
Tauri development intentionally expects the frontend at `http://localhost:8103`. `devUrl` only tells Tauri where to connect; the Ionic command must also listen on port `8103`. The current `npm start` script does not explicitly select that port, so verify the complete development flow when changing Tauri or serve configuration.
|
Tauri development intentionally expects the frontend at `http://localhost:8103`. `devUrl` only tells Tauri where to connect; the Ionic command must also listen on port `8103`. The current `npm start` script does not explicitly select that port, so verify the complete development flow when changing Tauri or serve configuration.
|
||||||
|
|||||||
+29
-17
@@ -6,16 +6,24 @@ Angular unit tests use Jasmine and Karma. Test files are colocated with their su
|
|||||||
|
|
||||||
## Local test commands
|
## Local test commands
|
||||||
|
|
||||||
|
These examples target Bash and run from the project root. Complete the
|
||||||
|
[shell and NVM setup](development.md#shell-and-nvm-setup) first. Agents must ask
|
||||||
|
permission before installing missing Bash NVM. Each npm block loads NVM explicitly.
|
||||||
|
|
||||||
Run the interactive test suite:
|
Run the interactive test suite:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm test
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the configured non-watching CI test mode:
|
Run the configured non-watching CI test mode:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm test -- --configuration=ci
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm test -- --configuration=ci
|
||||||
```
|
```
|
||||||
|
|
||||||
The test environment requires an available Chrome installation. Test coverage output, when enabled by the test runner, is written under `coverage/app/`.
|
The test environment requires an available Chrome installation. Test coverage output, when enabled by the test runner, is written under `coverage/app/`.
|
||||||
@@ -24,14 +32,18 @@ The test environment requires an available Chrome installation. Test coverage ou
|
|||||||
|
|
||||||
Lint TypeScript and Angular templates:
|
Lint TypeScript and Angular templates:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run lint
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run lint
|
||||||
```
|
```
|
||||||
|
|
||||||
Build the production Angular application:
|
Build the production Angular application:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
npm run build
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use lts/jod && npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
Check Rust changes from the Tauri directory:
|
Check Rust changes from the Tauri directory:
|
||||||
@@ -44,15 +56,15 @@ cargo check
|
|||||||
|
|
||||||
Choose checks based on the changed area:
|
Choose checks based on the changed area:
|
||||||
|
|
||||||
| Change | Expected validation |
|
| Change | Expected validation |
|
||||||
|---|---|
|
| ------------------------------ | -------------------------------------------------------------------- |
|
||||||
| Documentation only | Markdown/editor diagnostics and `git diff --check` |
|
| Documentation only | Markdown/editor diagnostics and `git diff --check` |
|
||||||
| Angular TypeScript or template | Related tests, `npm run lint`, and `npm run build` |
|
| Angular TypeScript or template | Related tests, `npm run lint`, and `npm run build` |
|
||||||
| Service or domain behavior | Behavior-focused service/page tests, lint, and build |
|
| Service or domain behavior | Behavior-focused service/page tests, lint, and build |
|
||||||
| Dexie schema or migration | Migration tests where practical, lint, and build |
|
| Dexie schema or migration | Migration tests where practical, lint, and build |
|
||||||
| Styles only | Build and visual verification at relevant viewport sizes |
|
| Styles only | Build and visual verification at relevant viewport sizes |
|
||||||
| Rust code | `cargo check` plus relevant Rust tests if introduced |
|
| Rust code | `cargo check` plus relevant Rust tests if introduced |
|
||||||
| Tauri/release configuration | Build/config checks available on the host; report untested platforms |
|
| Tauri/release configuration | Build/config checks available on the host; report untested platforms |
|
||||||
|
|
||||||
## Testing conventions
|
## Testing conventions
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { FullnamePipe } from './fullname-pipe';
|
import { FullnamePipe } from './fullname-pipe';
|
||||||
|
|
||||||
describe('FullnamePipePipe', () => {
|
describe('FullnamePipePipe', () => {
|
||||||
it('create an instance', () => {
|
it('create an instance', () => {
|
||||||
const pipe = new FullnamePipe();
|
const pipe = TestBed.runInInjectionContext(() => new FullnamePipe());
|
||||||
expect(pipe).toBeTruthy();
|
expect(pipe).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user