Skip to content

Comments

feat(bdd): add watcher tool to improve developer experience#684

Merged
dadiorchen merged 4 commits intoGreenstand:mainfrom
SABO007:Sashank
Feb 17, 2026
Merged

feat(bdd): add watcher tool to improve developer experience#684
dadiorchen merged 4 commits intoGreenstand:mainfrom
SABO007:Sashank

Conversation

@SABO007
Copy link
Contributor

@SABO007 SABO007 commented Jan 26, 2026

Description

Developed a watcher tool to improve the development experience in BDD testing. The watcher automatically re-runs tests when files change, with proper process management to handle browser.debug() sessions.

Fixes: #610


Changes Made

  • Changes in apps folder

    • Bdd
      1. Created scripts/watch.ts - Enhanced test watcher with interactive commands, smart spec detection, test statistics, tag filtering, and proper process tree killing
      2. Updated package.json - Added dependencies (chokidar, tree-kill, tsx) and new watch scripts
      3. Created README.md - Comprehensive documentation for the BDD testing package and watcher tool
  • Changes in packages folder

    • queue
      1. Updated pgClient.js - Made database connection optional for development (doesn't crash if DATABASE_URL is not set)
  • Changes in root
    1. Updated package.json - Added bdd:watch, bdd:watch:debug, bdd:watch:web, bdd:watch:help scripts


Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing
    functionality to not work as expected)
  • 📝 Documentation update (changes)

Screenshots

Test watcher help: yarn bdd:watch -h

Screenshot 2026-01-26 at 4 57 09 PM

Watcher Features

  1. Smart Spec Detection - Auto-runs only the changed feature file
  2. Interactive Commands - Enter, r, f, o, c, p, s, l, h, q
  3. Test Statistics - Track pass/fail history and durations
  4. Re-run Failed - Quickly re-run only failed tests
  5. Tag Filtering - --tags "@smoke"
  6. Process Tree Killing - Properly terminates browser.debug() sessions
  7. Pause/Resume - Temporarily stop watching

How Has This Been Tested?

  • Manual testing of watcher functionality
  • Cypress integration
  • Cypress component tests
  • Jest unit tests

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Future Improvements

  1. Could add --grep flag to filter by scenario name
  2. Could add file change history tracking
  3. Could integrate with notification systems (Slack, desktop notifications)

@dadiorchen
Copy link
Collaborator

@SABO007 sorry for the delay, did you successfully run the command: yarn watch or yarn watch:debug command? When I try to run it on your PR, I get this error, do you know the reason?

Commands: [Enter] run all | [r] run last | [f] run failed | [o] open report | [h] help



🛑 Shutting down...

🧹 Cleaning up...

╔════════════════════════════════════════╗
║           📊 Test Statistics            ║

╔══════════════════════════════════════════════════════════════════════════════╗
║                                   BDD Test Watcher                           ║
╚══════════════════════════════════════════════════════════════════════════════╝

🚀 Starting tests at 1:07:01 PM
────────────────────────────────────────────────────────────────────────────────

📋 npx wdio run ./wdio.debug.conf.ts

2026-02-17T05:07:04.531Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: file:///Users/
deanchen/work/greenstand/treetracker-wallet-app/apps/bdd/wdio.debug.conf.ts: __dirname is not defined in ES
 module scope
2026-02-17T05:07:04.536Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: file:///Users/
deanchen/work/greenstand/treetracker-wallet-app/apps/bdd/wdio.debug.conf.ts: __dirname is not defined in ES
 module scope
ReferenceError: __dirname is not defined in ES module scope
    at <anonymous> (/Users/deanchen/work/greenstand/treetracker-wallet-app/apps/bdd/utils/artifacts.ts:8:44
)
    at ModuleJob.run (node:internal/modules/esm/module_job:343:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:26)
    at async _ConfigParser.addConfigFile (file:///Users/deanchen/work/greenstand/treetracker-wallet-app/nod
e_modules/@wdio/config/build/node/index.js:270:30)
    at async _ConfigParser.initialize (file:///Users/deanchen/work/greenstand/treetracker-wallet-app/node_m
odules/@wdio/config/build/node/index.js:242:7)
    at async tsConfigPathFromConfigFile (file:///Users/deanchen/work/greenstand/treetracker-wallet-app/node
_modules/@wdio/cli/build/index.js:1586:5)
    at async Object.handler (file:///Users/deanchen/work/greenstand/treetracker-wallet-app/node_modules/@wd
io/cli/build/index.js:1569:81)

────────────────────────────────────────────────────────────────────────────────
 ❌ FAILED  Exit code: 1 | 3.2s
────────────────────────────────────────────────────────────────────────────────

Commands: [Enter] run all | [r] run last | [f] run failed | [o] open report | [h] help


@dadiorchen
Copy link
Collaborator

@SABO007 please ignore the comment above, this is my local problem might because of cache files

@dadiorchen dadiorchen merged commit 6bfa48a into Greenstand:main Feb 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Develop a watcher tool to improve the development experience in BDD

2 participants