Skip to content

Commit

Permalink
chore(ci): add test extend lib
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Sep 27, 2023
1 parent 72ae3ea commit 460dc71
Show file tree
Hide file tree
Showing 19 changed files with 273 additions and 12 deletions.
3 changes: 2 additions & 1 deletion apps/ping-ui/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"options": {
"buildTarget": "ping-ui:build"
}
}
},
"version": {}
}
}
3 changes: 2 additions & 1 deletion apps/pong-ui/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"options": {
"buildTarget": "pong-ui:build"
}
}
},
"version": {}
}
}
8 changes: 0 additions & 8 deletions libs/game-lib/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@
"options": {
"lintFilePatterns": ["libs/game-lib/**/*.ts", "libs/game-lib/**/*.html"]
}
},
"version": {
"executor": "@jscutlery/semver:version",
"options": {
"preset": "conventional",
"skipCommit": true,
"skipCommitTypes": ["docs","ci"]
}
}
}
}
43 changes: 43 additions & 0 deletions libs/test-extend-lib/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "lib",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "lib",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
7 changes: 7 additions & 0 deletions libs/test-extend-lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test-extend-lib

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test test-extend-lib` to execute the unit tests.
22 changes: 22 additions & 0 deletions libs/test-extend-lib/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'test-extend-lib',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/libs/test-extend-lib',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
7 changes: 7 additions & 0 deletions libs/test-extend-lib/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/libs/test-extend-lib",
"lib": {
"entryFile": "src/index.ts"
}
}
19 changes: 19 additions & 0 deletions libs/test-extend-lib/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@onecx/test-extend-lib",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^16.2.0",
"@angular/core": "^16.2.0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/onecx/ping-producttree/main/libs/test-extend-lib"
},
"dependencies": {
"tslib": "^2.3.0"
},
"sideEffects": false
}
57 changes: 57 additions & 0 deletions libs/test-extend-lib/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "test-extend-lib",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/test-extend-lib/src",
"prefix": "lib",
"tags": ["publish:npm"],
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
"options": {
"project": "libs/test-extend-lib/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "libs/test-extend-lib/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "libs/test-extend-lib/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/test-extend-lib/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"libs/test-extend-lib/**/*.ts",
"libs/test-extend-lib/**/*.html",
"libs/test-extend-lib/package.json"
]
}
},
"version": {
"options": {
"tagPrefix": "",
"postTargets": ["test-extend-lib:npm-repo", "test-extend-lib:github-release"]
}
}
}
}
1 change: 1 addition & 0 deletions libs/test-extend-lib/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/test-extend-lib.module';
7 changes: 7 additions & 0 deletions libs/test-extend-lib/src/lib/test-extend-lib.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

@NgModule({
imports: [CommonModule],
})
export class TestExtendLibModule {}
8 changes: 8 additions & 0 deletions libs/test-extend-lib/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
29 changes: 29 additions & 0 deletions libs/test-extend-lib/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
17 changes: 17 additions & 0 deletions libs/test-extend-lib/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": [
"src/**/*.spec.ts",
"src/test-setup.ts",
"jest.config.ts",
"src/**/*.test.ts"
],
"include": ["src/**/*.ts"]
}
9 changes: 9 additions & 0 deletions libs/test-extend-lib/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}
16 changes: 16 additions & 0 deletions libs/test-extend-lib/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"target": "es2016",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
8 changes: 7 additions & 1 deletion libs/test-lib/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/test-lib/src",
"prefix": "lib",
"tags": [],
"tags": ["publish:npm"],
"projectType": "library",
"targets": {
"build": {
Expand Down Expand Up @@ -46,6 +46,12 @@
"libs/test-lib/package.json"
]
}
},
"version": {
"options": {
"tagPrefix": "",
"postTargets": ["test-lib:npm-repo", "test-lib:github-release"]
}
}
}
}
20 changes: 19 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,22 @@
"options": {
"preset": "conventional",
"skipCommit": true,
"skipCommitTypes": ["docs", "ci"]
"skipCommitTypes": ["docs", "ci"],
"skipRootChangelog": true,
"skipProjectChangelog": true
}
},
"github-release": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "${tag}",
"notes": "${notes}"
}
},
"npm-repo": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public"
}
}
},
Expand All @@ -55,6 +70,9 @@
},
"@nx/angular:component": {
"style": "scss"
},
"@nx/workspace:move": {
"projectNameAndRootFormat": "as-provided"
}
}
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@onecx/test-extend-lib": ["libs/test-extend-lib/src/index.ts"],
"@onecx/test-lib": ["libs/test-lib/src/index.ts"],
"@ping/game-lib": ["libs/game-lib/src/index.ts"],
"@ping/player": ["libs/player/src/index.ts"]
Expand Down

0 comments on commit 460dc71

Please sign in to comment.