In this blog post, we will look into using bun to install a new Playwright framework.
Create the Playwright Framework
Once I installed bun on my Windows PC and was up and running I created a new folder, "bun-create-playwright".
I opened up that folder in VS Code, along with a new PowerShell terminal. In that terminal I entered:
- bun create playwright
This activated the interactive Playwright installer that Playwright comes with.
- I selected I wanted it to create for me a TypeScript project, placing the tests in the default folder, tests, but I decided not to add a GitHub Actions workflow. I wanted to experiment with using GitLab.
- I chose it to set up and install all the browsers for me... which it did... using NPX, part of Node.
Wait a second, when it comes to our Playwright framework, doesn't bun replace node?
No. Bun might be a JavaScript runtime, a package manager, and a bundler shipped as a single software tool, but in our case we are simply using it as a package manager in our Playwright framework.
Bun works alongside Node.js in the Playwright project. We still use Playwright's test runner, a Node.js program. Bun handles installations and run tasks.