-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: run tests on cloudflare workers (#1546)
* test: run tests con cloudflare workers * test: run tests con cloudflare workers * test: run tests on cloudflare workers * test: run tests on cloudflare workers * test: run tests on cloudflare workers * Revert "test: run tests on cloudflare workers" This reverts commit 5b0453c. * test: run tests on cloudflare workers * test: run tests on cloudflare workers
- Loading branch information
1 parent
b7c684f
commit bdf9e19
Showing
43 changed files
with
1,540 additions
and
1,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"@httpx/plain-object": patch | ||
"@httpx/dsn-parser": patch | ||
"@httpx/exception": patch | ||
"@httpx/memo-intl": patch | ||
"@httpx/json-api": patch | ||
"@httpx/assert": patch | ||
"@httpx/treeu": patch | ||
--- | ||
|
||
Ensure CI tests on Clouflare workers and latest chrome (playwright) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Specific eslint rules for this workspace, learn how to compose | ||
* @link https://github.com/belgattitude/perso/tree/main/packages/eslint-config-bases | ||
*/ | ||
|
||
// Workaround for https://github.com/eslint/eslint/issues/3458 | ||
require('@belgattitude/eslint-config-bases/patch/modern-module-resolution'); | ||
|
||
const { | ||
getDefaultIgnorePatterns, | ||
} = require('@belgattitude/eslint-config-bases/helpers'); | ||
|
||
module.exports = { | ||
extends: [ | ||
'@belgattitude/eslint-config-bases/typescript', | ||
'@belgattitude/eslint-config-bases/simple-import-sort', | ||
'@belgattitude/eslint-config-bases/import-x', | ||
'@belgattitude/eslint-config-bases/sonar', | ||
'@belgattitude/eslint-config-bases/regexp', | ||
'@belgattitude/eslint-config-bases/jest', | ||
'@belgattitude/eslint-config-bases/performance', | ||
|
||
// Apply prettier and disable incompatible rules | ||
'@belgattitude/eslint-config-bases/prettier-plugin', | ||
], | ||
ignorePatterns: [ | ||
...getDefaultIgnorePatterns(), | ||
'**/build', | ||
'**/.cache', | ||
'**/dist', | ||
'**/_release', | ||
'.cache', | ||
'**/docs', | ||
], | ||
overrides: [], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: __dirname, | ||
}, | ||
root: true, | ||
rules: { | ||
'import-x/no-extraneous-dependencies': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "@httpx/devtools-vitest", | ||
"description": "Shareable dev setups for vitest", | ||
"version": "0.0.1", | ||
"private": true, | ||
"license": "MIT", | ||
"author": { | ||
"name": "Vanvelthem Sébastien", | ||
"url": "https://github.com/belgattitude" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/belgattitude/httpx.git", | ||
"directory": "tools/vitest" | ||
}, | ||
"sideEffects": false, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
"./wrangler.toml": "./wrangler.toml" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf ./dist ./build ./coverage ./_release", | ||
"fix-staged": "lint-staged --allow-empty", | ||
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.mjs,.cjs,.mts,.cts", | ||
"typecheck": "tsc --project tsconfig.json --noEmit", | ||
"install-playwright": "playwright install chromium" | ||
}, | ||
"peerDependencies": { | ||
"vitest": "2.1.2" | ||
}, | ||
"dependencies": { | ||
"@belgattitude/eslint-config-bases": "6.0.0-canary.19", | ||
"@cloudflare/vitest-pool-workers": "0.5.18", | ||
"@codspeed/vitest-plugin": "3.1.1", | ||
"@edge-runtime/vm": "4.0.3", | ||
"@vitest/browser": "2.1.2", | ||
"@vitest/coverage-istanbul": "2.1.2", | ||
"@vitest/ui": "2.1.2", | ||
"esbuild": "0.24.0", | ||
"playwright": "1.48.0", | ||
"typescript": "5.6.3", | ||
"vite": "5.4.8", | ||
"vite-tsconfig-paths": "5.0.1" | ||
}, | ||
"devDependencies": { | ||
"vitest": "2.1.2" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
|
||
const testFiles = ['./src/**/*.test.{js,ts}', './test/**/*.test.{js,ts}']; | ||
|
||
export default defineWorkersConfig({ | ||
esbuild: { | ||
target: ['node18'], | ||
}, | ||
plugins: [tsconfigPaths()], | ||
cacheDir: '../../.cache/vite/httpx-dsn-parser-cloudflare', | ||
test: { | ||
// @link https://vitest.dev/config/#clearmocks | ||
clearMocks: true, | ||
poolOptions: { | ||
workers: { | ||
wrangler: { configPath: '../../tools/cloudflare/wrangler.toml' }, | ||
}, | ||
}, | ||
exclude: [ | ||
'**/node_modules/**', | ||
'dist/**', | ||
'**/coverage/**', | ||
'**/.{idea,git,cache,output,temp}/**', | ||
], | ||
globals: true, | ||
include: testFiles, | ||
// To mimic Jest behaviour regarding mocks. | ||
mockReset: true, | ||
passWithNoTests: true, | ||
restoreMocks: true, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import codspeedPlugin from '@codspeed/vitest-plugin'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
const testFiles = ['./src/**/*.test.{js,ts}', './test/**/*.test.{js,ts}']; | ||
|
||
const isCodeSpeedEnabled = process.env?.CODSPEED === '1'; | ||
const cspeed = isCodeSpeedEnabled ? codspeedPlugin() : undefined; | ||
|
||
export default defineConfig({ | ||
esbuild: { | ||
target: ['node18'], | ||
}, | ||
plugins: [tsconfigPaths(), ...[cspeed].filter(Boolean)], | ||
cacheDir: '../../.cache/vite/httpx-plain-object', | ||
test: { | ||
browser: { | ||
provider: 'playwright', | ||
name: 'chromium', | ||
}, | ||
// @link https://vitest.dev/config/#clearmocks | ||
clearMocks: true, | ||
coverage: { | ||
all: true, | ||
include: ['src/**/*.{js,jsx,ts,tsx}'], | ||
provider: 'istanbul', | ||
reporter: ['text', 'json', 'clover'], | ||
}, | ||
typecheck: { | ||
enabled: false, | ||
}, | ||
benchmark: { | ||
reporters: ['default'], | ||
outputJson: './bench/output/benchmark-results.json', | ||
}, | ||
pool: 'forks', | ||
poolOptions: { | ||
vmThreads: { | ||
// useAtomics: true, | ||
}, | ||
threads: { | ||
// minThreads: 1, | ||
// maxThreads: 16, | ||
useAtomics: true, // perf+ | ||
isolate: false, // perf+++ | ||
}, | ||
}, | ||
environment: 'node', | ||
exclude: [ | ||
'**/node_modules/**', | ||
'dist/**', | ||
'**/coverage/**', | ||
'**/.{idea,git,cache,output,temp}/**', | ||
], | ||
globals: true, | ||
include: testFiles, | ||
// To mimic Jest behaviour regarding mocks. | ||
mockReset: true, | ||
passWithNoTests: false, | ||
restoreMocks: true, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
"verbatimModuleSyntax": true, | ||
"strict": true, | ||
"paths": {}, | ||
"types": ["vitest/globals"] | ||
}, | ||
"exclude": ["**/node_modules", "**/.*/*", "dist", "coverage"], | ||
"include": [ | ||
".eslintrc.*", | ||
"**/*.ts", | ||
"**/*.tsx", | ||
"**/*.js", | ||
"**/*.jsx", | ||
"**/*.cjs", | ||
"**/*.mjs", | ||
"**/*.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name = "basic-unit-integration-self" | ||
compatibility_date = "2024-01-01" | ||
compatibility_flags = ["nodejs_compat"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.