diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml new file mode 100644 index 000000000..7f621246c --- /dev/null +++ b/.github/workflows/smoke.yml @@ -0,0 +1,30 @@ +name: smoke + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + - '*.md' + pull_request: + paths-ignore: + - 'docs/**' + - '*.md' + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +jobs: + smoke: + name: Smoke Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install dependencies + run: npm install + - uses: boneskull/nodejs-production-test-action@v1 + with: + script: test-ci-smoke diff --git a/package.json b/package.json index a993ce4ba..c1aed27e9 100644 --- a/package.json +++ b/package.json @@ -12,23 +12,23 @@ "pino.d.ts", "bin.js", "browser.js", - "pretty.js", - "usage.txt", "test", "docs", - "example.js", + "smoke.js", "lib" ], "scripts": { "docs": "docsify serve", "browser-test": "airtap --local 8080 test/browser*test.js", "lint": "eslint .", + "smoker": "smoker test-ci-smoke", "prepublishOnly": "tap --no-check-coverage test/internals/version.test.js", "test": "npm run lint && npm run transpile && tap --ts && jest test/jest && npm run test-types", "test-ci": "npm run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly && npm run test-types", "test-ci-pnpm": "pnpm run lint && npm run transpile && tap --ts --no-coverage --no-check-coverage && pnpm run test-types", "test-ci-yarn-pnp": "yarn run lint && npm run transpile && tap --ts --no-check-coverage --coverage-report=lcovonly", "test-types": "tsc && tsd && ts-node test/types/pino.ts", + "test-ci-smoke": "node smoke.js", "transpile": "node ./test/fixtures/ts/transpile.cjs", "cov-ui": "tap --ts --coverage-report=html", "bench": "node benchmarks/utils/runbench all", @@ -91,6 +91,7 @@ "jest": "^29.0.3", "log": "^6.0.0", "loglevel": "^1.6.7", + "midnight-smoker": "^2.0.1", "pino-pretty": "^9.0.0", "pre-commit": "^1.2.2", "proxyquire": "^2.1.3", diff --git a/smoke.js b/smoke.js new file mode 100644 index 000000000..5c19dd132 --- /dev/null +++ b/smoke.js @@ -0,0 +1,35 @@ +'use strict' +const pino = require('pino')() + +pino.info('hello world') +pino.error('this is at error level') +pino.info('the answer is %d', 42) +pino.info({ obj: 42 }, 'hello world') +pino.info({ obj: 42, b: 2 }, 'hello world') +pino.info({ nested: { obj: 42 } }, 'nested') +setImmediate(() => { + pino.info('after setImmediate') +}) +pino.error(new Error('an error')) + +const child = pino.child({ a: 'property' }) +child.info('hello child!') + +const childsChild = child.child({ another: 'property' }) +childsChild.info('hello baby..') + +pino.debug('this should be mute') + +pino.level = 'trace' + +pino.debug('this is a debug statement') + +pino.child({ another: 'property' }).debug('this is a debug statement via child') +pino.trace('this is a trace statement') + +pino.debug('this is a "debug" statement with "') + +pino.info(new Error('kaboom')) +pino.info(null) + +pino.info(new Error('kaboom'), 'with', 'a', 'message')