Date: Mon, 1 Sep 2025 12:48:45 -0300
Subject: [PATCH 22/28] Fix html page
---
CLAUDE.md | 11 +++++++----
html/equations-parser-test.html | 28 ++++++----------------------
js/equations_parser_wrapper.js | 12 +++---------
3 files changed, 16 insertions(+), 35 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index 1a866c7..1790752 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -35,7 +35,7 @@ C++ equations-parser Library
### โ
Phase 1: Basic WebAssembly Integration (Removed)
- ~~C++ toy functions compiled to WebAssembly~~ (Cleaned up - no longer needed)
-- ~~JavaScript wrapper library~~ (Cleaned up - no longer needed)
+- ~~JavaScript wrapper library~~ (Cleaned up - no longer needed)
- ~~HTML test interface~~ (Cleaned up - no longer needed)
- **Status**: Complete and cleaned up
@@ -196,7 +196,7 @@ npm run build # Build WebAssembly module
### Setup & Installation
```bash
-npm install # Install all dependencies
+npm install # Install all dependencies
chmod +x build.sh # Make build script executable
./build.sh # Compile C++ to WebAssembly
```
@@ -266,7 +266,7 @@ The repository is configured as a production-ready npm package with dual CommonJ
```bash
# 1. Ensure everything is built and tested
-npm run build # Builds WebAssembly module
+npm run build # Builds WebAssembly module
npm test # Runs comprehensive test suite
npm run lint # Checks code quality
@@ -284,17 +284,20 @@ npm publish --access public
```
**Package Structure:**
+
- **CommonJS entry**: `index.cjs` for Node.js `require()`
-- **ES Module entry**: `index.mjs` for modern `import`
+- **ES Module entry**: `index.mjs` for modern `import`
- **TypeScript definitions**: `types.d.ts` with complete type safety
- **Automated scripts**: `prepublishOnly` and `prepack` ensure quality
**Installation for users:**
+
```bash
npm install parsec-web
```
**Usage examples:**
+
```javascript
// CommonJS (Node.js)
const { Parsec } = require('parsec-web')
diff --git a/html/equations-parser-test.html b/html/equations-parser-test.html
index 13adf26..dff4f79 100644
--- a/html/equations-parser-test.html
+++ b/html/equations-parser-test.html
@@ -505,7 +505,7 @@ ๐ Console Output
try {
const result = parsec.eval(input.value.trim());
- displayEvaluationResult(result, resultDiv);
+ displayEvaluationResult(result, resultDiv, input.value.trim());
} catch (error) {
displayJavaScriptError(error, resultDiv);
}
@@ -519,37 +519,21 @@ ๐ Console Output
resultDiv.innerHTML = 'Please enter an equation
';
}
- function displayEvaluationResult(result, resultDiv) {
- if (result.success) {
- displaySuccessResult(result, resultDiv);
- } else {
- displayErrorResult(result, resultDiv);
- }
- }
-
- function displaySuccessResult(result, resultDiv) {
- const valueType = typeof result.value;
+ function displayEvaluationResult(result, resultDiv, equation) {
+ // With the new API, result is the direct value, not an object with success property
+ const valueType = typeof result;
const convertedNote = valueType !== 'string' ? ` (converted to ${valueType})` : '';
resultDiv.innerHTML = `
-
Result: ${result.value}
+
Result: ${result}
- Type: ${result.type}${convertedNote} | Equation: ${result.equation}
+ Type: ${valueType}${convertedNote} | Equation: ${equation}
`;
}
- function displayErrorResult(result, resultDiv) {
- resultDiv.innerHTML = `
-
-
Error: ${result.error}
-
Equation: ${result.equation}
-
- `;
- }
-
function displayJavaScriptError(error, resultDiv) {
resultDiv.innerHTML = `
diff --git a/js/equations_parser_wrapper.js b/js/equations_parser_wrapper.js
index db18ec8..ccd3ac3 100644
--- a/js/equations_parser_wrapper.js
+++ b/js/equations_parser_wrapper.js
@@ -222,7 +222,6 @@ class Parsec {
'zeros(rows,cols) - matrix of zeros',
'eye(n) - identity matrix',
'size(matrix) - matrix dimensions',
- "transpose - matrix transpose operator (')",
],
// Array/vector functions
@@ -369,19 +368,14 @@ class Parsec {
equation: testCase.equation,
description: testCase.description,
expected: testCase.expected,
- actual: result.success ? result.value : result.error,
+ actual: result,
passed: false,
}
}
_evaluateTestResult(testResult, testCase, result) {
- if (!result.success) {
- testResult.passed = false
- testResult.error = result.error
- return
- }
-
- const actualValue = result.value.toString()
+ // With the new API, result is the direct value, not an object
+ const actualValue = result.toString()
const expectedValue = testCase.expected.toString()
testResult.passed = testCase.allowBooleanString
From 08e41b243981440c0b275f91ea8a03396038d334 Mon Sep 17 00:00:00 2001
From: Victor Costa
Date: Mon, 1 Sep 2025 19:43:42 -0300
Subject: [PATCH 23/28] Improve README usability by moving Quick Start section
to beginning
- Moved Quick Start section from line 678 to after Key Features (line 58)
- Preserves all existing detailed documentation sections
- Follows upstream/main improvement for better user experience
- Maintains comprehensive Installation, Basic Usage, and Development Setup sections
---
README.md | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/README.md b/README.md
index 38c8627..87a6ae3 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,32 @@ graph LR
- **Complete Feature Parity**: All equations-parser functions available
- **Cross-Platform**: Web, Mobile, Desktop support
+## ๐ Quick Start
+
+### Prerequisites
+- Emscripten SDK installed and configured
+- Modern web browser with ES6 module support
+- Local web server (Python, Node.js, or similar)
+
+### Build and Test
+```bash
+# 1. Build the WebAssembly module
+chmod +x build-equations-parser.sh
+./build-equations-parser.sh
+
+# 2. Start local server
+python3 -m http.server 8000
+
+# 3. Open test page
+# Navigate to: http://localhost:8000/html/equations-parser-test.html
+```
+
+### Expected Results
+- โ
"WebAssembly module ready!" status message
+- โ
Interactive math function testing
+- โ
Automated test suite passes
+- โ
C++ debug output in console
+
## ๐๏ธ Implementation Phases
### โ
Phase 1: Basic WebAssembly + JavaScript Integration _(CLEANED UP)_
From 08aa4e480a22676905b641aff857d6a65af82a78 Mon Sep 17 00:00:00 2001
From: Victor Costa
Date: Mon, 1 Sep 2025 20:00:03 -0300
Subject: [PATCH 24/28] Simplify documentation by removing development phase
references
Remove outdated phase-based structure from both README.md and CLAUDE.md to focus on essential developer onboarding information. This streamlines the documentation by eliminating historical context that's no longer relevant for users or contributors.
Changes:
- Remove "Development Phases" section with phase numbering and status tracking
- Consolidate implementation details into focused feature sections
- Update API documentation to remove "New in Step X" labels
- Restructure content to be more direct and development-focused
- Maintain all technical information while improving readability
The documentation now presents a cleaner, more professional appearance suitable for new developers joining the project.
---
CLAUDE.md | 81 ++-----
README.md | 694 +++++++-----------------------------------------------
2 files changed, 106 insertions(+), 669 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index 1790752..f6cd592 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -30,31 +30,11 @@ C++ equations-parser Library
3. **Node.js Applications**: As importable npm package
4. **Cross-Platform Solutions**: Any JavaScript environment
-## ๐ Development Phases
+## ๐งช Testing Framework
-### โ
Phase 1: Basic WebAssembly Integration (Removed)
+The project uses **Vitest** as the primary testing framework for comprehensive equation evaluation testing.
-- ~~C++ toy functions compiled to WebAssembly~~ (Cleaned up - no longer needed)
-- ~~JavaScript wrapper library~~ (Cleaned up - no longer needed)
-- ~~HTML test interface~~ (Cleaned up - no longer needed)
-- **Status**: Complete and cleaned up
-
-### โ
Phase 2: Equations-Parser Integration
-
-- Real equations-parser C++ library integration
-- Comprehensive WebAssembly compilation
-- Full feature support (math, strings, complex, arrays, dates)
-- **Status**: Complete
-
-### โ
Phase 3: Automated Testing Framework
-
-- **Framework**: Vitest (modern, reliable testing framework)
-- **Target**: Comprehensive testing through `Parsec.eval(equation)` method
-- **Status**: Complete with modern testing approach
-
-#### Test Implementation Strategy
-
-Instead of HTML-based manual testing, Phase 3 uses **Vitest** for:
+### Test Implementation Strategy
**Test Categories:**
@@ -92,48 +72,34 @@ npm run test:integration # Integration tests only
npm run test:performance # Performance benchmarks
```
-### โ
Phase 4: Library Transformation & Code Quality
-
-- **Package Rename**: `parsec-equations-lib` โ `parsec-web` (matches repository)
-- **API Redesign**: Clean `Parsec` class with intuitive naming
-- **Direct Values**: `parsec.eval('2+3')` โ `5` (not wrapped in result object)
-- **Enterprise Linting**: ESLint + Prettier with automated fixing
-- **Multi-Format Package**: CommonJS, ES6 modules, TypeScript definitions
-- **Status**: Complete - Ready for professional use
+## ๐ฆ Library Features
-### ๐ Phase 5: Generalization for Cross-Platform Use
-
-- **Goal**: Make library truly reusable across platforms
-- **Status**: **COMPLETED** - Modern cross-platform library structure implemented
-
-#### Implementation Highlights
-
-**โ
NPM Package Structure:**
+### NPM Package Structure
- `package.json` - Complete npm configuration with proper scripts and metadata
- Multi-format exports supporting ES6, CommonJS, and UMD patterns
- TypeScript definitions included for full type safety
- Professional package structure ready for npm publishing
-**โ
Enhanced API:**
+### Enhanced API
```javascript
-// New Parsec class with enhanced functionality
+// Parsec class with enhanced functionality
const parsec = new Parsec()
await parsec.initialize()
-// Batch evaluation (NEW)
+// Batch evaluation
const results = parsec.evaluateBatch(['2+2', 'sqrt(16)', 'sin(pi/2)'])
-// Timeout protection (NEW)
+// Timeout protection
const result = await parsec.evaluateWithTimeout('expression', 5000)
-// Library metadata (NEW)
+// Library metadata
const info = parsec.getInfo()
console.log(info.supportedPlatforms) // Multiple platform support info
```
-**โ
Cross-Platform Import Support:**
+### Cross-Platform Import Support
```javascript
// ES6 Modules
@@ -146,14 +112,14 @@ const { Parsec } = require('parsec-web')
import { Parsec, EquationResult } from 'parsec-web'
```
-**โ
Code Quality Infrastructure:**
+### Code Quality Infrastructure
- **Prettier**: Automatic code formatting with consistent style rules
- **ESLint**: Code quality checking with modern JavaScript best practices
- **npm scripts**: `style:fix`, `lint:fix`, `format`, `test` commands
-- **Vitest configuration**: Modern testing framework setup replacing HTML tests
+- **Vitest configuration**: Modern testing framework setup
-**โ
Development Workflow:**
+**Development Workflow:**
```bash
npm run style:fix # Auto-fix formatting and linting
@@ -162,28 +128,17 @@ npm run dev # Start development server
npm run build # Build WebAssembly module
```
-### ๐ Phase 5: Tests Setup (Next)
+## ๐ฎ Future Development
-- **Goal**: Implement modern Vitest testing framework
-- **Planned**: Replace HTML-based tests with proper Vitest test suite
-- **Status**: Ready to implement
-
-### ๐ Phase 6: Flutter Web Integration
+### Flutter Web Integration
- **Goal**: `dart:js_interop` integration
- **Planned**: Dart bindings for JavaScript library
-- **Status**: Future
+- **Status**: Future enhancement
## ๐งช Testing Philosophy
-### Previous Approach (Problematic)
-
-- HTML pages for manual testing
-- Browser-based test runners
-- Manual verification of results
-- **Issues**: Not reliable, not automatable, not CI/CD friendly
-
-### New Approach (Phase 3 Implementation)
+**Modern Automated Testing Approach:**
- **Vitest**: Modern testing framework
- **Automated**: Runs via npm scripts
diff --git a/README.md b/README.md
index 87a6ae3..bed0efd 100644
--- a/README.md
+++ b/README.md
@@ -81,49 +81,20 @@ python3 -m http.server 8000
- โ
Automated test suite passes
- โ
C++ debug output in console
-## ๐๏ธ Implementation Phases
-
-### โ
Phase 1: Basic WebAssembly + JavaScript Integration _(CLEANED UP)_
-
-**Status**: Complete and cleaned up
-**Goal**: ~~Create and test C++ โ WASM โ JavaScript integration~~ (No longer needed)
-
-**What was included (now removed):**
-
-- ~~C++ math functions (`sum`, `multiply`)~~ - Removed as obsolete
-- ~~Emscripten compilation setup~~ - Replaced with equations-parser build
-- ~~JavaScript wrapper library~~ - Replaced with Parsec wrapper
-- ~~Interactive HTML test page~~ - Replaced with Vitest tests
-- ~~Comprehensive documentation~~ - Updated for equations-parser focus
-
-### โ
Phase 2: Equations-Parser WebAssembly Integration _(COMPLETED)_
-
-**Status**: **FULLY IMPLEMENTED** with native type conversion
-**Goal**: Compile the real equations-parser C++ library to WebAssembly and create comprehensive web testing interface
-
-**โ
What's completed:**
-
-- โ
Replaced toy math functions with actual equations-parser library
-- โ
Set up equations-parser as git submodule from `https://github.com/oxeanbits/equations-parser`
-- โ
Compiled comprehensive equation evaluation from `equations-parser` lib to WASM
-- โ
Implemented main function `eval_equation(equation)` for string input processing
-- โ
**NEW: Native Type Conversion System** - Automatic conversion from C++ strings to proper JavaScript types:
- - **Integer types** โ JavaScript `number` (using `parseInt()`)
- - **Float types** โ JavaScript `number` (using `parseFloat()`)
- - **Boolean types** โ JavaScript `boolean` (with Ruby-style string-to-boolean conversion)
- - **String types** โ JavaScript `string` (with error checking)
- - **Special values**: `inf` โ `'Infinity'`, `-inf` โ `'-Infinity'`, `nan` โ `'nan'`
-- โ
Created enhanced HTML + JavaScript testing interface with type information display
-- โ
Full support for all equations-parser features:
- - โ
**Math functions**: sin, cos, tan, ln, log, abs, sqrt, pow, exp, etc.
- - โ
**String functions**: concat, length, toupper, tolower, left, right
- - โ
**Complex functions**: real, imag, conj, arg, norm
- - โ
**Array functions**: sizeof, eye, ones, zeros
- - โ
**Date functions**: current_date, daysdiff, hoursdiff
- - โ
**Advanced operators**: ternary operators, comparison operators
- - โ
**Multiple return types**: Returns native JavaScript types instead of strings
-
-**๐ฏ Key Achievement**: The system now returns direct JavaScript values with automatic type conversion:
+## ๐ฏ Core Features
+
+**Parsec Web** integrates the equations-parser C++ library via WebAssembly, delivering:
+
+- **Native Type Conversion**: Automatic conversion from C++ to JavaScript types (number, string, boolean)
+- **Complete Function Support**: All equations-parser features available
+ - **Math functions**: sin, cos, tan, ln, log, abs, sqrt, pow, exp, etc.
+ - **String functions**: concat, length, toupper, tolower, left, right
+ - **Complex functions**: real, imag, conj, arg, norm
+ - **Array functions**: sizeof, eye, ones, zeros
+ - **Date functions**: current_date, daysdiff, hoursdiff
+ - **Advanced operators**: ternary operators, comparison operators
+
+**Direct Value Returns:**
```javascript
parsec.eval('2 + 3') // โ 5 (number)
@@ -132,575 +103,77 @@ parsec.eval('5 > 3') // โ true (boolean)
parsec.eval('concat("a","b")') // โ "ab" (string)
```
-### ๐ Phase 3: Automated Tests for the Equations-Parser WebAssembly Library
-
-**Status**: Complete - **Modern Testing Framework Implementation**
-**Goal**: Comprehensive testing of equation evaluation through reliable test framework (Vitest)
-
-**What's implemented:**
-
-- **Vitest Test Framework**: Professional, reliable testing environment
-- **Complete Test Coverage**: All equations-parser functionality tested through `Parsec.eval(equation)`
-- **Cross-Platform Testing**: Tests designed to work across all target platforms
+## ๐งช Comprehensive Testing
-**Test Scenarios Covered:**
+**Professional Testing Framework**: Vitest-based testing with complete coverage
+### Test Coverage
- **Unit Tests**: Arithmetic, Trigonometry, Logarithms, String Functions, Date Functions, Complex Numbers, Array Operations
- **Integration Tests**: Complex expressions, Mixed data types, Function combinations
- **Error Handling**: Syntax errors, Runtime errors, Type errors, Edge cases
-- **Performance Benchmarks**: Simple operations, Function calls, Complex expressions
-- **Floating-Point Precision**: Epsilon tolerance testing (1e-10 precision)
-- **Cross-Browser Compatibility**: ES6 module support with WebAssembly
+- **Performance Benchmarks**: Speed tracking with regression detection
+- **Cross-Browser Compatibility**: ES6 modules with WebAssembly support
-**Files Structure:**
-
-- `vitest.config.js` - Vitest configuration for all environments
-- `tests/unit/` - Individual function category tests
-- `tests/integration/` - Complex equation scenarios
-- `tests/errors/` - Error handling validation
-- `tests/performance/` - Benchmark testing
-- Package.json scripts for `npm test`, `npm run test:watch`, `npm run test:coverage`
-
-#### ๐ Test Categories
-
-##### ๐งฎ **Basic Arithmetic Tests**
+### Example Test Cases
+#### Mathematical Operations
```javascript
-// Simple operations
-"2 + 3" โ 5
-"10 - 4" โ 6
-"7 * 8" โ 56
-"15 / 3" โ 5
-"2 ^ 3" โ 8
-"10 % 3" โ 1
-
-// Order of operations
"2 + 3 * 4" โ 14
-"(2 + 3) * 4" โ 20
-"2 + 3 * 4 - 1" โ 13
-"2 ^ 3 ^ 2" โ 512
-```
-
-##### ๐ **Mathematical Functions Tests**
-
-```javascript
-// Trigonometric functions
-"sin(0)" โ 0
-"cos(0)" โ 1
-"tan(pi/4)" โ 1
-"asin(1)" โ ฯ/2
-"acos(0)" โ ฯ/2
-"atan(1)" โ ฯ/4
-
-// Logarithmic functions
-"ln(e)" โ 1
-"log(100)" โ 2
-"log(1000, 10)" โ 3
-"exp(1)" โ e
-
-// Power and root functions
-"sqrt(16)" โ 4
-"pow(2, 3)" โ 8
-"abs(-5)" โ 5
-"round(3.6)" โ 4
+"sin(pi/2)" โ 1
+"sqrt(pow(3,2) + pow(4,2))" โ 5
+"log(exp(2))" โ 2
```
-##### ๐ค **String Functions Tests**
-
+#### String Operations
```javascript
-// String operations
-"concat('Hello', ' ', 'World')" โ "Hello World"
-"length('test')" โ 4
+"concat('Hello', ' World')" โ "Hello World"
"toupper('hello')" โ "HELLO"
-"tolower('WORLD')" โ "world"
-"left('testing', 4)" โ "test"
-"right('testing', 3)" โ "ing"
-```
-
-##### ๐
**Date/Time Functions Tests**
-
-```javascript
-// Date operations
-"current_date()" โ "2024-MM-DD"
-"daysdiff('2024-01-01', '2024-01-10')" โ 9
-"hoursdiff('2024-01-01 12:00', '2024-01-01 15:30')" โ 3.5
-"weekday('2024-01-01')" โ 1 // Monday
+"length('test')" โ 4
```
-##### โ **Conditional/Logical Tests**
-
+#### Conditional Logic
```javascript
-// Ternary operators
"true ? 5 : 3" โ 5
-"false ? 5 : 3" โ 3
-"(2 > 1) ? 'yes' : 'no'" โ "yes"
-
-// Comparison operators
"5 > 3" โ true
-"2 < 1" โ false
-"4 >= 4" โ true
-"3 <= 2" โ false
-"5 == 5" โ true
-"5 != 3" โ true
-
-// Logical operators
-"true && true" โ true
-"true || false" โ true
"!false" โ true
```
-##### ๐ **Complex Expression Tests**
-
-```javascript
-// Nested functions
-"sin(cos(pi/3))" โ sin(0.5) โ ~0.479
-"sqrt(pow(3,2) + pow(4,2))" โ 5
-"log(exp(2))" โ 2
-
-// String and math combinations
-"length(concat('test', '123')) + 5" โ 12
-"toupper('hello') == 'HELLO'" โ true
-```
-
-##### โ ๏ธ **Error Handling Tests**
-
+#### Error Handling
```javascript
-// Division by zero
"5 / 0" โ Error: "Division by zero"
-"1 / (2 - 2)" โ Error: "Division by zero"
-
-// Invalid functions
"invalidfunc(5)" โ Error: "Unknown function: invalidfunc"
-"sin()" โ Error: "Invalid number of arguments for sin"
-
-// Type mismatches
-"'hello' + 5" โ Error: "Type mismatch in addition"
-"sin('not_a_number')" โ Error: "Invalid argument type"
-
-// Syntax errors
"2 + " โ Error: "Unexpected end of expression"
-"((2 + 3)" โ Error: "Mismatched parentheses"
-```
-
-##### โก **Performance Benchmark Tests**
-
-```javascript
-// Speed comparisons (WASM vs JavaScript)
-Simple: "2 + 3" โ Target: < 1ms
-Medium: "sin(cos(tan(0.5)))" โ Target: < 2ms
-Complex: "sqrt(pow(sin(0.5), 2) + pow(cos(0.5), 2)) * log(exp(2.718))" โ Target: < 5ms
-Heavy: "sum(sin(1), cos(2), tan(3), ln(4), sqrt(5), abs(-6), pow(7,2), exp(0.5))" โ Target: < 20ms
-```
-
-#### ๐ ๏ธ **Test Infrastructure**
-
-- **Test Runner**: Custom JavaScript test framework with WebAssembly integration
-- **Assertion Library**: Comprehensive floating-point equality with epsilon tolerance
-- **Browser Testing**: Automated testing across Chrome, Firefox, Safari, Edge
-- **CI Integration**: GitHub Actions pipeline with test result reporting
-- **Coverage Reports**: Function coverage analysis for equations-parser features
-- **Performance Monitoring**: Execution time tracking and regression detection
-
-#### ๐ **Test Files Structure**
-
-```
-tests/
-โโโ unit/ # Individual function tests
-โ โโโ arithmetic.test.js # Basic math operations
-โ โโโ trigonometry.test.js # Sin, cos, tan, etc.
-โ โโโ logarithms.test.js # Log, ln, exp functions
-โ โโโ strings.test.js # String manipulation
-โ โโโ complex.test.js # Complex number operations
-โ โโโ arrays.test.js # Array/matrix functions
-โ โโโ dates.test.js # Date/time functions
-โโโ integration/ # End-to-end workflows
-โ โโโ complex-expressions.test.js # Nested function calls
-โ โโโ mixed-types.test.js # String/number combinations
-โโโ performance/ # Speed benchmarks
-โ โโโ simple-ops.bench.js # Basic arithmetic timing
-โ โโโ function-calls.bench.js # Mathematical function timing
-โ โโโ complex-expr.bench.js # Complex expression timing
-โโโ errors/ # Error handling validation
-โ โโโ syntax-errors.test.js # Invalid syntax cases
-โ โโโ runtime-errors.test.js # Division by zero, etc.
-โ โโโ type-errors.test.js # Type mismatch scenarios
-โโโ browser/ # Cross-browser compatibility
-โ โโโ compatibility.test.js # Browser-specific tests
-โโโ test-runner.js # Main test orchestration
-```
-
-#### ๐ฏ **Success Criteria**
-
-- โ
**100% Function Coverage**: All equations-parser features tested
-- โ
**Cross-Browser Compatible**: Works in Chrome, Firefox, Safari, Edge
-- โ
**Performance Targets Met**: < 5ms for complex expressions
-- โ
**Error Handling Robust**: Graceful failure for all edge cases
-- โ
**Regression Prevention**: Automated CI prevents functionality breaks
-- โ
**Documentation Complete**: Every test case clearly documented
-
-### โ
Phase 4: Library Transformation & Code Quality _(COMPLETED)_
-
-**Status**: **FULLY IMPLEMENTED** - Professional npm package with enterprise-grade code quality
-**Goal**: Transform project into professional, reusable JavaScript library with comprehensive tooling
-
-**โ
What's completed:**
-
-- โ
**Library Rename**: `parsec-equations-lib` โ `parsec-web` (matches repository name)
-- โ
**API Redesign**: Clean `Parsec` class with intuitive naming
-- โ
**Direct Value Returns**: `parsec.eval('2+3')` โ `5` (not `{value: 5, type: 'i'}`)
-- โ
**Multi-Format Package**: CommonJS, ES6 modules, and TypeScript definitions
-- โ
**Cross-Platform Exports**: Works in Node.js, browsers, and bundlers
-- โ
**Comprehensive Testing**: 108 tests across 5 categories with 100% pass rate
-- โ
**Enterprise Linting**: ESLint + Prettier with automated fixing
-- โ
**Git Strategy**: Proper `.gitignore` with submodule exclusion
-- โ
**Backward Compatibility**: Legacy class names still work
-
-**๐ฏ Key Achievements:**
-
-```javascript
-// Modern API (new)
-import { Parsec } from 'parsec-web'
-const parsec = new Parsec()
-await parsec.initialize()
-const result = parsec.eval('sin(pi/2)') // โ 1 (direct value)
-```
-
-**๐ ๏ธ Development Commands:**
-
-- `npm run lint` / `npm run lint:fix` - Code quality checks
-- `npm run format` / `npm run format:check` - Code formatting
-- `npm run style:fix` - Fix both linting and formatting
-- `npm test` - Run comprehensive test suite
-
-### ๐ Phase 5: Flutter Web Integration _(Planned)_
-
-**Goal**: Create a reusable frontend library for equations evaluation that works seamlessly across JavaScript/React and Flutter Web projects
-
-#### ๐ฆ **Library Architecture**
-
-The library will be packaged as:
-
-- **npm package**: For JavaScript/React projects
-- **pub.dev package**: For Flutter Web projects
-- **Unified WASM core**: Single WebAssembly module used by both platforms
-
-#### ๐๏ธ **Implementation Steps**
-
-##### **Step 1: Create Standalone Library Structure**
-
```
-parsec-web/
-โโโ core/ # Core WebAssembly files
-โ โโโ equations_parser.wasm # Compiled WASM binary
-โ โโโ equations_parser.js # Emscripten JS glue code
-โโโ js/ # JavaScript/npm package
-โ โโโ package.json # npm package configuration
-โ โโโ index.js # Main entry point
-โ โโโ equations-evaluator.js # Clean API wrapper
-โ โโโ types.d.ts # TypeScript definitions
-โ โโโ README.md # JavaScript usage docs
-โโโ dart/ # Dart/Flutter package
-โ โโโ pubspec.yaml # pub.dev package configuration
-โ โโโ lib/
-โ โ โโโ equations_evaluator.dart # Main Dart API
-โ โ โโโ src/
-โ โ โ โโโ js_interop.dart # dart:js_interop bindings
-โ โ โ โโโ equations_result.dart # Result data classes
-โ โ โ โโโ equations_types.dart # Type definitions
-โ โ โโโ web/ # Web-specific assets
-โ โ โโโ equations_parser.wasm # WASM binary
-โ โ โโโ equations_parser.js # JS glue code
-โ โโโ README.md # Dart/Flutter usage docs
-โโโ examples/ # Usage examples
-โ โโโ react-demo/ # React integration example
-โ โโโ vanilla-js-demo/ # Plain JavaScript example
-โ โโโ flutter-web-demo/ # Flutter Web example
-โโโ README.md # Main documentation
-```
-
-##### **Step 2: Extract and Refactor JavaScript API**
-
-- **Clean up current wrapper**: Simplify the `Parsec` class
-- **Remove HTML dependencies**: Create pure JavaScript library without DOM dependencies
-- **Add TypeScript support**: Generate type definitions for better developer experience
-- **Implement error handling**: Robust error boundaries and meaningful error messages
-- **Add result caching**: Optional caching for repeated calculations
-- **Bundle optimization**: Create minified and non-minified versions
-
-**JavaScript API Example:**
-
-```javascript
-import { Parsec } from 'parsec-web'
-
-const parsec = new Parsec()
-await evaluator.initialize()
-
-// Basic usage
-const result = evaluator.evaluate('2 + 3 * sin(pi/2)')
-console.log(result.value) // "5"
-console.log(result.type) // "f" (float)
-
-// Batch evaluation
-const results = evaluator.evaluateBatch(['2 + 2', 'sqrt(16)', 'concat("Hello", " World")'])
-```
-
-##### **Step 3: Create Flutter Web Package with dart:js_interop**
-- **Set up dart:js_interop bindings**: Modern Dart-JavaScript interoperability
-- **Create Dart data classes**: Type-safe result objects and error handling
-- **Asset management**: Bundle WASM files with Flutter package
-- **Web-specific service**: Implementation that loads and uses WASM module
-- **Future-based API**: Async/await pattern for Flutter integration
+### Running Tests
-**Dart API Example:**
-
-```dart
-import 'package:parsec_equations_lib/parsec_equations_lib.dart';
-
-final parsec = Parsec();
-await evaluator.initialize();
-
-// Basic usage
-final result = await evaluator.evaluate('2 + 3 * sin(pi/2)');
-print(result.value); // "5"
-print(result.type); // EquationType.float
-
-// Type-safe results
-switch (result.type) {
- case EquationType.integer:
- final intValue = result.asInt();
- case EquationType.float:
- final doubleValue = result.asDouble();
- case EquationType.string:
- final stringValue = result.asString();
- case EquationType.boolean:
- final boolValue = result.asBool();
-}
-```
-
-##### **Step 4: Package Configuration and Publishing**
-
-**NPM Package (package.json):**
-
-```json
-{
- "name": "parsec-web",
- "version": "1.0.0",
- "description": "Fast mathematical expression evaluator powered by WebAssembly",
- "main": "index.js",
- "types": "types.d.ts",
- "files": ["core/", "js/", "types.d.ts"],
- "keywords": ["math", "equations", "wasm", "calculator", "expressions"],
- "engines": { "node": ">=16.0.0" },
- "browser": "js/equations-evaluator.js"
-}
-```
-
-**Pub Package (pubspec.yaml):**
-
-```yaml
-name: parsec_equations_lib
-version: 1.0.0
-description: Fast mathematical expression evaluator for Flutter Web using WebAssembly
-homepage: https://github.com/your-org/parsec-web
-
-environment:
- sdk: '>=3.0.0 <4.0.0'
- flutter: '>=3.10.0'
-
-platforms:
- web:
-
-dependencies:
- flutter:
- sdk: flutter
- js: ^0.6.7
-
-dev_dependencies:
- flutter_test:
- sdk: flutter
-```
-
-##### **Step 5: Cross-Platform Compatibility**
-
-- **Unified WASM module**: Same WebAssembly binary works in both environments
-- **Consistent API design**: Similar method names and behavior patterns
-- **Error code mapping**: Standardized error types across platforms
-- **Performance optimization**: Efficient memory management and module loading
-- **Browser compatibility**: Support for modern browsers (ES6+ for JS, recent Flutter Web)
-
-#### ๐ฏ **Flutter Web Integration Details**
-
-##### **dart:js_interop Implementation**
-
-```dart
-// js_interop.dart
-@JS()
-library equations_js;
-
-import 'dart:js_interop';
-
-@JS('EquationsModule')
-external EquationsModule get equationsModule;
-
-@JS()
-@anonymous
-extension type EquationsModule._(JSObject _) implements JSObject {
- external JSPromise eval_equation(JSString equation);
- external JSNumber test_equations_parser_loaded();
-}
-
-@JS()
-@anonymous
-extension type EquationResult._(JSObject _) implements JSObject {
- external JSString get val;
- external JSString get type;
- external JSString? get error;
-}
-```
-
-##### **Flutter Service Layer**
-
-```dart
-// equations_evaluator.dart
-class Parsec {
- static final Parsec _instance = Parsec._internal();
- factory Parsec() => _instance;
- Parsec._internal();
-
- bool _isInitialized = false;
-
- Future initialize() async {
- if (_isInitialized) return;
-
- // Load WASM module
- await _loadWasmModule();
-
- // Test module
- final testResult = equationsModule.test_equations_parser_loaded();
- if (testResult.toDart != 42) {
- throw EquationsException('Module initialization failed');
- }
-
- _isInitialized = true;
- }
-
- Future evaluate(String equation) async {
- if (!_isInitialized) {
- throw EquationsException('Evaluator not initialized');
- }
-
- try {
- final jsResult = await equationsModule
- .eval_equation(equation.toJS)
- .toDart;
-
- return EquationResult.fromJson(jsResult.toDart);
- } catch (e) {
- throw EquationsException('Evaluation failed: $e');
- }
- }
-}
+```bash
+npm test # Run complete test suite
+npm run test:watch # Development mode with auto-rerun
+npm run test:coverage # Generate coverage report
+npm run test:unit # Unit tests only
+npm run test:integration # Integration tests only
+npm run test:performance # Performance benchmarks
```
-#### โ
**Benefits for Multi-Platform Development**
-
-1. **Code Reuse**: Same mathematical engine across JavaScript and Dart platforms
-2. **Performance Consistency**: Identical WebAssembly performance in both environments
-3. **Maintenance Efficiency**: Single WASM core to update and maintain
-4. **Type Safety**: TypeScript definitions for JS, strong typing in Dart
-5. **Easy Integration**: Simple npm install or pub get to add functionality
-6. **Framework Agnostic**: Works with React, Vue, Angular, Flutter, vanilla JS
-
-#### ๐ **Usage in Target Projects**
+## ๐ผ Professional Code Quality
-##### **React Project Integration**
+**Enterprise-Grade Development Environment**:
-```javascript
-// npm install parsec-web
-import { Parsec } from 'parsec-web'
-
-function CalculatorComponent() {
- const [evaluator, setEvaluator] = useState(null)
-
- useEffect(() => {
- const init = async () => {
- const parsec = new Parsec()
- await eval.initialize()
- setEvaluator(eval)
- }
- init()
- }, [])
-
- const handleCalculate = equation => {
- const result = evaluator.evaluate(equation)
- setResult(result)
- }
-}
-```
+- **Multi-Format Package**: CommonJS, ES6 modules, TypeScript definitions
+- **Cross-Platform Exports**: Works in Node.js, browsers, and bundlers
+- **ESLint + Prettier**: Automated code formatting and quality checking
+- **Git Strategy**: Proper `.gitignore` with submodule exclusion
-##### **Flutter Web Project Integration**
+**Code Quality Commands:**
-```dart
-# pubspec.yaml: parsec_equations_lib: ^1.0.0
-
-class CalculatorPage extends StatefulWidget {
- @override
- State createState() => _CalculatorPageState();
-}
-
-class _CalculatorPageState extends State {
- final parsec = Parsec();
-
- @override
- void initState() {
- super.initState();
- evaluator.initialize();
- }
-
- void _handleCalculate(String equation) async {
- final result = await evaluator.evaluate(equation);
- setState(() {
- _result = result;
- });
- }
-}
+```bash
+npm run lint # Check code quality
+npm run lint:fix # Auto-fix linting issues
+npm run format # Format code with Prettier
+npm run style:fix # Fix both linting and formatting
```
-#### ๐ **Success Criteria**
-
-- โ
**NPM Package**: Successfully published and installable via `npm install`
-- โ
**Pub Package**: Successfully published and installable via `pub get`
-- โ
**React Integration**: Works seamlessly in Create React App projects
-- โ
**Flutter Web Integration**: Works in Flutter Web projects without issues
-- โ
**Performance**: < 5ms evaluation time for complex expressions
-- โ
**Bundle Size**: < 2MB total package size including WASM
-- โ
**Type Safety**: Full TypeScript and Dart type definitions
-- โ
**Documentation**: Complete API documentation and usage examples
-
-### ๐ Phase 5: Cross-Platform Mobile Integration _(Optional)_
-
-**Goal**: Integrate equations-parser WASM with a small Flutter Web using `dart:js_interop`
-
-**What's planned:**
-
-- Clean Flutter project structure
-- `dart:js_interop` bindings for equations-parser functions
-- Abstract service interface for cross-platform compatibility
-- Web-specific service implementation
-- Flutter UI for equation input and result display
-
-### ๐ Phase 6: Cross-Platform Mobile Integration _(Optional)_
-
-**Goal**: Extend Flutter integration to mobile/desktop platforms
-
-**What's planned:**
-
-- Factory pattern for service creation
-- Platform detection (web vs mobile/desktop)
-- Platform Channel integration for mobile/desktop
-- Unified Flutter interface across all platforms
-
## ๐ Quick Start
### Installation
@@ -915,12 +388,6 @@ parsec-web/
The project uses **Vitest** as the primary testing framework for comprehensive equation evaluation testing:
-### **Phase 3 Testing Implementation**
-
-- **Framework**: Vitest - modern, fast, reliable testing framework
-- **Target**: All equation evaluation through `Parsec.eval(equation)` method
-- **Coverage**: 100% equations-parser functionality
-
### **Test Categories**
1. **Unit Tests**: Individual function categories (arithmetic, trigonometry, logarithms, strings, dates, complex, arrays)
@@ -998,7 +465,7 @@ const boolean = parsec.eval('5 > 3')
#### `parsec.evaluateBatch(equations)`
-**New in Step 2**: Evaluate multiple expressions in one call.
+Evaluate multiple expressions in one call.
```javascript
const results = parsec.evaluateBatch(['2+2', 'sqrt(16)', 'sin(pi/2)'])
@@ -1007,7 +474,7 @@ const results = parsec.evaluateBatch(['2+2', 'sqrt(16)', 'sin(pi/2)'])
#### `parsec.evaluateWithTimeout(equation, timeoutMs)`
-**New in Step 2**: Evaluate with timeout protection.
+Evaluate with timeout protection.
```javascript
const result = await parsec.evaluateWithTimeout('complex_expression', 5000)
@@ -1018,7 +485,7 @@ const result = await parsec.evaluateWithTimeout('complex_expression', 5000)
#### `parsec.getInfo()`
-**New in Step 2**: Get comprehensive library metadata.
+Get comprehensive library metadata.
```javascript
const info = parsec.getInfo()
@@ -1053,9 +520,9 @@ import { Parsec, EquationResult, BatchEvaluationResult } from 'parsec-web'
## ๐ Documentation
-- ~~**Phase 1 Guide**: Complete setup and testing instructions~~ (Obsolete - see CLAUDE.md instead)
- **Code Comments**: Detailed explanations in all source files
- **Build Scripts**: Self-documenting with extensive comments
+- **Development Guide**: See CLAUDE.md for detailed development instructions
## ๐ง Technical Stack
@@ -1068,23 +535,38 @@ import { Parsec, EquationResult, BatchEvaluationResult } from 'parsec-web'
- **Vitest**: Modern testing framework for comprehensive test coverage
- **Prettier + ESLint**: Code formatting and quality assurance
- **Multi-format exports**: ES6, CommonJS, UMD compatibility
-- **Flutter 3.x**: `dart:js_interop` for web integration (Phase 5+)
-
-## ๐ Progress Overview
-
-1. โ
**Phase 1 Complete and Cleaned Up**: ~~Basic WebAssembly + JavaScript integration~~ (obsolete code removed)
-2. โ
**Phase 2 Complete**: Equations-parser WebAssembly integration implemented
- - Real equations-parser C++ library integrated
- - Comprehensive equation evaluation functionality
- - All mathematical, string, complex, array, and date functions working
-3. ๐ **Phase 3 Next**: Modern automated testing framework implemented
- - **Vitest framework** replacing HTML-based manual testing
- - **100% function coverage** through `Parsec.eval(equation)` method
- - **16 comprehensive test suites** covering all equation types
- - **CI/CD ready** with automated testing and coverage reporting
-4. ๐ **Phase 4 Future**: Library generalization for cross-platform reuse
- - Make library truly reusable across JavaScript environments
- - npm package structure for easy distribution
- - Support multiple import methods (ES6, CommonJS, UMD)
-5. ๐ **Phase 5 Future**: Flutter Web integration with equations-parser WASM
-6. ๐ **Phase 6 Future**: Cross-platform mobile/desktop integration (optional)
+- **Flutter 3.x**: `dart:js_interop` for web integration (future enhancement)
+
+## ๐ฎ Future Development
+
+### Flutter Web Integration
+
+**Goal**: Create Flutter Web bindings using `dart:js_interop`
+
+**Planned Features**:
+- Dart type-safe API wrapper
+- Asset bundling for Flutter projects
+- Future-based async/await patterns
+- Cross-platform compatibility
+
+**Usage Preview**:
+
+```dart
+import 'package:parsec_equations_lib/parsec_equations_lib.dart';
+
+final parsec = Parsec();
+await parsec.initialize();
+
+final result = await parsec.evaluate('2 + 3 * sin(pi/2)');
+print(result.value); // 5
+```
+
+### Cross-Platform Mobile Integration
+
+**Optional Extension**: Mobile/desktop platform support through Flutter
+
+**Planned Features**:
+- Platform detection (web vs mobile/desktop)
+- Platform Channel integration for mobile/desktop
+- Unified Flutter interface across all platforms
+- Factory pattern for service creation
From 977af9453682d5a25ea1291f2196ba91a4929625 Mon Sep 17 00:00:00 2001
From: Victor Costa
Date: Tue, 2 Sep 2025 00:17:46 -0300
Subject: [PATCH 25/28] Compact README
---
README.md | 71 ++++++++++++++++++++++++++++---------------------------
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/README.md b/README.md
index 36a97f5..5b4ef59 100644
--- a/README.md
+++ b/README.md
@@ -58,15 +58,34 @@ graph LR
## ๐ Quick Start
### Prerequisites
+
- Emscripten SDK installed and configured
- Modern web browser with ES6 module support
- Local web server (Python, Node.js, or similar)
+#### Prerequisites for Building
+
+1. **Modern web browser with ES6 module support.**
+2. **Local web server.** (Python, Node.js, or similar)
+3. **The project requires Emscripten to compile C++ to WebAssembly.** You can install it via:
+ 3.1 **System package manager**: `apt-get install emscripten` (Linux)
+ 3.2 **Official download**: https://emscripten.org/docs/getting_started/downloads.html
+ 3.3 **emsdk**: Manual setup with the Emscripten SDK
+
+The build script will automatically detect your Emscripten installation and compile the equations-parser C++ library to WebAssembly.
+
+### Expected Results
+- โ
"WebAssembly module ready!" status message
+- โ
Interactive math function testing
+- โ
Automated test suite passes
+- โ
C++ debug output in console
+
### Build and Test
+
```bash
# 1. Build the WebAssembly module
-chmod +x build-equations-parser.sh
-./build-equations-parser.sh
+chmod +x build.sh
+./build.sh
# 2. Start local server
python3 -m http.server 8000
@@ -75,11 +94,21 @@ python3 -m http.server 8000
# Navigate to: http://localhost:8000/html/equations-parser-test.html
```
-### Expected Results
-- โ
"WebAssembly module ready!" status message
-- โ
Interactive math function testing
-- โ
Automated test suite passes
-- โ
C++ debug output in console
+### Installation
+
+```bash
+# Install the library (when published to npm)
+npm install parsec-web
+
+# Or clone and install for development
+git clone
+cd parsec-web
+npm install
+
+# Build WebAssembly module (requires emsdk)
+# Uses system Emscripten installation or emsdk
+./build.sh
+```
## ๐ฏ Core Features
@@ -174,34 +203,6 @@ npm run format # Format code with Prettier
npm run style:fix # Fix both linting and formatting
```
-## ๐ Quick Start
-
-### Installation
-
-```bash
-# Install the library (when published to npm)
-npm install parsec-web
-
-# Or clone and install for development
-git clone
-cd parsec-web
-npm install
-
-# Build WebAssembly module (requires emsdk)
-# Uses system Emscripten installation or emsdk
-./build.sh
-```
-
-#### Prerequisites for Building
-
-The project requires Emscripten to compile C++ to WebAssembly. You can install it via:
-
-1. **System package manager**: `apt-get install emscripten` (Linux)
-2. **Official download**: https://emscripten.org/docs/getting_started/downloads.html
-3. **emsdk**: Manual setup with the Emscripten SDK
-
-The build script will automatically detect your Emscripten installation and compile the equations-parser C++ library to WebAssembly.
-
### Basic Usage
#### **ES6 Modules (Recommended)**
From a5112bfd9a8d9d5394d50f3fce22b7b3b14de924 Mon Sep 17 00:00:00 2001
From: Victor Costa
Date: Tue, 2 Sep 2025 12:55:54 -0300
Subject: [PATCH 26/28] Remove invalid comments
---
html/equations-parser-test.html | 1 -
tests/api.test.js | 10 +---------
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/html/equations-parser-test.html b/html/equations-parser-test.html
index dff4f79..4e7641e 100644
--- a/html/equations-parser-test.html
+++ b/html/equations-parser-test.html
@@ -520,7 +520,6 @@ ๐ Console Output
}
function displayEvaluationResult(result, resultDiv, equation) {
- // With the new API, result is the direct value, not an object with success property
const valueType = typeof result;
const convertedNote = valueType !== 'string' ? ` (converted to ${valueType})` : '';
diff --git a/tests/api.test.js b/tests/api.test.js
index eb87712..20633b9 100644
--- a/tests/api.test.js
+++ b/tests/api.test.js
@@ -82,16 +82,13 @@ describe('API Methods', () => {
expect(results).toHaveLength(3)
- // First should succeed
expect(results[0].success).toBe(true)
expect(results[0].value).toBe(5)
- // Second should fail
expect(results[1].success).toBe(false)
expect(results[1]).toHaveProperty('error')
expect(typeof results[1].error).toBe('string')
- // Third should succeed
expect(results[2].success).toBe(true)
expect(results[2].value).toBe(3)
})
@@ -189,12 +186,10 @@ describe('API Methods', () => {
expect(functions).toHaveProperty('conditional')
expect(functions).toHaveProperty('constants')
- // Each category should be an array
Object.values(functions).forEach(category => {
expect(Array.isArray(category)).toBe(true)
})
- // Should have some basic functions
expect(functions.arithmetic).toContain('+ (addition)')
expect(functions.trigonometric).toContain('sin(x) - sine function')
expect(functions.constants).toContain('pi - ฯ (3.14159...)')
@@ -216,10 +211,8 @@ describe('API Methods', () => {
expect(Array.isArray(testResults.tests)).toBe(true)
expect(Array.isArray(testResults.errors)).toBe(true)
- // Should have run some tests
expect(testResults.passed + testResults.failed).toBeGreaterThan(0)
- // Each test should have the right structure
if (testResults.tests.length > 0) {
const test = testResults.tests[0]
expect(test).toHaveProperty('equation')
@@ -245,8 +238,7 @@ describe('API Methods', () => {
parsec.eval('undefined_function()')
expect(false).toBe(true) // Should not reach here
} catch (error) {
- // Error might be a string or number, not necessarily an Error object
- const errorMessage = error.message || error.toString() || String(error)
+ const errorMessage = error.message || error.toString()
expect(typeof errorMessage).toBe('string')
expect(errorMessage.length).toBeGreaterThan(0)
}
From 2487524eb9f5c23b8f426581140b20c817450ba5 Mon Sep 17 00:00:00 2001
From: Victor Costa
Date: Tue, 2 Sep 2025 13:07:58 -0300
Subject: [PATCH 27/28] Configure github actions to run the tests
---
.github/workflows/tests.yml | 48 +++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 .github/workflows/tests.yml
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..57191b2
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,48 @@
+name: CI - Tests
+
+on:
+ push:
+ branches: [ main, master, develop, feature/** ]
+ pull_request:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ test:
+ name: Node ${{ matrix.node }} on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest]
+ node: [18.x, 20.x]
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js ${{ matrix.node }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node }}
+ cache: npm
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Run tests
+ run: npm test -- --run
+
+ # Optional: upload coverage if your `npm test` generates it
+ # - name: Upload coverage report
+ # if: always()
+ # uses: actions/upload-artifact@v4
+ # with:
+ # name: coverage-${{ matrix.os }}-node${{ matrix.node }}
+ # path: coverage
+
From 7a639eb7fe4cb02e8eac51c12225f0e79ec4f573 Mon Sep 17 00:00:00 2001
From: Victor Costa
Date: Tue, 2 Sep 2025 13:19:40 -0300
Subject: [PATCH 28/28] Run github actions in all branches
---
.github/workflows/tests.yml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 57191b2..14dd003 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -2,8 +2,12 @@ name: CI - Tests
on:
push:
- branches: [ main, master, develop, feature/** ]
+ branches:
+ - '**'
pull_request:
+ branches:
+ - '**'
+ workflow_dispatch:
permissions:
contents: read
@@ -45,4 +49,3 @@ jobs:
# with:
# name: coverage-${{ matrix.os }}-node${{ matrix.node }}
# path: coverage
-