Skip to content

Commit

Permalink
test(cloudflare): adapter hangs vitest triggering close timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
skf-funzt committed Nov 15, 2024
1 parent 5391c02 commit d4c257b
Show file tree
Hide file tree
Showing 16 changed files with 577 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/hanging-process.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is a GitHub Actions workflow file that runs the vitest-hanging-process
# tests in various nodejs versions.

name: hanging-process

on:
workflow_dispatch:

jobs:
test:
name: Test on Node.js Version ${{ matrix.node-version }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/vitest-hanging-process

strategy:
matrix:
node-version: [18, 19, 20, 21, 22, 23]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Setup PNPM
uses: pnpm/action-setup@v3

- name: Install dependencies
run: pnpm install

- name: Build package/cloudflare
working-directory: packages/cloudflare
run: pnpm build

- name: Run tests for hanging process
run: pnpm test:hanging-process
3 changes: 3 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pnpm 9.13.2
act 0.2.69
just 1.36.0
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default:
@just --choose

test-workflow:
act --workflows .github/workflows/hanging-process.yml
24 changes: 24 additions & 0 deletions packages/vitest-hanging-process/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# jetbrains setting folder
.idea/
1 change: 1 addition & 0 deletions packages/vitest-hanging-process/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
act 0.2.69
4 changes: 4 additions & 0 deletions packages/vitest-hanging-process/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions packages/vitest-hanging-process/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
47 changes: 47 additions & 0 deletions packages/vitest-hanging-process/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Astro Starter Kit: Minimal

```sh
npm create astro@latest -- --template minimal
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/minimal)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/minimal/devcontainer.json)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
## 🚀 Project Structure

Inside of your Astro project, you'll see the following folders and files:

```text
/
├── public/
├── src/
│ └── pages/
│ └── index.astro
└── package.json
```

Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.

There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.

Any static assets, like images, can be placed in the `public/` directory.

## 🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |

## 👀 Want to learn more?

Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
10 changes: 10 additions & 0 deletions packages/vitest-hanging-process/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-check
import { defineConfig } from 'astro/config';

import cloudflare from '@astrojs/cloudflare';

// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: cloudflare()
});
23 changes: 23 additions & 0 deletions packages/vitest-hanging-process/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Astro Vitest with Cloudflare adapter hanging process",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro",
"test": "vitest run",
"test:hanging-process": "vitest run --reporter=hanging-process"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/cloudflare": "workspace:^11.2.0",
"astro": "^4.16.12",
"typescript": "^5.6.3"
},
"devDependencies": {
"vitest": "^2.1.5"
}
}
9 changes: 9 additions & 0 deletions packages/vitest-hanging-process/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/vitest-hanging-process/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference path="../.astro/types.d.ts" />
16 changes: 16 additions & 0 deletions packages/vitest-hanging-process/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
---

<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>Astro</title>
</head>
<body>
<h1>Astro</h1>
</body>
</html>
3 changes: 3 additions & 0 deletions packages/vitest-hanging-process/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "astro/tsconfigs/strict"
}
8 changes: 8 additions & 0 deletions packages/vitest-hanging-process/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="vitest" />
import { getViteConfig } from 'astro/config';

export default getViteConfig({
test: {
// Vitest configuration options
},
});
Loading

0 comments on commit d4c257b

Please sign in to comment.