Skip to content

Commit

Permalink
chore(all): aply remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
mhenkens committed Nov 27, 2023
1 parent 9174634 commit 8665528
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 129 deletions.
100 changes: 0 additions & 100 deletions karma-stark.conf.js

This file was deleted.

12 changes: 0 additions & 12 deletions karma.conf.ci.js

This file was deleted.

98 changes: 89 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,96 @@
const helpers = require("./helpers");
// Helpers
const helpers = require("./scripts/helpers");
const ciInfo = require("ci-info");
const isCI = process.argv.indexOf("--watch=false") > -1 || ciInfo.isCI;

/**
* Load karma config from Stark
*/
const defaultKarmaConfig = require("./karma-stark.conf.js").rawKarmaConfig;
const ngxFormErrorsSpecificConfiguration = {
// base path that will be used to resolve all patterns (e.g. files, exclude)
basePath: "",

// start customizing the KarmaCI configuration from stark-testing
const ngxFormErrorsSpecificConfiguration = Object.assign({}, defaultKarmaConfig);
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["jasmine", "@angular-devkit/build-angular"],

// list of files to exclude
exclude: [
helpers.root("src/index.html") // not needed for unit testing
],

client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},

plugins: [
// Default karma plugins configuration: require("karma-*")
"karma-*",
require("@angular-devkit/build-angular/plugins/karma")
],

// test results reporter to use
// possible values: "dots", "progress", "spec", "junit", "mocha", "coverage" (others if you import reporters)
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
// https://www.npmjs.com/package/karma-junit-reporter
// https://www.npmjs.com/package/karma-spec-reporter
reporters: isCI ? ["mocha", "progress"] : ["mocha", "progress", "kjhtml", "coverage"],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// see: http://karma-runner.github.io/2.0/config/configuration-file.html
// possible values:
// "OFF" = config.LOG_DISABLE
// "ERROR" = config.LOG_ERROR
// "WARN" = config.LOG_WARN
// "INFO" = config.LOG_INFO
// "DEBUG" = config.LOG_DEBUG
// raw value defined in node_modules/karma/lib/constants.js
logLevel: "WARN",

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: isCI ? ["ChromeHeadlessNoSandbox"] : ["Chrome"],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: isCI,

// If true, tests restart automatically if a file is changed
restartOnFileChange: !isCI,

// Timeout settings
browserNoActivityTimeout: 30000,
browserDisconnectTolerance: 1,
browserDisconnectTimeout: 30000,

// Configuration for coverage-istanbul reporter
coverageReporter: {
// base output directory. If you include %browser% in the path it will be replaced with the karma browser name
dir: helpers.root("reports/coverage"),
subdir: ".",
// https://github.com/istanbuljs/istanbuljs/tree/73c25ce79f91010d1ff073aa6ff3fd01114f90db/packages/istanbul-reports/lib
reporters: [{ type: "html" }, { type: "lcovonly" }, { type: "text-summary" }, { type: "clover" }, { type: "json" }]
},

// Custom launcher configuration for ChromeHeadless (with Puppeteer)
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
// necessary for travis: https://github.com/puppeteer/puppeteer/blob/v7.1.0/docs/troubleshooting.md#setting-up-chrome-linux-sandbox
// as it runs in a container-based environment
flags: ["--no-sandbox", "--disable-setuid-sandbox"]
}
}
};

// export the configuration function that karma expects and simply return the stark configuration
module.exports = {
default: function(config) {
default: function (config) {
return config.set(ngxFormErrorsSpecificConfiguration);
}
};
File renamed without changes.
1 change: 0 additions & 1 deletion src/directives/form-errors-group.directive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { Component, ViewChild } from "@angular/core";
import { ComponentFixture, fakeAsync, TestBed } from "@angular/core/testing";
import { NgxFormErrorsGroupDirective } from "./form-errors-group.directive";
Expand Down
5 changes: 1 addition & 4 deletions src/directives/form-errors.directive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { Component, ViewChild } from "@angular/core";
import { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from "@angular/forms";
import { ComponentFixture, fakeAsync, TestBed } from "@angular/core/testing";
Expand Down Expand Up @@ -113,9 +112,7 @@ describe("NgxFormErrorsDirective", () => {

@Component({
selector: "form-error",
template: `
<div>some content here</div>
`
template: ` <div>some content here</div> `
})
class FormErrorComponent implements NgxFormErrorComponent {
public errors$!: Observable<NgxFormFieldError[]>;
Expand Down
1 change: 0 additions & 1 deletion src/services/form-errors-message.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { NgxFormErrorsMessageService, NgxValidationErrorFieldNames, NgxValidationErrorMessages } from "./form-errors-message.service";

describe("NgxFormErrorsMessageService", () => {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"declarationDir": "AUTOGENERATED",
"inlineSourceMap": true
},
"exclude": ["node_modules", "dist", "demo-app", "**/*.spec.ts"]
/* "files": ["AUTOGENERATED"] */
"exclude": ["node_modules", "dist", "demo-app", "**/*.spec.ts"],
"files": ["AUTOGENERATED"]
}

0 comments on commit 8665528

Please sign in to comment.