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
9 changes: 0 additions & 9 deletions .browserslistrc

This file was deleted.

48 changes: 36 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,57 @@ concurrency:
jobs:
build_test_release:
permissions:
actions: write
contents: write
id-token: write # to enable use of OIDC (npm trusted publishing and provenance)
actions: write # to cancel/stop running workflows (styfle/cancel-workflow-action)
contents: write # to create release tags (cycjimmy/semantic-release-action)
issues: write # to post release that resolves an issue (cycjimmy/semantic-release-action)
pull-requests: write # to be able to comment on released pull requests

strategy:
matrix:
node-version: ${{ fromJSON((github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') && '[22]' || '[20, 22, 24]') }}
node-version: ${{ fromJSON((github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') && '[24]' || '[20, 22, 24]') }}
os: ${{ fromJSON((github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') && '["ubuntu-latest"]' || '["ubuntu-latest", "windows-latest"]') }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: use Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Update npm
run: npm install -g npm@latest
- name: install
run: npm install --force
- name: build
run: npm run build -- --skip-nx-cache
- name: test
run: npm run test
run: npm run build
timeout-minutes: 5
- name: test-library
run: npm run test:testing-library
timeout-minutes: 5
- name: test-examples
run: npm run test:example-app
timeout-minutes: 5
- name: test-examples-jest
run: npm run test:jest-app
timeout-minutes: 5
- name: test-karma-examples
run: npm run test:karma-app -- --watch=false --no-progress
timeout-minutes: 5
- name: lint
run: npm run lint
- name: Release
timeout-minutes: 5
- name: 🚀 Release
if: github.repository == 'testing-library/angular-testing-library' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta')
run: npx semantic-release
uses: cycjimmy/semantic-release-action@v6
with:
semantic_version: 25
working_directory: './dist/@testing-library/angular'
branches: |
[
'main',
{name: 'beta', prerelease: true},
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CI: true
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
# misc
/.angular/cache
.angular
.nx
migrations.json
.cache
/.sass-cache
/connect.lock
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22
24
248 changes: 248 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"analytics": false,
"cache": {
"enabled": true,
"path": "./.cache/angular",
"environment": "all"
}
},
"newProjectRoot": "projects",
"projects": {
"testing-library": {
"projectType": "library",
"root": "projects/testing-library",
"sourceRoot": "projects/testing-library/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular/build:ng-packagr",
"options": {
"project": "projects/testing-library/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/testing-library/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/testing-library/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular/build:unit-test",
"options": {
"setupFiles": ["projects/testing-library/test-setup.ts"]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["projects/testing-library/**/*.ts", "projects/testing-library/**/*.html"]
}
}
}
},
"example-app": {
"projectType": "application",
"root": "apps/example-app",
"sourceRoot": "apps/example-app/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": {
"base": "dist/apps/example-app"
},
"index": "apps/example-app/src/index.html",
"tsConfig": "apps/example-app/tsconfig.app.json",
"assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"],
"styles": [],
"scripts": [],
"browser": "apps/example-app/src/main.ts"
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "example-app:build:production"
},
"development": {
"buildTarget": "example-app:build:development"
}
},
"defaultConfiguration": "development"
},
"test": {
"builder": "@angular/build:unit-test",
"options": {
"setupFiles": ["apps/example-app/test-setup.ts"]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["apps/example-app/**/*.ts", "apps/example-app/**/*.html"]
}
}
}
},
"example-app-jest": {
"projectType": "application",
"root": "apps/example-app-jest",
"sourceRoot": "apps/example-app-jest/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": {
"base": "dist/apps/example-app-jest"
},
"index": "apps/example-app-jest/src/index.html",
"tsConfig": "apps/example-app-jest/tsconfig.app.json",
"assets": ["apps/example-app-jest/src/favicon.ico", "apps/example-app-jest/src/assets"],
"styles": [],
"scripts": [],
"browser": "apps/example-app-jest/src/main.ts"
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "example-app-jest:build:production"
},
"development": {
"buildTarget": "example-app-jest:build:development"
}
},
"defaultConfiguration": "development"
},
"test": {
"builder": "@angular-builders/jest:run"
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["apps/example-app-jest/**/*.ts", "apps/example-app-jest/**/*.html"]
}
}
}
},
"example-app-karma": {
"projectType": "application",
"root": "apps/example-app-karma",
"sourceRoot": "apps/example-app-karma/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"outputPath": {
"base": "dist/apps/example-app-karma"
},
"index": "apps/example-app-karma/src/index.html",
"tsConfig": "apps/example-app-karma/tsconfig.app.json",
"assets": ["apps/example-app-karma/src/favicon.ico", "apps/example-app-karma/src/assets"],
"styles": [],
"scripts": [],
"browser": "apps/example-app-karma/src/main.ts"
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "example-app-karma:build:production"
},
"development": {
"buildTarget": "example-app-karma:build:development"
}
},
"defaultConfiguration": "development"
},
"test": {
"builder": "@angular/build:karma",
"options": {
"main": "apps/example-app-karma/src/test.ts",
"tsConfig": "apps/example-app-karma/tsconfig.spec.json",
"karmaConfig": "apps/example-app-karma/karma.conf.js"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["apps/example-app-karma/**/*.ts", "apps/example-app-karma/**/*.html"]
}
}
}
}
},
"schematics": {
"@schematics/angular:component": {
"style": "scss",
"displayBlock": true,
"changeDetection": "OnPush"
}
}
}
7 changes: 7 additions & 0 deletions apps/example-app-jest/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check

// TODO - https://github.com/nrwl/nx/issues/22576

/** @type {import('@typescript-eslint/utils/ts-eslint').FlatConfig.ConfigPromise} */
const config = (async () => (await import('./eslint.config.mjs')).default)();
module.exports = config;
6 changes: 6 additions & 0 deletions apps/example-app-jest/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-check

import tseslint from 'typescript-eslint';
import rootConfig from '../../eslint.config.mjs';

export default tseslint.config(...rootConfig);
21 changes: 21 additions & 0 deletions apps/example-app-jest/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/apps/example-app-jest/src/test-setup.ts'],
modulePathIgnorePatterns: ['<rootDir>/dist'],
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/dist/'],
transform: {
'^.+.ts?$': [
'ts-jest',
{
tsconfig: '<rootDir>/apps/example-app-jest/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
coverageDirectory: 'coverage/apps/example-app-jest',
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
moduleNameMapper: {
'@testing-library/angular/jest-utils': '<rootDir>/projects/testing-library/jest-utils/index.ts',
'@testing-library/angular': '<rootDir>/projects/testing-library',
},
};
Loading