mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
Merge branch 'jest-tests' into 'develop'
Jest tests See merge request framasoft/framadate/funky-framadate-front!29
This commit is contained in:
commit
eee1832e64
@ -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
|
||||||
|
- e2e
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
|
||||||
|
test:
|
||||||
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npm run build
|
- npm i
|
||||||
|
- pkill Xvfb
|
||||||
|
- npm run test
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- dist/
|
- coverage/
|
||||||
test:
|
|
||||||
image: node:12
|
e2e:
|
||||||
type: test
|
stage: e2e
|
||||||
before_script:
|
|
||||||
- npm ci
|
|
||||||
script:
|
script:
|
||||||
- npm run test
|
- 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
|
||||||
|
14
angular.json
14
angular.json
@ -89,20 +89,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"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",
|
|
||||||
"karmaConfig": "karma.conf.js",
|
|
||||||
"assets": [
|
|
||||||
"src/favicon.ico",
|
|
||||||
"src/assets"
|
|
||||||
],
|
|
||||||
"styles": [
|
|
||||||
"src/styles.scss"
|
|
||||||
],
|
|
||||||
"scripts": []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
|
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"],
|
"files": ["test.ts", "polyfills.ts"],
|
||||||
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
|
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user