From eaddd72765b51074c41f6dc415e9b3bd3f471022 Mon Sep 17 00:00:00 2001 From: Nacho Vazquez Date: Tue, 26 Nov 2024 09:50:59 -0300 Subject: [PATCH 1/6] feat!: remove deprecated enum levels --- .../error-throwing.driver.spec.ts | 14 ++----- .../src/lib/logs/driver-log-creators.ts | 3 +- .../lib/object-driver/object.driver.spec.ts | 10 +---- .../src/lib/spy-driver/spy.driver.spec.ts | 10 +---- .../provide-lumberjack-http-driver.spec.ts | 12 ++---- .../lumberjack-http.driver.spec.ts | 10 +---- packages/ngworker/lumberjack/src/index.ts | 6 +-- .../default-development-levels.ts | 4 +- .../default-production-levels.ts | 4 +- .../lumberjack-log-driver.config.ts | 4 +- .../lib/configuration/lumberjack.config.ts | 4 +- .../formatting/lumberjack-format-log.spec.ts | 20 ++-------- .../logging/lumberjack-log.builder.spec.ts | 10 +---- .../src/lib/logging/lumberjack-log.builder.ts | 6 +-- .../logging/lumberjack-logger.builder.spec.ts | 4 +- .../lib/logging/lumberjack-logger.builder.ts | 6 +-- .../lib/logging/lumberjack-logger.service.ts | 7 +--- .../src/lib/logging/lumberjack.service.ts | 6 +-- .../scoped-lumberjack-logger.service.ts | 4 +- .../src/lib/logs/lumberjack-config-levels.ts | 18 ++------- .../src/lib/logs/lumberjack-level.ts | 22 +---------- .../src/lib/logs/lumberjack-log-level.ts | 15 ++----- .../lumberjack/src/lib/logs/lumberjack.log.ts | 4 +- .../ngworker/lumberjack/src/logs-api.spec.ts | 39 +------------------ 24 files changed, 54 insertions(+), 188 deletions(-) diff --git a/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts b/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts index 6a9b7d630..2177ffb18 100644 --- a/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts +++ b/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts @@ -1,8 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -33,26 +31,20 @@ describe(ErrorThrowingDriver.name, () => { } describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical], - [LumberjackLevel.Debug, (driver) => driver.logDebug], - [LumberjackLevel.Error, (driver) => driver.logError], - [LumberjackLevel.Info, (driver) => driver.logInfo], - [LumberjackLevel.Trace, (driver) => driver.logTrace], - [LumberjackLevel.Warning, (driver) => driver.logWarning], ['critical', (driver) => driver.logCritical], ['debug', (driver) => driver.logDebug], ['error', (driver) => driver.logError], ['info', (driver) => driver.logInfo], ['trace', (driver) => driver.logTrace], ['warn', (driver) => driver.logWarning], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( `implements a spy when using the %s log level`, (logLevel, logMethod) => { it('throws an error on first log when the default log driver configuration is used', () => { const { driver } = setup(); const driverLog = createDriverLog(logLevel, logLevel, '', 'ErrorThrowingDriverDefaultTest'); - expect(() => logMethod(driver).call(driver, driverLog)).toThrowError(); + expect(() => logMethod(driver).call(driver, driverLog)).toThrow(); }); describe.each([0, 1, 2, 3])( @@ -64,7 +56,7 @@ describe(ErrorThrowingDriver.name, () => { const act = () => logMethod(driver).call(driver, driverLog); repeatSideEffect(logsBeforeThrowing, act); - expect(act).toThrowError(); + expect(act).toThrow(); }); } ); diff --git a/packages/internal/test-util/src/lib/logs/driver-log-creators.ts b/packages/internal/test-util/src/lib/logs/driver-log-creators.ts index 72e420daf..553dc29ae 100644 --- a/packages/internal/test-util/src/lib/logs/driver-log-creators.ts +++ b/packages/internal/test-util/src/lib/logs/driver-log-creators.ts @@ -1,7 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { - LogLevel, LumberjackLogDriverLog, LumberjackLogLevel, LumberjackLogPayload, @@ -10,7 +9,7 @@ import { export const createDriverLog = ( formattedLog: string, - level: LumberjackLogLevel | LogLevel, + level: LumberjackLogLevel, message = '', scope = 'Test', payload?: TPayload diff --git a/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts b/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts index b77dc32ca..eadc49fa2 100644 --- a/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts +++ b/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts @@ -2,8 +2,6 @@ import { TestBed } from '@angular/core/testing'; import { createDriverLog, provideObjectDriver } from '@internal/test-util'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -30,19 +28,13 @@ describe(ObjectDriver.name, () => { }); describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical, { isWorking: true }], - [LumberjackLevel.Debug, (driver) => driver.logDebug, { isWorking: false }], - [LumberjackLevel.Error, (driver) => driver.logError, undefined], - [LumberjackLevel.Info, (driver) => driver.logInfo, { isWorking: true }], - [LumberjackLevel.Trace, (driver) => driver.logTrace, { isWorking: false }], - [LumberjackLevel.Warning, (driver) => driver.logWarning, undefined], ['critical', (driver) => driver.logCritical, { isWorking: true }], ['debug', (driver) => driver.logDebug, { isWorking: false }], ['error', (driver) => driver.logError, undefined], ['info', (driver) => driver.logInfo, { isWorking: true }], ['trace', (driver) => driver.logTrace, { isWorking: false }], ['warn', (driver) => driver.logWarning, undefined], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void, ObjectPayload | undefined]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void, ObjectPayload | undefined]>)( `delegates to ${ObjectService.name} when using the %s log level`, (logLevel, logMethod, expectedPayload) => { it(`forwards the log payload to the ${ObjectService.prototype.log.name} method`, () => { diff --git a/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts b/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts index 1593c4f1e..c863cfffa 100644 --- a/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts +++ b/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts @@ -1,8 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -27,19 +25,13 @@ describe(SpyDriver.name, () => { }); describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical], - [LumberjackLevel.Debug, (driver) => driver.logDebug], - [LumberjackLevel.Error, (driver) => driver.logError], - [LumberjackLevel.Info, (driver) => driver.logInfo], - [LumberjackLevel.Trace, (driver) => driver.logTrace], - [LumberjackLevel.Warning, (driver) => driver.logWarning], ['critical', (driver) => driver.logCritical], ['debug', (driver) => driver.logDebug], ['error', (driver) => driver.logError], ['info', (driver) => driver.logInfo], ['trace', (driver) => driver.logTrace], ['warn', (driver) => driver.logWarning], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( `implements a spy when using the %s log level`, (logLevel, logMethod) => { it('records calls', () => { diff --git a/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts b/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts index ae5bd4f29..13b9382ac 100644 --- a/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts +++ b/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts @@ -2,7 +2,6 @@ import { TestBed } from '@angular/core/testing'; import { HttpHandlerFn, HttpRequest, withInterceptors } from '@angular/common/http'; import { - ConfigLevels, LumberjackConfigLevels, LumberjackLogDriver, lumberjackLogDriverToken, @@ -23,7 +22,7 @@ import { LumberjackHttpDriverInternalConfig } from './lumberjack-http-driver-int import { LumberjackHttpDriverOptions } from './lumberjack-http-driver.options'; function createHttpOptions( - extraOptions: { levels?: ConfigLevels; identifier?: string } = {} + extraOptions: { levels?: LumberjackConfigLevels; identifier?: string } = {} ): LumberjackHttpDriverOptions { return { origin: 'TEST_MODULE', @@ -33,10 +32,7 @@ function createHttpOptions( }; } -function createHttpConfig( - levels: LumberjackConfigLevels | ConfigLevels, - identifier?: string -): LumberjackHttpDriverConfig { +function createHttpConfig(levels: LumberjackConfigLevels, identifier?: string): LumberjackHttpDriverConfig { const config: Writable = { levels, origin: 'TEST_MODULE', @@ -169,7 +165,7 @@ describe(provideLumberjackHttpDriver.name, () => { }); it('registers the specified options with custom levels', () => { - const customLevels: ConfigLevels = ['critical']; + const customLevels: LumberjackConfigLevels = ['critical']; const options = createHttpOptions({ levels: customLevels }); const httpDriver = createHttpDriverWithOptions({ options }); @@ -228,7 +224,7 @@ describe(provideLumberjackHttpDriver.name, () => { it('does register the specified log driver options WITH HttpClient features', () => { const testInterceptor = jest.fn((req, next) => next(req)); const features: HttpClientFeatures = [withInterceptors([testInterceptor])]; - const customLevels: ConfigLevels = ['critical']; + const customLevels: LumberjackConfigLevels = ['critical']; const options = createHttpOptions({ levels: customLevels }); const httpDriver = createHttpDriverWithOptions({ options, features }); diff --git a/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts b/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts index f6776622c..f810703ee 100644 --- a/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts +++ b/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts @@ -4,8 +4,6 @@ import { VERSION } from '@angular/platform-browser'; import { createCriticalDriverLog, createDriverLog, repeatSideEffect } from '@internal/test-util'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -104,19 +102,13 @@ describe(LumberjackHttpDriver.name, () => { }); describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical], - [LumberjackLevel.Debug, (driver) => driver.logDebug], - [LumberjackLevel.Error, (driver) => driver.logError], - [LumberjackLevel.Info, (driver) => driver.logInfo], - [LumberjackLevel.Trace, (driver) => driver.logTrace], - [LumberjackLevel.Warning, (driver) => driver.logWarning], ['critical', (driver) => driver.logCritical], ['debug', (driver) => driver.logDebug], ['error', (driver) => driver.logError], ['info', (driver) => driver.logInfo], ['trace', (driver) => driver.logTrace], ['warn', (driver) => driver.logWarning], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( 'logs to a web API using the %s log level', (logLevel, logMethod) => { it('sends the driver log to the configured URL', () => { diff --git a/packages/ngworker/lumberjack/src/index.ts b/packages/ngworker/lumberjack/src/index.ts index 2637f9039..87d0a33f0 100644 --- a/packages/ngworker/lumberjack/src/index.ts +++ b/packages/ngworker/lumberjack/src/index.ts @@ -24,10 +24,10 @@ export { LumberjackLogFactory } from './lib/logging/lumberjack-log-factory'; export { LumberjackLogBuilder } from './lib/logging/lumberjack-log.builder'; // Logs -export { LumberjackConfigLevels, ConfigLevels } from './lib/logs/lumberjack-config-levels'; -export { LumberjackLevel, Level } from './lib/logs/lumberjack-level'; +export { LumberjackConfigLevels } from './lib/logs/lumberjack-config-levels'; +export { LumberjackLevel } from './lib/logs/lumberjack-level'; export { LumberjackLog } from './lib/logs/lumberjack.log'; -export { LumberjackLogLevel, LogLevel } from './lib/logs/lumberjack-log-level'; +export { LumberjackLogLevel } from './lib/logs/lumberjack-log-level'; export { LumberjackLogPayload } from './lib/logs/lumberjack-log-payload'; // Time diff --git a/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts b/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts index 1c5c5d2ee..7abfed6ae 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts @@ -1,3 +1,3 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; -export const defaultDevelopmentLevels: LumberjackConfigLevels | ConfigLevels = ['verbose']; +export const defaultDevelopmentLevels: LumberjackConfigLevels = ['verbose']; diff --git a/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts b/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts index bd6d4f79c..c3fa71177 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts @@ -1,3 +1,3 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; -export const defaultProductionLevels: LumberjackConfigLevels | ConfigLevels = ['critical', 'error', 'info', 'warn']; +export const defaultProductionLevels: LumberjackConfigLevels = ['critical', 'error', 'info', 'warn']; diff --git a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts index fd0aa5adb..960638632 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts @@ -1,4 +1,4 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; /** * Settings for a log driver. @@ -9,7 +9,7 @@ export interface LumberjackLogDriverConfig { * * `['verbose']` indicates that all log levels are allowed. */ - readonly levels: LumberjackConfigLevels | ConfigLevels; + readonly levels: LumberjackConfigLevels; /** * Driver Identifier, necessary for driver filtering. diff --git a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts index b46299553..e7a629ead 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts @@ -1,4 +1,4 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackFormatFunction } from './lumberjack-format-function'; @@ -15,5 +15,5 @@ export interface LumberjackConfig { let logFactory: LumberjackLogFactory; describe('Log level', () => { - const logLevels: (LumberjackLogLevel | LogLevel)[] = [ - LumberjackLevel.Critical, - LumberjackLevel.Debug, - LumberjackLevel.Error, - LumberjackLevel.Info, - LumberjackLevel.Trace, - LumberjackLevel.Warning, - 'critical', - 'debug', - 'error', - 'info', - 'trace', - 'warn', - ]; + const logLevels: LumberjackLogLevel[] = ['critical', 'debug', 'error', 'info', 'trace', 'warn']; logLevels.forEach((expectedLevel) => { it(`prefixes the message with log level "${expectedLevel}"`, () => { @@ -78,7 +64,7 @@ describe(lumberjackFormatLog.name, () => { it('adds the 0 hours UTC offset with milliseconds resolution', () => { const log: LumberjackLog = { createdAt: unixEpochTicks, - level: LumberjackLevel.Debug, + level: 'debug', message: 'Timestamp test', scope: 'Timestamp', }; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts index 63d6546d1..f1f47bf36 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts @@ -2,8 +2,7 @@ import { TestBed } from '@angular/core/testing'; import { FakeTimeService } from '@internal/test-util'; -import { LumberjackLevel } from '../logs/lumberjack-level'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackLog } from '../logs/lumberjack.log'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -14,12 +13,7 @@ interface TestPayload extends LumberjackLogPayload { testProperty: string; } -const lumberjackLogLevels: (LumberjackLogLevel | LogLevel)[] = [ - LumberjackLevel.Critical, - LumberjackLevel.Error, - 'critical', - 'error', -]; +const lumberjackLogLevels: LumberjackLogLevel[] = ['critical', 'error']; describe(LumberjackLogBuilder.name, () => { const testMessage = 'Test Message'; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts index 7bd3b0425..ccc07da9c 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts @@ -1,4 +1,4 @@ -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackLog } from '../logs/lumberjack.log'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -18,7 +18,7 @@ export class LumberjackLogBuilder { const testMessage = 'Test Message'; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts index e00be83fb..362d54998 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts @@ -1,4 +1,4 @@ -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -9,13 +9,13 @@ export class LumberjackLoggerBuilder; readonly #time: LumberjackTimeService; - readonly #level: LumberjackLogLevel | LogLevel; + readonly #level: LumberjackLogLevel; readonly #message: string; constructor( lumberjack: LumberjackService, time: LumberjackTimeService, - level: LumberjackLogLevel | LogLevel, + level: LumberjackLogLevel, message: string ) { this.#lumberjack = lumberjack; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts index d443ce116..2d25029b1 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts @@ -1,6 +1,6 @@ import { inject, Injectable } from '@angular/core'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -65,10 +65,7 @@ export abstract class LumberjackLogger { + protected createLoggerBuilder(level: LumberjackLogLevel, message: string): LumberjackLoggerBuilder { return new LumberjackLoggerBuilder(this.lumberjack, this.time, level, message); } } diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts index b45886cd7..4fd4430fd 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts @@ -6,7 +6,7 @@ import { LumberjackLogDriver } from '../log-drivers/lumberjack-log-driver'; import { LumberjackLogDriverError } from '../log-drivers/lumberjack-log-driver-error'; import { LumberjackLogDriverLogger } from '../log-drivers/lumberjack-log-driver-logger'; import { lumberjackLogDriverToken } from '../log-drivers/lumberjack-log-driver.token'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackLog } from '../logs/lumberjack.log'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -167,9 +167,9 @@ export class LumberjackService, logLevel: LumberjackLogLevel | LogLevel): boolean { + #canDriveLog(driver: LumberjackLogDriver, logLevel: LumberjackLogLevel): boolean { const hasVerboseLogging = driver.config.levels.length === 1 && driver.config.levels[0] === 'verbose'; - const acceptsLogLevel = (driver.config.levels as (LumberjackLogLevel | LogLevel)[]).includes(logLevel); + const acceptsLogLevel = (driver.config.levels as LumberjackLogLevel[]).includes(logLevel); return hasVerboseLogging || acceptsLogLevel; } diff --git a/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts b/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts index 8c8e2ae91..9171d4973 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts @@ -1,6 +1,6 @@ import { inject, Injectable } from '@angular/core'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -31,7 +31,7 @@ export abstract class ScopedLumberjackLogger< * specified log level and message. */ protected override createLoggerBuilder( - level: LumberjackLogLevel | LogLevel, + level: LumberjackLogLevel, message: string ): LumberjackLoggerBuilder { return new LumberjackLoggerBuilder(this.lumberjack, this.time, level, message).withScope(this.scope); diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts index 858584405..ef6ca5252 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts @@ -1,23 +1,13 @@ -import { Level, LumberjackLevel } from './lumberjack-level'; -import { LogLevel, LumberjackLogLevel } from './lumberjack-log-level'; +import { LumberjackLevel } from './lumberjack-level'; +import { LumberjackLogLevel } from './lumberjack-log-level'; /** * A set of Levels used to configure a log driver. Lumberjack filters logs * passed to the log driver based on its configured log levels. * - * @deprecated use `ConfigLevels` instead. Enums will be removed in Lumberjack 19 in favor of string literal types. - */ -export type LumberjackConfigLevels = LumberjackLogLevel[] | [LumberjackLevel.Verbose]; - -/** - * A set of Levels used to configure a log driver. Lumberjack filters logs - * passed to the log driver based on its configured log levels. - * - * We recommend aliasing `ConfigLevels` to `LumberjackConfigLevels`. This will be the final name after removing enum based levels. - * * @example * ```typescript - * import { ConfigLevels as LumberjackConfigLevels } from '@ngworker/lumberjack'; + * import { LumberjackConfigLevels } from '@ngworker/lumberjack'; * ``` */ -export type ConfigLevels = LogLevel[] | [Extract]; +export type LumberjackConfigLevels = LumberjackLogLevel[] | [Extract]; diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts index 4c5d1a015..32c40cf48 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts @@ -1,27 +1,9 @@ /** * All supported levels supported by Lumberjack. Used to specify the severity of a log and to configure Lumberjack and the log drivers. * - * @deprecated use `Level` instead. Enums will be removed in Lumberjack 19 in favor of string literal types. - * - */ -export enum LumberjackLevel { - Critical = 'critical', - Debug = 'debug', - Error = 'error', - Info = 'info', - Trace = 'trace', - Verbose = 'verbose', - Warning = 'warn', -} - -/** - * All supported levels supported by Lumberjack. Used to specify the severity of a log and to configure Lumberjack and the log drivers. - * - * We recommend aliasing `Level` to `LumberjackLevel`. This will be the final name after removing enum based levels. - * * @example * ```typescript - * import { Level as LumberjackLevel } from '@ngworker/lumberjack'; + * import { LumberjackLevel } from '@ngworker/lumberjack'; * ``` */ -export type Level = 'critical' | 'debug' | 'error' | 'info' | 'trace' | 'verbose' | 'warn'; +export type LumberjackLevel = 'critical' | 'debug' | 'error' | 'info' | 'trace' | 'verbose' | 'warn'; diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts index 942b1fa58..131b7033e 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts @@ -1,20 +1,11 @@ -import { Level, LumberjackLevel } from './lumberjack-level'; +import { LumberjackLevel } from './lumberjack-level'; /** * Level used to represent severity of a log. * - * @deprecated use `LogLevel` instead. Enums will be removed in Lumberjack 19 in favor of string literal types. - */ -export type LumberjackLogLevel = Exclude; - -/** - * Level used to represent severity of a log. - * - * We recommend aliasing `LogLevel` to `LumberjackLogLevel`. This will be the final name after removing enum based levels. - * * @example * ```typescript - * import { LogLevel as LumberjackLogLevel } from '@ngworker/lumberjack'; + * import { LumberjackLogLevel } from '@ngworker/lumberjack'; * ``` */ -export type LogLevel = Exclude; +export type LumberjackLogLevel = Exclude; diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts index e99446125..fa7b17b96 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts @@ -1,4 +1,4 @@ -import { LogLevel, LumberjackLogLevel } from './lumberjack-log-level'; +import { LumberjackLogLevel } from './lumberjack-log-level'; import { LumberjackLogPayload } from './lumberjack-log-payload'; /** @@ -12,7 +12,7 @@ export interface LumberjackLog { describe('Interfaces', () => { @@ -33,36 +22,10 @@ describe('Logs API', () => { expect(value).toBeDefined(); }); - it('exposes ConfigLevels', () => { - const value: ConfigLevels = []; - - expect(value).toBeDefined(); - }); - it('exposes LumberjackLogLevel', () => { const value: LumberjackLogLevel | undefined = undefined; expect(value).toBeUndefined(); }); - - it('exposes LogLevel', () => { - const value: LogLevel | undefined = undefined; - - expect(value).toBeUndefined(); - }); - - it('exposes Level', () => { - const value: Level | undefined = undefined; - - expect(value).toBeUndefined(); - }); - }); - - describe('Enums', () => { - it('exposes LumberjackLevel', () => { - const sut = LumberjackLevel; - - expect(isObject(sut)).toBeTruthy(); - }); }); }); From 06a00ac6a4f92ce7eab570837ca4f8eec443c724 Mon Sep 17 00:00:00 2001 From: Nacho Vazquez Date: Thu, 28 Nov 2024 00:34:56 -0300 Subject: [PATCH 2/6] fix: coverage and report generation --- nx.json | 3 +-- packages/examples/lumberjack-app/project.json | 13 ++++++++++++- .../internal/console-driver/test-util/project.json | 9 ++++++--- packages/internal/test-util/project.json | 9 ++++++--- packages/ngworker/lumberjack/project.json | 9 ++++++--- sonar-project.properties | 2 +- 6 files changed, 32 insertions(+), 13 deletions(-) diff --git a/nx.json b/nx.json index b1c8ed63d..16e25ac33 100644 --- a/nx.json +++ b/nx.json @@ -30,8 +30,7 @@ }, "@nx/eslint:lint": { "inputs": ["default", "{workspaceRoot}/.eslintrc.json"], - "cache": true, - "outputs": ["{options.outputFile}"] + "cache": true }, "@angular-devkit/build-angular:application": { "cache": true, diff --git a/packages/examples/lumberjack-app/project.json b/packages/examples/lumberjack-app/project.json index 5ada54d49..05b9e7efd 100644 --- a/packages/examples/lumberjack-app/project.json +++ b/packages/examples/lumberjack-app/project.json @@ -88,7 +88,8 @@ "coverageReporters": ["lcovonly", "text-summary"], "coverage": true } - } + }, + "defaultConfiguration": "coverage" }, "serve-static": { "executor": "@nx/web:file-server", @@ -98,6 +99,16 @@ "staticFilePath": "dist/packages/examples/lumberjack-app/browser", "spa": true } + }, + "lint": { + "outputs": ["{workspaceRoot}/reports/packages/examples/lumberjack-app/lint/report.json"], + "configurations": { + "report": { + "format": "json", + "output-file": "../../../reports/packages/examples/lumberjack-app/lint/report.json" + } + }, + "defaultConfiguration": "report" } } } diff --git a/packages/internal/console-driver/test-util/project.json b/packages/internal/console-driver/test-util/project.json index 00c6aaede..1d56e8e46 100644 --- a/packages/internal/console-driver/test-util/project.json +++ b/packages/internal/console-driver/test-util/project.json @@ -21,15 +21,18 @@ "coverageReporters": ["lcovonly", "text-summary"], "coverage": true } - } + }, + "defaultConfiguration": "coverage" }, "lint": { + "outputs": ["{workspaceRoot}/reports/packages/internal/console-driver/test-util/lint/report.json"], "configurations": { "report": { "format": "json", - "output-file": "reports/packages/internal/console-driver/test-util/lint/report.json" + "output-file": "../../../../reports/packages/internal/console-driver/test-util/lint/report.json" } - } + }, + "defaultConfiguration": "report" } } } diff --git a/packages/internal/test-util/project.json b/packages/internal/test-util/project.json index 1eed2e15c..17d5d9d1e 100644 --- a/packages/internal/test-util/project.json +++ b/packages/internal/test-util/project.json @@ -21,15 +21,18 @@ "coverageReporters": ["lcovonly", "text-summary"], "coverage": true } - } + }, + "defaultConfiguration": "coverage" }, "lint": { + "outputs": ["{workspaceRoot}/reports/packages/internal/test-util/lint/report.json"], "configurations": { "report": { "format": "json", - "output-file": "reports/packages/internal/test-util/lint/report.json" + "output-file": "../../../reports/packages/internal/test-util/lint/report.json" } - } + }, + "defaultConfiguration": "report" } } } diff --git a/packages/ngworker/lumberjack/project.json b/packages/ngworker/lumberjack/project.json index 9f30c6e55..799457b8a 100644 --- a/packages/ngworker/lumberjack/project.json +++ b/packages/ngworker/lumberjack/project.json @@ -68,15 +68,18 @@ "coverageReporters": ["lcovonly", "text-summary"], "coverage": true } - } + }, + "defaultConfiguration": "coverage" }, "lint": { + "outputs": ["{workspaceRoot}/reports/packages/ngworker/lumberjack/lint/report.json"], "configurations": { "report": { "format": "json", - "output-file": "reports/packages/ngworker/lumberjack/lint/report.json" + "output-file": "../../../reports/packages/ngworker/lumberjack/lint/report.json" } - } + }, + "defaultConfiguration": "report" }, "version": { "dependsOn": ["build"], diff --git a/sonar-project.properties b/sonar-project.properties index 5da6b3597..e2d326e93 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ # Project sonar.organization=ngworker sonar.projectKey=ngworker_lumberjack -sonar.projectVersion=15.x +sonar.projectVersion=19.x # display name sonar.projectName=lumberjack From c6c92892da0c028ce3af8da140bc4f0c72a133cd Mon Sep 17 00:00:00 2001 From: Nacho Vazquez Date: Thu, 28 Nov 2024 01:48:40 -0300 Subject: [PATCH 3/6] fix: jest coverage reporters --- packages/examples/lumberjack-app/jest.config.ts | 1 + packages/examples/lumberjack-app/project.json | 7 +------ packages/examples/lumberjack-app/src/test-setup.ts | 4 +++- packages/internal/console-driver/test-util/jest.config.ts | 1 + packages/internal/console-driver/test-util/project.json | 7 +------ .../internal/console-driver/test-util/src/test-setup.ts | 4 +++- packages/internal/test-util/jest.config.ts | 1 + packages/internal/test-util/project.json | 7 +------ packages/internal/test-util/src/test-setup.ts | 4 +++- packages/ngworker/lumberjack/jest.config.ts | 1 + packages/ngworker/lumberjack/project.json | 7 +------ packages/ngworker/lumberjack/src/test-setup.ts | 4 +++- 12 files changed, 20 insertions(+), 28 deletions(-) diff --git a/packages/examples/lumberjack-app/jest.config.ts b/packages/examples/lumberjack-app/jest.config.ts index 463ded316..d70c2cb4a 100644 --- a/packages/examples/lumberjack-app/jest.config.ts +++ b/packages/examples/lumberjack-app/jest.config.ts @@ -4,6 +4,7 @@ export default { preset: '../../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], globals: {}, + coverageReporters: ['lcovonly', 'text-summary'], coverageDirectory: '../../../coverage/packages/examples/lumberjack-app', transform: { '^.+\\.(ts|mjs|js|html)$': [ diff --git a/packages/examples/lumberjack-app/project.json b/packages/examples/lumberjack-app/project.json index 05b9e7efd..16c8ee64f 100644 --- a/packages/examples/lumberjack-app/project.json +++ b/packages/examples/lumberjack-app/project.json @@ -82,14 +82,9 @@ "ci": { "ci": true, "coverage": true - }, - "coverage": { - "ci": true, - "coverageReporters": ["lcovonly", "text-summary"], - "coverage": true } }, - "defaultConfiguration": "coverage" + "defaultConfiguration": "ci" }, "serve-static": { "executor": "@nx/web:file-server", diff --git a/packages/examples/lumberjack-app/src/test-setup.ts b/packages/examples/lumberjack-app/src/test-setup.ts index 1100b3e8a..58c511e08 100644 --- a/packages/examples/lumberjack-app/src/test-setup.ts +++ b/packages/examples/lumberjack-app/src/test-setup.ts @@ -1 +1,3 @@ -import 'jest-preset-angular/setup-jest'; +import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; + +setupZoneTestEnv(); diff --git a/packages/internal/console-driver/test-util/jest.config.ts b/packages/internal/console-driver/test-util/jest.config.ts index b92b7d19e..fb7a2443a 100644 --- a/packages/internal/console-driver/test-util/jest.config.ts +++ b/packages/internal/console-driver/test-util/jest.config.ts @@ -4,6 +4,7 @@ export default { preset: '../../../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], globals: {}, + coverageReporters: ['lcovonly', 'text-summary'], coverageDirectory: '../../../../coverage/packages/internal/console-driver/test-util', transform: { '^.+\\.(ts|mjs|js|html)$': [ diff --git a/packages/internal/console-driver/test-util/project.json b/packages/internal/console-driver/test-util/project.json index 1d56e8e46..7182b6976 100644 --- a/packages/internal/console-driver/test-util/project.json +++ b/packages/internal/console-driver/test-util/project.json @@ -15,14 +15,9 @@ "ci": { "ci": true, "coverage": true - }, - "coverage": { - "ci": true, - "coverageReporters": ["lcovonly", "text-summary"], - "coverage": true } }, - "defaultConfiguration": "coverage" + "defaultConfiguration": "ci" }, "lint": { "outputs": ["{workspaceRoot}/reports/packages/internal/console-driver/test-util/lint/report.json"], diff --git a/packages/internal/console-driver/test-util/src/test-setup.ts b/packages/internal/console-driver/test-util/src/test-setup.ts index 1100b3e8a..58c511e08 100644 --- a/packages/internal/console-driver/test-util/src/test-setup.ts +++ b/packages/internal/console-driver/test-util/src/test-setup.ts @@ -1 +1,3 @@ -import 'jest-preset-angular/setup-jest'; +import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; + +setupZoneTestEnv(); diff --git a/packages/internal/test-util/jest.config.ts b/packages/internal/test-util/jest.config.ts index df6c0a138..bbe5fe317 100644 --- a/packages/internal/test-util/jest.config.ts +++ b/packages/internal/test-util/jest.config.ts @@ -4,6 +4,7 @@ export default { preset: '../../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], globals: {}, + coverageReporters: ['lcovonly', 'text-summary'], coverageDirectory: '../../../coverage/packages/internal/test-util', transform: { '^.+\\.(ts|mjs|js|html)$': [ diff --git a/packages/internal/test-util/project.json b/packages/internal/test-util/project.json index 17d5d9d1e..164403530 100644 --- a/packages/internal/test-util/project.json +++ b/packages/internal/test-util/project.json @@ -15,14 +15,9 @@ "ci": { "ci": true, "coverage": true - }, - "coverage": { - "ci": true, - "coverageReporters": ["lcovonly", "text-summary"], - "coverage": true } }, - "defaultConfiguration": "coverage" + "defaultConfiguration": "ci" }, "lint": { "outputs": ["{workspaceRoot}/reports/packages/internal/test-util/lint/report.json"], diff --git a/packages/internal/test-util/src/test-setup.ts b/packages/internal/test-util/src/test-setup.ts index 1100b3e8a..58c511e08 100644 --- a/packages/internal/test-util/src/test-setup.ts +++ b/packages/internal/test-util/src/test-setup.ts @@ -1 +1,3 @@ -import 'jest-preset-angular/setup-jest'; +import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; + +setupZoneTestEnv(); diff --git a/packages/ngworker/lumberjack/jest.config.ts b/packages/ngworker/lumberjack/jest.config.ts index 2a6368f28..20b71191e 100644 --- a/packages/ngworker/lumberjack/jest.config.ts +++ b/packages/ngworker/lumberjack/jest.config.ts @@ -4,6 +4,7 @@ export default { preset: '../../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], globals: {}, + coverageReporters: ['lcovonly', 'text-summary'], coverageDirectory: '../../../coverage/packages/ngworker/lumberjack', transform: { '^.+\\.(ts|mjs|js|html)$': [ diff --git a/packages/ngworker/lumberjack/project.json b/packages/ngworker/lumberjack/project.json index 799457b8a..a2e6f43fb 100644 --- a/packages/ngworker/lumberjack/project.json +++ b/packages/ngworker/lumberjack/project.json @@ -62,14 +62,9 @@ "ci": { "ci": true, "coverage": true - }, - "coverage": { - "ci": true, - "coverageReporters": ["lcovonly", "text-summary"], - "coverage": true } }, - "defaultConfiguration": "coverage" + "defaultConfiguration": "ci" }, "lint": { "outputs": ["{workspaceRoot}/reports/packages/ngworker/lumberjack/lint/report.json"], diff --git a/packages/ngworker/lumberjack/src/test-setup.ts b/packages/ngworker/lumberjack/src/test-setup.ts index 1100b3e8a..58c511e08 100644 --- a/packages/ngworker/lumberjack/src/test-setup.ts +++ b/packages/ngworker/lumberjack/src/test-setup.ts @@ -1 +1,3 @@ -import 'jest-preset-angular/setup-jest'; +import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; + +setupZoneTestEnv(); From ffd7ef494401ed1dd8bcb66fa13b0d9dc6f8f02d Mon Sep 17 00:00:00 2001 From: Nacho Vazquez Date: Thu, 28 Nov 2024 02:03:37 -0300 Subject: [PATCH 4/6] ci: run test with ci config --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 473147f64..9cc8c8826 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: - name: Run NX Commands run: | pnpm exec nx-cloud record -- nx format:check - pnpm exec nx affected -t lint test build e2e-ci + pnpm exec nx affected -t lint test:ci build e2e-ci sonarcloud: name: SonarCloud From 5d9348bd83dd2e7cb6a4a8d92f193bbce1ee3e17 Mon Sep 17 00:00:00 2001 From: Nacho Vazquez Date: Thu, 28 Nov 2024 02:12:04 -0300 Subject: [PATCH 5/6] ci: use the latest sonarcloud version --- .github/workflows/ci.yml | 7 +++---- packages/examples/lumberjack-app/project.json | 6 ++---- packages/internal/console-driver/test-util/project.json | 6 ++---- packages/internal/test-util/project.json | 6 ++---- packages/ngworker/lumberjack/project.json | 6 ++---- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cc8c8826..43ad6ddf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,6 @@ jobs: sonarcloud: name: SonarCloud - needs: main runs-on: ubuntu-latest permissions: id-token: write @@ -114,16 +113,16 @@ jobs: uses: ./.github/actions/setup # Uses the cache generated in the distributed step (Needed for the sonar eslint reports). - name: Lint with reports - run: pnpm exec nx run-many --all --target=lint --configuration=report --parallel=2 --max-warnings=0 + run: pnpm exec nx run-many --target=lint --configuration=report --parallel=2 --max-warnings=0 # Uses the cache generated in the distributed step (Needed for the sonar jest coverage reports). - name: Tests with coverage - run: pnpm exec nx run-many --all --target=test --configuration=coverage --parallel=1 --max-workers=2 + run: pnpm exec nx run-many --target=test --configuration=ci --parallel=1 --max-workers=2 - name: Configure Sonar report paths run: pnpm run configure-sonar-report-paths - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@v2.1.1 + uses: sonarsource/sonarcloud-github-action@v3.1.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/packages/examples/lumberjack-app/project.json b/packages/examples/lumberjack-app/project.json index 16c8ee64f..b1af82633 100644 --- a/packages/examples/lumberjack-app/project.json +++ b/packages/examples/lumberjack-app/project.json @@ -83,8 +83,7 @@ "ci": true, "coverage": true } - }, - "defaultConfiguration": "ci" + } }, "serve-static": { "executor": "@nx/web:file-server", @@ -102,8 +101,7 @@ "format": "json", "output-file": "../../../reports/packages/examples/lumberjack-app/lint/report.json" } - }, - "defaultConfiguration": "report" + } } } } diff --git a/packages/internal/console-driver/test-util/project.json b/packages/internal/console-driver/test-util/project.json index 7182b6976..a4023a45e 100644 --- a/packages/internal/console-driver/test-util/project.json +++ b/packages/internal/console-driver/test-util/project.json @@ -16,8 +16,7 @@ "ci": true, "coverage": true } - }, - "defaultConfiguration": "ci" + } }, "lint": { "outputs": ["{workspaceRoot}/reports/packages/internal/console-driver/test-util/lint/report.json"], @@ -26,8 +25,7 @@ "format": "json", "output-file": "../../../../reports/packages/internal/console-driver/test-util/lint/report.json" } - }, - "defaultConfiguration": "report" + } } } } diff --git a/packages/internal/test-util/project.json b/packages/internal/test-util/project.json index 164403530..b6915e703 100644 --- a/packages/internal/test-util/project.json +++ b/packages/internal/test-util/project.json @@ -16,8 +16,7 @@ "ci": true, "coverage": true } - }, - "defaultConfiguration": "ci" + } }, "lint": { "outputs": ["{workspaceRoot}/reports/packages/internal/test-util/lint/report.json"], @@ -26,8 +25,7 @@ "format": "json", "output-file": "../../../reports/packages/internal/test-util/lint/report.json" } - }, - "defaultConfiguration": "report" + } } } } diff --git a/packages/ngworker/lumberjack/project.json b/packages/ngworker/lumberjack/project.json index a2e6f43fb..9cfcf9f12 100644 --- a/packages/ngworker/lumberjack/project.json +++ b/packages/ngworker/lumberjack/project.json @@ -63,8 +63,7 @@ "ci": true, "coverage": true } - }, - "defaultConfiguration": "ci" + } }, "lint": { "outputs": ["{workspaceRoot}/reports/packages/ngworker/lumberjack/lint/report.json"], @@ -73,8 +72,7 @@ "format": "json", "output-file": "../../../reports/packages/ngworker/lumberjack/lint/report.json" } - }, - "defaultConfiguration": "report" + } }, "version": { "dependsOn": ["build"], From 098671e97c05ef590d84c15df56155f824b307dd Mon Sep 17 00:00:00 2001 From: Nacho Vazquez Date: Thu, 28 Nov 2024 02:18:09 -0300 Subject: [PATCH 6/6] fix: ignore test setup from sonar coverage --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index e2d326e93..38d27a55a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -23,7 +23,7 @@ sonar.tests=e2e,packages,tools sonar.test.inclusions=**/*.spec.ts # configure the files that should be ignored by code coverage calculations -sonar.coverage.exclusions=tools/scripts/**,packages/internal/**,**/jest.config.ts,**/test.ts,packages/**/main.ts,packages/**/polyfills.ts,**/babel.config.js,**/docusaurus.config.js,packages/docs/**/sidebars.js,e2e/**/*-e2e/**,packages/docs/*-app/** +sonar.coverage.exclusions=tools/scripts/**,packages/internal/**,**/jest.config.ts,**/test-setup.ts,**/test.ts,packages/**/main.ts,packages/**/polyfills.ts,**/babel.config.js,**/docusaurus.config.js,packages/docs/**/sidebars.js,e2e/**/*-e2e/**,packages/docs/*-app/** # configure the files that should be ignored by duplication detection sonar.cpd.exclusions=**/jest.config.ts,**/test.ts,packages/**/main.ts