Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
services:
nats:
image: nats:latest
ports:
- 4222:4222
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ dist
# Envrc file
.envrc
generated/sdk
playwright-report
test-results
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
# Those are not supported by biomejs yet, refer https://biomejs.dev/internals/language-support/
types_or: [html, css, markdown]
- repo: https://github.com/biomejs/pre-commit
rev: "v0.1.0" # Use the sha / tag you want to point at
rev: "v0.6.1" # Use the sha / tag you want to point at
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome@1.6.3"]
additional_dependencies: ["@biomejs/biome@1.9.4"]
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
},
Expand Down
26 changes: 14 additions & 12 deletions moleculer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,23 @@ const config: BrokerOptions = {

// Enable/disable logging or use custom logger. More info: https://moleculer.services/docs/0.14/logging.html
// Available logger types: "Console", "File", "Pino", "Winston", "Bunyan", "debug", "Log4js", "Datadog"
logger: {
// Note: Change to Console if you want to see the logger output
type: "Pino",
options: {
pino: {
// More info: http://getpino.io/#/docs/api?id=options-object
options: {
timestamp: stdTimeFunctions.isoTime,
logger: [
{
// Note: Change to Console if you want to see the logger output
type: "Pino",
options: {
pino: {
// More info: http://getpino.io/#/docs/api?id=options-object
options: {
timestamp: stdTimeFunctions.isoTime,
},
},
},
},
},
// Default log level for built-in console logger. It can be overwritten in logger options above.
// Available values: trace, debug, info, warn, error, fatal
logLevel: "info",
{
type: "Console",
},
],

// Define transporter.
// More info: https://moleculer.services/docs/0.14/networking.html
Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"start": "npx tsx ./server.ts",
"cli": "NODE_OPTIONS='--import tsx' moleculer-connect --env --config moleculer.config.ts --transporter NATS",
"ci": "biome ci .",
"test:ci": "vitest --watch",
"test": "vitest --run",
"test:coverage": "vitest --coverage",
"test:ci": "vitest --watch --exclude 'tests/**'",
"test": "vitest --run --exclude 'tests/**'",
"test:coverage": "vitest --coverage --exclude 'tests/**'",
"test:ui": "vitest --ui",
"build": "tsup --env.NODE_ENV production",
"format": "biome format . --write",
Expand All @@ -30,7 +30,11 @@
"generate:action": "hygen action new --name",
"generate:swagger": "npx tsx cli.ts",
"generate:sdk": "openapi-ts",
"typecheck": "npm run generate:sdk && tsc -b"
"typecheck": "npm run generate:sdk && tsc -b",
"test:e2e": "NODE_ENV=test playwright test",
"test:e2e:ui": "NODE_ENV=test playwright test --ui",
"test:e2e:debug": "NODE_ENV=test DEBUG=pw:* playwright test --debug",
"test:e2e:watch": "NODE_ENV=test playwright test --watch"
},
"dependencies": {
"@asteasolutions/zod-to-openapi": "7.3.0",
Expand All @@ -51,6 +55,7 @@
"@biomejs/biome": "1.9.4",
"@flydotio/dockerfile": "0.6.1",
"@hey-api/openapi-ts": "0.61.2",
"@playwright/test": "^1.49.1",
"@types/express": "5.0.0",
"@types/jest": "29.5.14",
"@types/lodash": "4.17.14",
Expand All @@ -67,6 +72,7 @@
"moleculer-connect": "0.2.2",
"moleculer-io": "2.2.0",
"moleculer-repl": "0.7.4",
"msw": "2.1.0",
"npm-run-all2": "7.0.2",
"pino-pretty": "13.0.0",
"sort-package-json": "2.12.0",
Expand Down
35 changes: 35 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
testDir: "./tests",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: "html",
use: {
baseURL: "http://localhost:4567",
trace: "on-first-retry",
},

projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
],

webServer: {
command: "npm run dev",
url: "http://localhost:4567",
reuseExistingServer: !process.env.CI,
},
});
Loading