Skip to content
Merged
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
33 changes: 10 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ibiqlik/action-yamllint@v3
- uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c

eslint:
runs-on: ubuntu-latest
Expand All @@ -24,11 +24,8 @@ jobs:
- uses: actions/setup-node@v7
with:
node-version: '24'
- uses: actions/cache@v6
with:
path: 'node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- run: npm install
cache: npm
- run: npm ci --ignore-scripts
- name: Run ESLint
run: npm run lint

Expand All @@ -39,11 +36,8 @@ jobs:
- uses: actions/setup-node@v7
with:
node-version: '24'
- uses: actions/cache@v6
with:
path: 'node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- run: npm install
cache: npm
- run: npm ci --ignore-scripts
- name: Run Typescipt Compiler
run: npm run build

Expand All @@ -54,11 +48,8 @@ jobs:
- uses: actions/setup-node@v7
with:
node-version: '24'
- uses: actions/cache@v6
with:
path: 'node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- run: npm install
cache: npm
- run: npm ci --ignore-scripts
- name: Run depcheck
run: npm run depcheck

Expand All @@ -69,15 +60,11 @@ jobs:
- uses: actions/setup-node@v7
with:
node-version: '24'
- uses: actions/cache@v6
with:
path: 'node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- run: npm install
cache: npm
- run: npm ci --ignore-scripts
- name: Run tests
run: npm run test
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
8 changes: 8 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extends: default

ignore-from-file: .gitignore

rules:
line-length:
max: 250
16 changes: 16 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ test("Expand meta err or error", () => {
expect(spyStderr).toHaveBeenLastCalledWith(expected);
});

test("Expand meta err with errno, syscall and cause", () => {
const logger = create({printTimestamp: false, logLevel: "error"});
const err = {
message: "connect ECONNREFUSED",
name: "Error",
errno: -111,
syscall: "connect",
cause: {code: "ENOTFOUND", hostname: "elastic.example"},
};

logger.error("HulaHop", {err});
expect(spyStderr).toHaveBeenCalledTimes(1);
const expected = "{\"log.level\":\"error\",\"message\":\"HulaHop\",\"error.message\":\"connect ECONNREFUSED\",\"error.type\":\"Error\",\"error.errno\":\"-111\",\"error.syscall\":\"connect\",\"error.cause.code\":\"ENOTFOUND\",\"error.cause.hostname\":\"elastic.example\"}\n";
expect(spyStderr).toHaveBeenLastCalledWith(expected);
});

test("Expand meta err with fields missing", () => {
const logger = create({printTimestamp: false, logLevel: "error"});
const err = {
Expand Down
Loading