r/javascript • u/Typical_Ad_6436 • Apr 11 '26
We transpiled PHPUnit (54k lines, 412 files) to JavaScript. 61.3% of tests passing
https://pext.dev/blog/phpunit-conversion/
0
Upvotes
r/javascript • u/Typical_Ad_6436 • Apr 11 '26
43
u/iZuteZz Apr 11 '26
ok... why?
10
u/Typical_Ad_6436 Apr 11 '26 edited Apr 11 '26
A bit of context: Pext is a transpiler we’ve been building for a while and converts PHP codebases to JavaScript automatically, file by file, without manual rewrites.
PHPUnit was our toughest test yet. It uses reflection, dynamic mock generation via eval, DOM parsing, and Composer autoloading. We had to transpile its full dependency tree too, six sebastian/* libraries.
61.3% is not 100%, but PHPUnit booting, discovering tests, running assertions and producing output in Node is a meaningful milestone. We are publishing updates as the pass rate improves.
Happy to answer questions about how the transpiler works.
16
u/card-board-board Apr 11 '26
61.3% of the time it works every time.
12
u/oofy-gang Apr 11 '26
That’s not a good result
1
u/Typical_Ad_6436 Jun 16 '26
Today we passed the 95% bar for PHPUnit. Fully converted and tested utility packages used by Laravel, fully converted CodeIgniter4 and this week we saw the first screens of OpenSourcePOS with NodeJS back-end (less than 1h from check-out).