Skip to content

test: add angular test matrix#85

Open
Orkuncakilkaya wants to merge 14 commits into
mainfrom
angular-test-matrix
Open

test: add angular test matrix#85
Orkuncakilkaya wants to merge 14 commits into
mainfrom
angular-test-matrix

Conversation

@Orkuncakilkaya

@Orkuncakilkaya Orkuncakilkaya commented May 15, 2026

Copy link
Copy Markdown
Contributor

This PR solves INTER-2234

CI/CD Improvements:

  • Added a new GitHub Actions workflow (.github/workflows/test-matrix.yml) to run tests across Angular versions 15–21, each paired with the appropriate Node.js version, enhancing automated compatibility checks.

Node.js Version Management:

  • Added a .node-version file specifying Node.js version 18 for local development consistency.
  • Updated package.json to require Node.js version 18 or higher using the engines field, ensuring developers use a compatible Node.js version.

Development Tooling:

  • Updated linting scripts in package.json to include .mjs files in addition to .js and .ts, improving code quality checks for modern JavaScript modules.
  • Added a test:matrix script to package.json to facilitate running matrix tests locally or in CI.

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 75% 30/40
🟡 Branches 60% 3/5
🟢 Functions 83.33% 5/6
🟡 Lines 72.97% 27/37

Test suite run success

10 tests passing in 2 suites.

Report generated by 🧪jest coverage report action from be5df1e

Show full coverage report
St File % Stmts % Branch % Funcs % Lines Uncovered Line #s
🟡 All files 75 60 83.33 72.97
🔴  src 0 100 100 0
🔴   public-api.ts 0 100 100 0 5-13
🟢  src/lib 93.33 60 100 92.59
🟢   fingerprint.module.ts 100 100 100 100
🟢   fingerprint.providers.ts 100 100 100 100
🟢   fingerprint.service.ts 89.47 60 100 88.88 57,64
🟢   version.ts 100 100 100 100
🟡  src/lib/tokens 66.66 100 0 66.66
🟡   fingerprint-angular-settings-token.ts 66.66 100 0 66.66 7

@Orkuncakilkaya Orkuncakilkaya marked this pull request as ready for review May 15, 2026 12:45
Comment thread .github/workflows/test-matrix.yml Outdated
TheUnderScorer
TheUnderScorer previously approved these changes May 19, 2026

Copilot AI left a comment

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.

Pull request overview

Adds an Angular version test matrix to validate the library across Angular 15–21, with supporting Node/pnpm configuration for CI and local test execution.

Changes:

  • Adds a GitHub Actions workflow for Angular matrix testing.
  • Adds a local bin/test-matrix.sh helper script with similar matrix logic.
  • Updates Node/test configuration and ignores generated test artifacts.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/test-matrix.yml Adds PR workflow to build and test the library across Angular versions.
bin/test-matrix.sh Adds local shell script for running the same Angular matrix.
package.json Adds Node engine requirement.
.node-version Sets the repository Node version to 22.
.gitignore Ignores pnpm store and matrix test logs.
projects/fingerprintjs-pro-angular/tsconfig.spec.json Adds Node types for specs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/test-matrix.yml Outdated

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 3 out of 20 changed files in this pull request and generated 3 comments.

Comment thread .node-version Outdated
Comment thread .github/workflows/test-matrix.yml Outdated
Comment thread package.json

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 3 out of 20 changed files in this pull request and generated no new comments.

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 3 out of 21 changed files in this pull request and generated no new comments.

@TheUnderScorer TheUnderScorer left a comment

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.

Looks good, I think the JS approach is way more readable compared to bash, so thanks for working on this!

One more suggestion: currently, the version matrix lives in two places - in the test-matrix.yml and in the constants.mjs. Perhaps we could introduce a single source of truth with a mapping of specific Node.js <-> Angular versions and use it in both places?

Comment thread bin/utils/commands/ensurePnpm.mjs Outdated
exec('pnpm --version', { stdio: 'ignore' })
} catch (e) {
console.log('pnpm not found, installing...')
exec('npm install -g pnpm', { stdio: 'inherit' })

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.

I'd prefer for it to throw an error rather than install the pnpm globally - this should be handled manually IMO.

Comment thread bin/utils/fs.mjs Outdated

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: most of these methods are just wrappers for fs and add too much noise, consider removing them and just using fs directly when possible.

Comment thread bin/test-matrix.mjs Outdated
import { setupLogDir } from './utils/setupLogDir.mjs'
import { logErrorSummary } from './utils/logErrorSummary.mjs'

process.env.CI = 'true'

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.

Shouldn't this be up to the environment to declare whether it's CI or not? When running locally (not in CI), this could produce unexpected behaviors.

Comment thread bin/test-matrix.mjs Outdated
Comment on lines +58 to +93
async function main() {
setupLogDir()

const args = process.argv.slice(2)
const versionArgs = []
for (let i = 0; i < args.length; i++) {
if (args[i].startsWith('--version=')) {
versionArgs.push(args[i].split('=')[1])
} else if (args[i] === '--version' && i + 1 < args.length) {
versionArgs.push(args[++i])
}
}

const versionsToTest = versionArgs.length > 0 ? versionArgs : VERSIONS

console.log(`Starting tests for Angular versions: ${versionsToTest.join(', ')}`)
console.log(`Using pnpm store at: ${PNPM_STORE_DIR}`)
console.log(`Logs: ${LOG_DIR}`)
console.log('------------------------------------------------------------')

ensurePnpm()

const results = await Promise.all(versionsToTest.map((v) => testVersion(v)))
const failed = results.some((code) => code !== 0)

console.log('------------------------------------------------------------')
if (failed) {
console.log('CI Pipeline Failed')
process.exit(1)
} else {
console.log('Success: All Angular versions passed')
process.exit(0)
}
}

main()

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: since it's a module, the async/await is available in top-level, so we could remove main and just run the code inline for better readability

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR doesn't contain any changesets. If there are user-facing changes, don't forget to run:

pnpm exec changeset

to create a changeset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants