Skip to content

Commit

Permalink
test: mix tests refactoring (#9516)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Aug 8, 2022
1 parent 2e309d6 commit 4e9bdd4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 1 addition & 4 deletions playground/ssr-deps/read-file-content/index.js
@@ -1,9 +1,6 @@
const path = require('node:path')

module.exports = async function readFileContent(filePath) {
const fs =
process.versions.node.split('.')[0] >= '14'
? require('node:fs/promises')
: require('node:fs').promises
const fs = require('node:fs/promises')
return await fs.readFile(path.resolve(filePath), 'utf-8')
}
3 changes: 2 additions & 1 deletion playground/ssr-webworker/package.json
Expand Up @@ -4,13 +4,14 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "DEV=1 node worker",
"dev": "cross-env DEV=1 node worker",
"build:worker": "vite build --ssr src/entry-worker.jsx --outDir dist/worker"
},
"dependencies": {
"react": "^18.2.0"
},
"devDependencies": {
"cross-env": "^7.0.3",
"miniflare": "^1.4.1",
"resolve-linked": "workspace:*"
}
Expand Down
4 changes: 3 additions & 1 deletion playground/ssr-webworker/src/entry-worker.jsx
@@ -1,8 +1,9 @@
import { msg as linkedMsg } from 'resolve-linked'
import React from 'react'

let loaded = false
import('./dynamic').then(({ foo }) => {
console.log(foo)
loaded = !!foo
})

addEventListener('fetch', function (event) {
Expand All @@ -12,6 +13,7 @@ addEventListener('fetch', function (event) {
<h1>hello from webworker</h1>
<p class="linked">${linkedMsg}</p>
<p class="external">${typeof React}</p>
<p>dynamic: ${loaded}</p>
`,
{
headers: {
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4e9bdd4

Please sign in to comment.