feat: linter and tests work now
Node.js CI / CI (pull_request) Successful in 32s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 53s

This commit is contained in:
2025-12-27 12:42:17 -08:00
parent 7e7dd9c134
commit 6bbcb4d8fa
9 changed files with 120 additions and 40 deletions
+4 -4
View File
@@ -37,11 +37,11 @@ jobs:
- name: Install Dependencies
run: pnpm install
# - name: Lint Source Files
# run: pnpm run lint
- name: Lint Source Files
run: pnpm run lint
# - name: Verify Build
# run: pnpm run build
- name: Verify Build
run: pnpm run build
- name: Run Tests
run: pnpm run test
-5
View File
@@ -1,5 +0,0 @@
import NaomisConfig from "@nhcarrigan/eslint-config";
export default [
...NaomisConfig,
]
+47
View File
@@ -0,0 +1,47 @@
import NaomisConfig from "@nhcarrigan/eslint-config";
const srcRules = NaomisConfig.find((rule) => rule.files?.includes("src/**/*.ts"));
const testRules = NaomisConfig.find((rule) => rule.files?.includes("test/**/*.spec.ts"));
export default [
...NaomisConfig,
{
files: ["src/**/*.ts"],
languageOptions: {
parserOptions: {
project: "./tsconfig.app.json"
}
},
plugins: {
...srcRules?.plugins,
},
rules: {
...srcRules?.rules,
"new-cap": "off",
// This causes a circular fix error?
"stylistic/no-multi-spaces": "off",
// This must be off because this is not a module.
"import/extensions": "off",
// This is a web app
"no-console": "off",
}
},
{
files: ["src/**/*.spec.ts"],
languageOptions: {
parserOptions: {
project: "./tsconfig.spec.json"
}
},
plugins: {
...testRules?.plugins,
},
rules: {
...testRules?.rules,
// This must be off because this is not a module.
"import/extensions": "off",
// We turn this off because the test bed has weak types.
"@typescript-eslint/consistent-type-assertions": "off",
}
}
]
+12 -8
View File
@@ -1,11 +1,15 @@
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import {
type ApplicationConfig,
provideBrowserGlobalErrorListeners,
} from "@angular/core";
import { provideRouter } from "@angular/router";
import { routes } from "./app.routes";
export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideRouter(routes)
]
providers: [ provideBrowserGlobalErrorListeners(), provideRouter(routes) ],
};
+6 -1
View File
@@ -1,3 +1,8 @@
import { Routes } from '@angular/router';
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import type { Routes } from "@angular/router";
export const routes: Routes = [];
+20 -7
View File
@@ -1,23 +1,36 @@
import { TestBed } from '@angular/core/testing';
import { App } from './app';
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { TestBed } from "@angular/core/testing";
import { describe, beforeEach, it, expect } from "vitest";
import { App } from "./app";
describe('App', () => {
describe("app", () => {
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ App ],
}).compileComponents();
});
it('should create the app', () => {
it("should create the app", () => {
expect.assertions(1);
const fixture = TestBed.createComponent(App);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
expect(app, "did not compile").toBeTruthy();
});
it('should render title', async () => {
it("should render title", async() => {
expect.assertions(1);
const fixture = TestBed.createComponent(App);
await fixture.whenStable();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, lore');
expect(
compiled.querySelector("h1")?.textContent,
"did not render title",
).toContain(
"Hello, lore",
);
});
});
+14 -6
View File
@@ -1,12 +1,20 @@
import { Component, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component, signal } from "@angular/core";
import { RouterOutlet } from "@angular/router";
/**
* The root component for the application.
*/
@Component({
selector: 'app-root',
imports: [ RouterOutlet ],
templateUrl: './app.html',
styleUrl: './app.css'
selector: "app-root",
styleUrl: "./app.css",
templateUrl: "./app.html",
})
export class App {
protected readonly title = signal('lore');
protected readonly title = signal("lore");
}
+13 -5
View File
@@ -1,6 +1,14 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { App } from './app/app';
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { bootstrapApplication } from "@angular/platform-browser";
import { App } from "./app/app";
import { appConfig } from "./app/app.config";
bootstrapApplication(App, appConfig)
.catch((err) => console.error(err));
bootstrapApplication(App, appConfig).
// eslint-disable-next-line unicorn/prefer-top-level-await -- No top level await in a web app
catch((error: unknown) => {
console.error(error);
});
+1 -1
View File
@@ -6,7 +6,7 @@
"outDir": "./out-tsc/spec",
"types": [
"vitest/globals"
]
],
},
"include": [
"src/**/*.d.ts",