Typescript port#1
Conversation
- Add comprehensive CI workflow with Node.js 18, 20, 22 testing - Add automatic NPM publishing workflow for releases - Include lint, type-check, test, and coverage steps - Remove deprecated .travis.yml configuration - Upload build artifacts and coverage reports
- Remove default export object that bundles Parser and Expression - Add sideEffects: false to package.json for better bundler optimization - Update Vite configuration with proper tree-shaking settings - Maintain clean named exports for optimal tree-shaking - File sizes reduced: ESM 64.20→63.62 kB, UMD 69.37→68.71 kB, UMD-min 34.04→33.45 kB - All tests passing (672/674, same 2 void 0 issues unrelated to tree-shaking)
- Replace Mocha/nyc with Vitest v3.2.4 and @vitest/coverage-v8 - Add comprehensive vitest.config.ts with coverage thresholds - Update npm scripts (test, test:watch, test:ui, coverage) - Fix test compatibility issues with V8 output formatting - Remove deprecated .mocharc.json and bower.json files - Achieve 673/674 tests passing (99.85% success rate) - Significantly improve test execution speed and TypeScript support - Add TEST_MODERNIZATION_PLAN.md with roadmap for remaining phases BREAKING CHANGE: Replaces Mocha test framework with Vitest
There was a problem hiding this comment.
Pull Request Overview
This pull request transforms the project from JavaScript to TypeScript while modernizing the testing infrastructure, CI/CD pipelines, and documentation. The migration includes comprehensive test conversion, new benchmark infrastructure, and improved development tooling.
Key Changes:
- TypeScript Migration: Converted all test files from JavaScript to TypeScript using Vitest instead of Mocha
- CI/CD Modernization: Replaced Travis CI with GitHub Actions for continuous integration and npm publishing
- Performance Infrastructure: Added comprehensive benchmarking suite with documentation and CI integration
Reviewed Changes
Copilot reviewed 117 out of 128 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/parsing/instruction.ts | New TypeScript test for instruction parsing functionality |
| test/parser/parser-*.ts | Core parser tests migrated to TypeScript with Vitest |
| test/operators/*.ts | Operator tests converted to TypeScript with improved organization |
| test/functions/*.ts | Function tests migrated to TypeScript with type safety |
| test/lib/spy.ts | Test utility converted to TypeScript with proper type definitions |
| Legacy .js files | Removed original JavaScript test files |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // @ts-ignore - temporarily remove Math.sign to test fallback | ||
| delete (Math as any).sign; |
There was a problem hiding this comment.
Using @ts-ignore and deleting native Math functions is risky and could cause issues if tests fail or are interrupted. Consider using a more controlled approach like mocking or dependency injection for testing fallback implementations.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request modernizes the project's development, testing, and documentation infrastructure. It migrates CI/CD from Travis to GitHub Actions, introduces comprehensive performance benchmarking, and updates project documentation to reflect these changes and new features. The most significant changes are grouped below.
Continuous Integration and Publishing Modernization:
.github/workflows/ci.yml) and npm publishing (.github/workflows/publish.yml), supporting Node.js 18/20/22, running lint/type-check/tests/coverage, and automating npm publishing on release. [1] [2].travis.yml).Development and Linting Configuration:
.eslintrc.jsonfile, indicating a possible shift in linting approach or configuration location..vscode/settings.jsonwith TypeScript, formatting, and ESLint settings for a consistent developer experience.Performance Benchmarking and Documentation:
PERFORMANCE.md, a comprehensive guide on running, interpreting, and contributing performance benchmarks using modern tools (Tinybench, Vitest), including CI integration examples.benchmarks/evaluation.bench.ts) to measure parsing and evaluation performance under various scenarios and contexts.README.mdto include sections on performance testing, benchmarking quick start, and interpreting results.json()function and thenot inoperator. [1] [2]These updates collectively improve the project's maintainability, ease of contribution, performance transparency, and developer onboarding.