Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Commit

Permalink
Update to fastify v4 + update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromemacias committed Aug 3, 2022
1 parent 95148a3 commit 4640a09
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 69 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,3 @@ jobs:
with:
license-check: true
lint: true

typescript:
name: Test
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
node-version: [14, 16, 18]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm i --ignore-scripts

- name: Run Typescript
run: npm run typescript
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
7 changes: 7 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
jsx: false
ts: false
flow: false
coverage: false
jobs: 1
files:
- 'test/**/*.test.js'
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
"main": "plugin.js",
"types": "plugin.d.ts",
"scripts": {
"test-local": "tap test/*.test.js && npm run typescript",
"test": "tap --cov test/*.test.js && npm run typescript",
"lint-local": "standard | snazzy",
"lint": "standard",
"typescript": "tsc --project ./tsconfig.json"
"lint": "standard | snazzy",
"test": "npm run test:unit && npm run test:typescript",
"test:unit": "tap",
"test:typescript": "tsd"
},
"precommit": [
"lint",
Expand All @@ -24,7 +23,7 @@
],
"keywords": [
"fastify",
"cookie"
"xray"
],
"author": "Jérôme Macias <[email protected]>",
"license": "MIT",
Expand All @@ -33,17 +32,17 @@
},
"homepage": "https://github.com/jeromemacias/fastify-xray#readme",
"devDependencies": {
"@types/node": "^14.14.35",
"fastify": "^3.14.0",
"pre-commit": "^1.2.2",
"@types/node": "^16.11.47",
"fastify": "^4.0.0",
"@fastify/pre-commit": "^2.0.2",
"sinon": "~9.0.2",
"snazzy": "^9.0.0",
"standard": "^16.0.3",
"tap": "^14.11.0",
"typescript": "^4.2.3"
"standard": "^17.0.0",
"tap": "^16.3.0",
"tsd": "^0.22.0"
},
"dependencies": {
"aws-xray-sdk-core": "^3.2.0",
"fastify-plugin": "^3.0.0"
"aws-xray-sdk-core": "^3.3.0",
"fastify-plugin": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,6 @@ function plugin (fastify, options, next) {
}

module.exports = fp(plugin, {
fastify: '>=3.0.0',
fastify: '4.x',
name: 'fastify-xray'
})
2 changes: 1 addition & 1 deletion test/types.test.ts → plugin.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fastify from 'fastify'
import xray from '../'
import xray from './'
import AWSXRay from 'aws-xray-sdk-core'

const appWithImplicitHttp = fastify()
Expand Down
10 changes: 3 additions & 7 deletions test/xray.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const test = require('tap').test
const { test } = require('tap')
const xray = require('aws-xray-sdk-core')
const Fastify = require('fastify')
const sinon = require('sinon')
Expand Down Expand Up @@ -82,7 +82,7 @@ test('should throw error if defaultName option is missing', async (t) => {
test('should initialized correctly', (t) => {
t.plan(6)

t.beforeEach((done) => {
t.beforeEach(() => {
sinon.stub(SegmentEmitter)
sinon.stub(ServiceConnector)

Expand All @@ -99,15 +99,11 @@ test('should initialized correctly', (t) => {
.stub(mwUtils, 'processHeaders')
.returns({ root: traceId, parent: parentId, sampled: '1' })
resolveNameStub = sinon.stub(mwUtils, 'resolveName').returns(defaultName)

done()
})

t.afterEach((done) => {
t.afterEach(() => {
sinon.restore()
delete process.env.AWS_XRAY_TRACING_NAME

done()
})

t.test('success tracing in automatic mode', (st) => {
Expand Down
20 changes: 0 additions & 20 deletions tsconfig.json

This file was deleted.

0 comments on commit 4640a09

Please sign in to comment.