mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
Jest tests
This commit is contained in:
parent
d9c325a0e9
commit
ca5ffdc896
@ -3,7 +3,7 @@ root = true
|
|||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_style = space
|
indent_style = tab
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
1
.eslintcache
Normal file
1
.eslintcache
Normal file
@ -0,0 +1 @@
|
|||||||
|
[{"/home/tykayn/funky-framadate-front/jest.config.js":"1","/home/tykayn/funky-framadate-front/karma.conf.js":"2"},{"size":167,"mtime":1586876658786,"results":"3","hashOfConfig":"4"},{"size":1581,"mtime":1586876658786,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1q0y9j9",{"filePath":"8","messages":"9","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/home/tykayn/funky-framadate-front/jest.config.js",[],"/home/tykayn/funky-framadate-front/karma.conf.js",["10"],{"ruleId":"11","severity":1,"message":"12","line":5,"column":18,"nodeType":"13","messageId":"14","endLine":5,"endColumn":35},"@typescript-eslint/explicit-function-return-type","Missing return type on function.","FunctionExpression","missingReturnType"]
|
@ -1,16 +1,39 @@
|
|||||||
build:
|
image: weboaks/node-karma-protractor-chrome
|
||||||
image: node:12
|
|
||||||
before_script:
|
stages:
|
||||||
- npm ci
|
- test
|
||||||
script:
|
- e2e
|
||||||
- npm run build
|
|
||||||
artifacts:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- dist/
|
- node_modules/
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: node:12
|
stage: test
|
||||||
type: test
|
script:
|
||||||
before_script:
|
- npm i
|
||||||
- npm ci
|
- pkill Xvfb
|
||||||
script:
|
- npm run test
|
||||||
- npm run test
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- coverage/
|
||||||
|
|
||||||
|
e2e:
|
||||||
|
stage: e2e
|
||||||
|
script:
|
||||||
|
- npm i
|
||||||
|
- pkill Xvfb
|
||||||
|
- npm run e2e
|
||||||
|
|
||||||
|
pages:
|
||||||
|
stage: .post
|
||||||
|
dependencies:
|
||||||
|
- test
|
||||||
|
script:
|
||||||
|
- mv coverage/ public/
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
expire_in: 30 days
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
258
angular.json
258
angular.json
@ -1,137 +1,125 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot": "projects",
|
||||||
"projects": {
|
"projects": {
|
||||||
"framadate": {
|
"framadate": {
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"schematics": {
|
"schematics": {
|
||||||
"@schematics/angular:component": {
|
"@schematics/angular:component": {
|
||||||
"style": "scss"
|
"style": "scss"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "",
|
"root": "",
|
||||||
"sourceRoot": "src",
|
"sourceRoot": "src",
|
||||||
"prefix": "framadate",
|
"prefix": "framadate",
|
||||||
"architect": {
|
"architect": {
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/framadate",
|
"outputPath": "dist/framadate",
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"main": "src/main.ts",
|
"main": "src/main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"aot": true,
|
"aot": true,
|
||||||
"assets": [
|
"assets": [
|
||||||
"src/favicon.ico",
|
"src/favicon.ico",
|
||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
"node_modules/primeicons/primeicons.css",
|
"node_modules/primeicons/primeicons.css",
|
||||||
"node_modules/font-awesome/css/font-awesome.css",
|
"node_modules/font-awesome/css/font-awesome.css",
|
||||||
"node_modules/primeng/resources/themes/nova-light/theme.css",
|
"node_modules/primeng/resources/themes/nova-light/theme.css",
|
||||||
"node_modules/primeng/resources/primeng.min.css",
|
"node_modules/primeng/resources/primeng.min.css",
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"node_modules/marked/lib/marked.js",
|
"node_modules/marked/lib/marked.js",
|
||||||
"node_modules/prismjs/prism.js",
|
"node_modules/prismjs/prism.js",
|
||||||
"node_modules/prismjs/components/prism-css.min.js"
|
"node_modules/prismjs/components/prism-css.min.js"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
{
|
{
|
||||||
"replace": "src/environments/environment.ts",
|
"replace": "src/environments/environment.ts",
|
||||||
"with": "src/environments/environment.prod.ts"
|
"with": "src/environments/environment.prod.ts"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"optimization": true,
|
"optimization": true,
|
||||||
"outputHashing": "all",
|
"outputHashing": "all",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"extractCss": true,
|
"extractCss": true,
|
||||||
"namedChunks": false,
|
"namedChunks": false,
|
||||||
"extractLicenses": true,
|
"extractLicenses": true,
|
||||||
"vendorChunk": false,
|
"vendorChunk": false,
|
||||||
"buildOptimizer": true,
|
"buildOptimizer": true,
|
||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "initial",
|
"type": "initial",
|
||||||
"maximumWarning": "2mb",
|
"maximumWarning": "2mb",
|
||||||
"maximumError": "5mb"
|
"maximumError": "5mb"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
"maximumWarning": "6kb",
|
"maximumWarning": "6kb",
|
||||||
"maximumError": "10kb"
|
"maximumError": "10kb"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
"options": {
|
"options": {
|
||||||
"browserTarget": "framadate:build"
|
"browserTarget": "framadate:build"
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"browserTarget": "framadate:build:production"
|
"browserTarget": "framadate:build:production"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n": {
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
"options": {
|
"options": {
|
||||||
"browserTarget": "framadate:build"
|
"browserTarget": "framadate:build"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"builder": "@angular-devkit/build-angular:karma",
|
"builder": "@angular-builders/jest:run",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "src/test.ts",
|
}
|
||||||
"polyfills": "src/polyfills.ts",
|
},
|
||||||
"tsConfig": "tsconfig.spec.json",
|
"lint": {
|
||||||
"karmaConfig": "karma.conf.js",
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
"assets": [
|
"options": {
|
||||||
"src/favicon.ico",
|
"tsConfig": [
|
||||||
"src/assets"
|
"tsconfig.app.json",
|
||||||
],
|
"tsconfig.spec.json",
|
||||||
"styles": [
|
"e2e/tsconfig.json"
|
||||||
"src/styles.scss"
|
],
|
||||||
],
|
"exclude": [
|
||||||
"scripts": []
|
"**/node_modules/**"
|
||||||
}
|
]
|
||||||
},
|
}
|
||||||
"lint": {
|
},
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"e2e": {
|
||||||
"options": {
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
"tsConfig": [
|
"options": {
|
||||||
"tsconfig.app.json",
|
"protractorConfig": "e2e/protractor.conf.js",
|
||||||
"tsconfig.spec.json",
|
"devServerTarget": "framadate:serve"
|
||||||
"e2e/tsconfig.json"
|
},
|
||||||
],
|
"configurations": {
|
||||||
"exclude": [
|
"production": {
|
||||||
"**/node_modules/**"
|
"devServerTarget": "framadate:serve:production"
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"e2e": {
|
}
|
||||||
"builder": "@angular-devkit/build-angular:protractor",
|
}
|
||||||
"options": {
|
},
|
||||||
"protractorConfig": "e2e/protractor.conf.js",
|
"defaultProject": "framadate"
|
||||||
"devServerTarget": "framadate:serve"
|
|
||||||
},
|
|
||||||
"configurations": {
|
|
||||||
"production": {
|
|
||||||
"devServerTarget": "framadate:serve:production"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultProject": "framadate"
|
|
||||||
}
|
}
|
||||||
|
7
jest.config.js
Normal file
7
jest.config.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// const { defaults } = require('jest-config');
|
||||||
|
//
|
||||||
|
// module.exports = {
|
||||||
|
// verbose: true,
|
||||||
|
// collectCoverage: true,
|
||||||
|
// collectCoverageFrom: ['src/**/*.ts'],
|
||||||
|
// };
|
@ -1,40 +0,0 @@
|
|||||||
// Karma configuration file, see link for more information
|
|
||||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
|
||||||
config.set({
|
|
||||||
basePath : '',
|
|
||||||
frameworks : ['jasmine', '@angular-devkit/build-angular'],
|
|
||||||
plugins : [
|
|
||||||
require('karma-jasmine'),
|
|
||||||
require('karma-chrome-launcher'),
|
|
||||||
require('karma-firefox-launcher'),
|
|
||||||
require('karma-phantomjs-launcher'),
|
|
||||||
require('karma-coverage'),
|
|
||||||
require('karma-jasmine-html-reporter'),
|
|
||||||
require('karma-coverage-istanbul-reporter'),
|
|
||||||
require('@angular-devkit/build-angular/plugins/karma'),
|
|
||||||
],
|
|
||||||
client : {
|
|
||||||
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
|
||||||
},
|
|
||||||
coverageIstanbulReporter: {
|
|
||||||
reports : ['html', 'lcovonly'],
|
|
||||||
fixWebpackSourcePaths: true,
|
|
||||||
thresholds : {
|
|
||||||
statements: 80,
|
|
||||||
lines : 80,
|
|
||||||
branches : 80,
|
|
||||||
functions : 80,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
reporters : ['progress', 'kjhtml'],
|
|
||||||
port : 9876,
|
|
||||||
colors : true,
|
|
||||||
logLevel : config.LOG_INFO,
|
|
||||||
autoWatch : true,
|
|
||||||
browsers : ['FirefoxHeadless'],
|
|
||||||
singleRun : true,
|
|
||||||
restartOnFileChange : true,
|
|
||||||
});
|
|
||||||
};
|
|
10
package.json
10
package.json
@ -11,7 +11,7 @@
|
|||||||
"bld:pkg": "npm run build && npm run package",
|
"bld:pkg": "npm run build && npm run package",
|
||||||
"build:demo": "ng build --crossOrigin=anonymous --extractCss=true --progress=true --prod && npm run package",
|
"build:demo": "ng build --crossOrigin=anonymous --extractCss=true --progress=true --prod && npm run package",
|
||||||
"build:demobliss": "ng build --crossOrigin=anonymous --extractCss=true --baseHref=https://framadate-api.cipherbliss.com --progress=true --prod && npm run package",
|
"build:demobliss": "ng build --crossOrigin=anonymous --extractCss=true --baseHref=https://framadate-api.cipherbliss.com --progress=true --prod && npm run package",
|
||||||
"test": "ng test --code-coverage --watch=false",
|
"test": "ng test --watch=false",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e",
|
"e2e": "ng e2e",
|
||||||
"format:check": "prettier --list-different \"src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}\"",
|
"format:check": "prettier --list-different \"src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}\"",
|
||||||
@ -55,6 +55,7 @@
|
|||||||
"zone.js": "^0.10.3"
|
"zone.js": "^0.10.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@angular-builders/jest": "^9.0.1",
|
||||||
"@angular-devkit/build-angular": "^0.901.1",
|
"@angular-devkit/build-angular": "^0.901.1",
|
||||||
"@angular/cli": "^9.0.7",
|
"@angular/cli": "^9.0.7",
|
||||||
"@angular/compiler-cli": "^9.1.1",
|
"@angular/compiler-cli": "^9.1.1",
|
||||||
@ -67,6 +68,7 @@
|
|||||||
"@storybook/angular": "^5.3.18",
|
"@storybook/angular": "^5.3.18",
|
||||||
"@types/jasmine": "^3.5.10",
|
"@types/jasmine": "^3.5.10",
|
||||||
"@types/jasminewd2": "~2.0.8",
|
"@types/jasminewd2": "~2.0.8",
|
||||||
|
"@types/jest": "^25.2.1",
|
||||||
"@types/node": "^13.11.1",
|
"@types/node": "^13.11.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
||||||
"@typescript-eslint/parser": "^2.27.0",
|
"@typescript-eslint/parser": "^2.27.0",
|
||||||
@ -78,11 +80,7 @@
|
|||||||
"husky": "^4.2.5",
|
"husky": "^4.2.5",
|
||||||
"jasmine-core": "~3.5.0",
|
"jasmine-core": "~3.5.0",
|
||||||
"jasmine-spec-reporter": "~5.0.1",
|
"jasmine-spec-reporter": "~5.0.1",
|
||||||
"karma": "^5.0.1",
|
"jest": "^25.3.0",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
|
||||||
"karma-coverage-istanbul-reporter": "~2.1.1",
|
|
||||||
"karma-jasmine": "~3.1.0",
|
|
||||||
"karma-jasmine-html-reporter": "^1.5.3",
|
|
||||||
"lint-staged": "^10.1.3",
|
"lint-staged": "^10.1.3",
|
||||||
"prettier": "^2.0.4",
|
"prettier": "^2.0.4",
|
||||||
"protractor": "~5.4.3",
|
"protractor": "~5.4.3",
|
||||||
|
14
src/test.ts
14
src/test.ts
@ -1,14 +0,0 @@
|
|||||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
||||||
|
|
||||||
import 'zone.js/dist/zone-testing';
|
|
||||||
import { getTestBed } from '@angular/core/testing';
|
|
||||||
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
|
||||||
|
|
||||||
declare const require: any;
|
|
||||||
|
|
||||||
// First, initialize the Angular testing environment.
|
|
||||||
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
|
|
||||||
// Then we find all the tests.
|
|
||||||
const context = require.context('./', true, /\.spec\.ts$/);
|
|
||||||
// And load the modules.
|
|
||||||
context.keys().map(context);
|
|
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./out-tsc/spec",
|
"outDir": "./public/out-tsc/spec",
|
||||||
"types": ["jasmine", "node"]
|
"module": "commonjs",
|
||||||
},
|
"types": ["jest"]
|
||||||
"files": ["src/test.ts", "src/polyfills.ts"],
|
},
|
||||||
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
|
"files": ["test.ts", "polyfills.ts"],
|
||||||
|
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user