Hacker News new | past | comments | ask | show | jobs | submit login
Testing JavaScript without a (third-party) framework (alexwlchan.net)
3 points by alexwlchan on Feb 21, 2023 | hide | past | favorite | 2 comments



This is a follow-up to Writing JavaScript without a build system (https://jvns.ca/blog/2023/02/16/writing-javascript-without-a...)

Discussed here: https://news.ycombinator.com/item?id=34825676


> My secret trick: use the browser

> Whenever you run tests, you need to run code – and browsers are very good at running JavaScript!

Such a novel insight. Much wow.

Don't let the NPM/NodeJS camp find out—they're so invested in their tooling that if you told them that the browser turns out to already be as good as or better than their preferred approach for the two things that they live and die by—downloading JS from the Internet and running it—then they might actually do that: die (from maxed out Surprised Pikachu shock levels, presumably). It turns out the browser is a lot better at stability across versions and sandboxing (i.e. not granting an arbitrary tool total access to your local workstation...), too.

Related/previously:

> > avoid Node.js based applications altogether.

> I ran into this recently. Firefox has a "packager" for putting together add-ons. It uses "node.js". All it really does is apply "zip" to some files. I tried to install the "packager" on Ubuntu 18.04 LTS. It had several hundred dependencies, and wouldn't run because of some version dependency in node.js for something totally irrelevant to the task at hand. Mozilla support suggested upgrading the operating system on the development machine.

<https://news.ycombinator.com/item?id=24495646>

Moar: How to displace JS <https://www.colbyrussell.com/2019/03/06/how-to-displace-java...>

(Spoiler alert: it's by upgrading from JS to... JS: <https://kosmos.social/@colby/107383819674336646>).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: