Skip to content

Commit

Permalink
chore: use sirv-cli within "puppeteer" example
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Dec 1, 2020
1 parent 6169070 commit 43d100b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions examples/puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"start": "sirv src --dev",
"test": "uvu tests -i setup"
},
"devDependencies": {
"puppeteer": "^5.5.0",
"uvu": "^0.5.0",
"vite": "1.0.0-rc.13"
"sirv-cli": "^1.0.6",
"uvu": "^0.5.0"
}
}
6 changes: 3 additions & 3 deletions examples/puppeteer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This example runs [Puppeteer](https://www.npmjs.com/package/puppeteer) programmatically.

In order to invoke and test against source (`/src`) files, this example also uses [`vite`](https://www.npmjs.com/package/vite) to run a local devserver. Puppeteer connects to this devserver to access the `window` globals that `src/math.js` and `src/utils.js` are globally mounted to.
In order to invoke and test against source (`/src`) files, this example also uses [`sirv-cli`](https://www.npmjs.com/package/sirv-cli) to run a local file server. Puppeteer connects to this file server to access the `window` globals that `src/math.js` and `src/utils.js` are globally mounted to.

> **Note:** Window globals are not required in order for `uvu` to work with `puppeteer`! <br>You may, for example, load your Preact, Svelte, Vue, ... etc application inside the devserver & interact with it through Puppeteer APIs!
Expand All @@ -15,8 +15,8 @@ $ npm install
## Testing

```sh
# start devserver
$ npm run dev
# start server
$ npm start

# run tests (2nd terminal)
$ npm test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<title>uvu + Puppeteer</title>
</head>
<body>
<script type="module" src="/src/app.js"></script>
<script type="module" src="/app.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/puppeteer/tests/setup/puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export async function reset(context) {

// Navigate to homepage
export async function homepage(context) {
await context.page.goto('http://localhost:3000');
await context.page.goto('http://localhost:5000');
}

0 comments on commit 43d100b

Please sign in to comment.