Skip to content
Open
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
37 changes: 34 additions & 3 deletions .github/workflows/coverage-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,40 @@ on:
jobs:
run-tests-check-coverage:
name: Run tests & check coverage
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
uses: fingerprintjs/dx-team-toolkit/.github/workflows/coverage-diff.yml@v1
with:
runAfterInstall: pnpm generate:version

Comment thread
Orkuncakilkaya marked this conversation as resolved.
steps:
- name: Checkout the repository
uses: actions/checkout@v7

- name: Install pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271

- name: Install latest node version
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'pnpm'

- name: Install Node packages
run: pnpm install --frozen-lockfile

- name: Generate version
run: pnpm generate:version

- name: Build
run: pnpm build

- name: Run tests and prepare coverage report
run: pnpm test:coverage

- name: Send Coverage to Coveralls
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
# make it optional to not fail the whole job if coveralls fails
continue-on-error: true
Comment thread
Copilot marked this conversation as resolved.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
"projects/*"
],
"pnpm": {
"onlyBuiltDependencies": ["@parcel/watcher", "esbuild", "lmdb", "msgpackr-extract"],
"overrides": {
"rxjs": "~7.8.0"
}
}
},
"packageManager": "pnpm@9.15.9+sha512.68046141893c66fad01c079231128e9afb89ef87e2691d69e4d40eee228988295fd4682181bae55b58418c3a253bde65a505ec7c5f9403ece5cc3cd37dcf2531"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's migrate to pnpm 11 (can be done in a separate PR)

}
134 changes: 49 additions & 85 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
packages:
- 'projects/*'
- 'projects/*'
2 changes: 1 addition & 1 deletion projects/fingerprintjs-pro-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"@fingerprint/agent": "^4.0.0",
"tslib": "^2.5.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TestBed } from '@angular/core/testing'
import { FingerprintService } from './fingerprint.service'
import { PLATFORM_ID } from '@angular/core'
import { FINGERPRINT_ANGULAR_SETTINGS_TOKEN } from './tokens/fingerprint-angular-settings-token'

describe('FingerprintService (Server)', () => {
let service: FingerprintService

beforeEach(() => {
TestBed.configureTestingModule({
providers: [
FingerprintService,
{ provide: PLATFORM_ID, useValue: 'server' },
{ provide: FINGERPRINT_ANGULAR_SETTINGS_TOKEN, useValue: { startOptions: { apiKey: 'test' } } },
],
})
service = TestBed.inject(FingerprintService)
})

it('should reject getVisitorData on non-browser platform', async () => {
await expect(service.getVisitorData()).rejects.toThrow('Fingerprint agent is not initialized on this platform')
})

it('should reject collectData on non-browser platform', async () => {
await expect(service.collectData()).rejects.toThrow('Fingerprint agent is not initialized on this platform')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing'
import { FINGERPRINT_ANGULAR_SETTINGS_TOKEN } from './fingerprint-angular-settings-token'

describe('FINGERPRINT_ANGULAR_SETTINGS_TOKEN', () => {
it('should have a default value', () => {
TestBed.configureTestingModule({
providers: [],
})
const settings = TestBed.inject(FINGERPRINT_ANGULAR_SETTINGS_TOKEN)
expect(settings).toEqual({ startOptions: { apiKey: '' } })
})
})
15 changes: 15 additions & 0 deletions projects/fingerprintjs-pro-angular/src/public-api.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as publicApi from './public-api'
import { FingerprintService } from './lib/fingerprint.service'
import { FingerprintModule } from './lib/fingerprint.module'
import { provideFingerprint } from './lib/fingerprint.providers'
import { FINGERPRINT_ANGULAR_SETTINGS_TOKEN } from './lib/tokens/fingerprint-angular-settings-token'

describe('public-api', () => {
it('should export the expected symbols', () => {
expect(publicApi.FingerprintService).toBe(FingerprintService)
expect(publicApi.FingerprintModule).toBe(FingerprintModule)
expect(publicApi.provideFingerprint).toBe(provideFingerprint)
expect(publicApi.FINGERPRINT_ANGULAR_SETTINGS_TOKEN).toBe(FINGERPRINT_ANGULAR_SETTINGS_TOKEN)
expect(publicApi.Fingerprint).toBeDefined()
})
})
Loading