-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrating from TSLint to ESLint and formatting with Prettier ad…
…ded pre-commit hook with Husky Signed-off-by: mdolhalo <[email protected]>
- Loading branch information
mdolhalo
committed
Aug 25, 2023
1 parent
4e5fa1f
commit a826903
Showing
86 changed files
with
11,046 additions
and
7,933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
cd tests/e2e && npm run lint && npm run prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
build | ||
**report | ||
**results** | ||
dist | ||
node-modules | ||
load** | ||
resources | ||
**/*.html | ||
**/**/*.sh | ||
index.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
/** ******************************************************************* | ||
* copyright (c) 2023 Red Hat, Inc. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
**********************************************************************/ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true | ||
}, | ||
extends: ['plugin:@typescript-eslint/recommended-type-checked', 'prettier'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
sourceType: 'module' | ||
}, | ||
plugins: ['eslint-plugin-jsdoc', '@typescript-eslint', '@typescript-eslint/tslint', 'header', 'prettier'], | ||
root: true, | ||
rules: { | ||
'prettier/prettier': 'error', | ||
'@typescript-eslint/dot-notation': 'error', | ||
'@typescript-eslint/no-misused-promises': [ | ||
'error', | ||
{ | ||
checksVoidReturn: { | ||
arguments: false | ||
} | ||
} | ||
], | ||
'@typescript-eslint/member-ordering': [ | ||
'error', | ||
{ | ||
classes: ['field', 'constructor', 'method'] | ||
} | ||
], | ||
'@typescript-eslint/explicit-function-return-type': [ | ||
'error', | ||
{ | ||
allowExpressions: false, | ||
allowTypedFunctionExpressions: false, | ||
allowHigherOrderFunctions: false, | ||
allowDirectConstAssertionInArrowFunctions: true, | ||
allowConciseArrowFunctionExpressionsStartingWithVoid: true | ||
} | ||
], | ||
'@typescript-eslint/explicit-module-boundary-types': [ | ||
'error', | ||
{ | ||
allowArgumentsExplicitlyTypedAsAny: true, | ||
allowDirectConstAssertionInArrowFunctions: true, | ||
allowHigherOrderFunctions: false, | ||
allowTypedFunctionExpressions: false | ||
} | ||
], | ||
'@typescript-eslint/member-delimiter-style': 'error', | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'variable', | ||
format: ['camelCase', 'UPPER_CASE'], | ||
leadingUnderscore: 'forbid', | ||
trailingUnderscore: 'forbid' | ||
} | ||
], | ||
'@typescript-eslint/no-empty-function': 'error', | ||
'@typescript-eslint/no-parameter-properties': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-enum-comparison': 'off', | ||
'@typescript-eslint/restrict-template-expressions': 'off', | ||
'@typescript-eslint/no-unsafe-return': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/restrict-plus-operands': 'off', | ||
'@typescript-eslint/no-namespace': 'off', | ||
'@typescript-eslint/no-unused-expressions': 'error', | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/no-use-before-define': 'error', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/quotes': ['error', 'single'], | ||
'@typescript-eslint/type-annotation-spacing': 'error', | ||
'@typescript-eslint/typedef': [ | ||
'error', | ||
{ | ||
parameter: true, | ||
propertyDeclaration: true, | ||
variableDeclaration: true, | ||
memberVariableDeclaration: true | ||
} | ||
], | ||
'brace-style': ['error', '1tbs'], | ||
'capitalized-comments': ['error', 'never'], | ||
'comma-dangle': ['error', 'never'], | ||
curly: 'error', | ||
'dot-notation': 'off', | ||
'eol-last': 'error', | ||
eqeqeq: ['error', 'smart'], | ||
'guard-for-in': 'error', | ||
'id-denylist': 'off', | ||
'id-match': 'off', | ||
indent: 'off', | ||
'jsdoc/check-alignment': 'error', | ||
'jsdoc/check-indentation': 'error', | ||
'max-len': [ | ||
'off', | ||
{ | ||
code: 140 | ||
} | ||
], | ||
'no-bitwise': 'error', | ||
'no-caller': 'error', | ||
'no-console': [ | ||
'error', | ||
{ | ||
allow: [ | ||
'log', | ||
'warn', | ||
'dir', | ||
'timeLog', | ||
'assert', | ||
'clear', | ||
'count', | ||
'countReset', | ||
'group', | ||
'groupEnd', | ||
'table', | ||
'dirxml', | ||
'error', | ||
'groupCollapsed', | ||
'Console', | ||
'profile', | ||
'profileEnd', | ||
'timeStamp', | ||
'context' | ||
] | ||
} | ||
], | ||
'header/header': [ | ||
'error', | ||
'block', | ||
[ | ||
'* *******************************************************************', | ||
{ pattern: ' \\* copyright \\(c\\) [0-9-]{4,9} Red Hat, Inc\\.', template: '* copyright (c) 2023 Red Hat, Inc.' }, | ||
' *', | ||
' * This program and the accompanying materials are made', | ||
' * available under the terms of the Eclipse Public License 2.0', | ||
' * which is available at https://www.eclipse.org/legal/epl-2.0/', | ||
' *', | ||
' * SPDX-License-Identifier: EPL-2.0', | ||
' *********************************************************************' | ||
] | ||
], | ||
'no-debugger': 'error', | ||
'no-empty': 'error', | ||
'no-empty-function': 'off', | ||
'no-eval': 'error', | ||
'no-fallthrough': 'error', | ||
'no-new-wrappers': 'error', | ||
'no-redeclare': 'error', | ||
'no-trailing-spaces': 'error', | ||
'no-underscore-dangle': 'off', | ||
'no-unused-expressions': 'off', | ||
'no-unused-labels': 'error', | ||
'no-unused-vars': 'off', | ||
'no-use-before-define': 'off', | ||
quotes: 'off', | ||
radix: 'error', | ||
semi: 'off', | ||
'spaced-comment': [ | ||
'error', | ||
'always', | ||
{ | ||
markers: ['/'] | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
build | ||
**report | ||
**results** | ||
dist | ||
node-modules | ||
load** | ||
resources | ||
**/*.html | ||
**/**/*.sh | ||
index.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"trailingComma": "none", | ||
"tabWidth": 4, | ||
"printWidth": 140, | ||
"semi": true, | ||
"singleQuote": true, | ||
"useTabs": true, | ||
"endOfLine": "lf", | ||
"jsxSingleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,87 @@ | ||
|
||
# Module for launch E2E tests related to Che 7 | ||
|
||
## Requirements | ||
|
||
- node 16.x | ||
- "Chrome" browser 114.x or later | ||
- deployed Che 7 with accessible URL | ||
- node 16.x | ||
- "Chrome" browser 114.x or later | ||
- deployed Che 7 with accessible URL | ||
|
||
## Before launch | ||
|
||
**Perform commands:** | ||
|
||
- ```export TS_SELENIUM_BASE_URL=<Che7 URL>``` | ||
- ```npm ci``` | ||
- `export TS_SELENIUM_BASE_URL=<Che7 URL>` | ||
- `npm ci` | ||
|
||
Note: If there is any modifications in package.json, manually execute the `npm install` to update the package-lock.json. So that errors can be avoided while executing npm ci | ||
|
||
## Default launch | ||
|
||
- Provide connection credentials: | ||
- ```export TS_SELENIUM_OCP_USERNAME=<username>``` | ||
- ```export TS_SELENIUM_OCP_PASSWORD=<password>``` | ||
- ```npm run test``` | ||
- Provide connection credentials: | ||
- `export TS_SELENIUM_OCP_USERNAME=<username>` | ||
- `export TS_SELENIUM_OCP_PASSWORD=<password>` | ||
- `npm run test` | ||
|
||
## Custom launch | ||
|
||
- Use environment variables which described in the "constants" folder | ||
- Use environment variables for setting timeouts if needed. You can see the list in **```'TimeoutConstants.ts'```**. You can see the list of those variables and their value if you set the ```'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'``` | ||
- To test one specification export file name as ```export USERSTORY=<spec-file-name-without-extension> && npm run test``` (example: ```-e USERSTORY=Quarkus```) | ||
- To run test without Selenium WebDriver (API tests etc.) use ```export USERSTORY=<spec-file-name-without-extension> && npm run driver-less-test``` (example: ```-e USERSTORY=CloneGitRepoAPI```) | ||
- This project support application testing deployed on Kubernetes or Openshift platform. Openshift is default value. To switch into Kubernetes, please, use `TS_PLATFORM=kubernetes` environmental variable and `TS_SELENIUM_K8S_PASSWORD`, `TS_SELENIUM_K8S_USERNAME` to provide credentials. The sample of test command in this case: | ||
``` | ||
export TS_PLATFORM=kubernetes && \ | ||
export TS_SELENIUM_K8S_USERNAME=<username> && \ | ||
export TS_SELENIUM_K8S_PASSWORD=<password> && \ | ||
export TS_SELENIUM_BASE_URL=<ingress-url> && \ | ||
npm run test | ||
``` | ||
Also, environmental variables can be set in files in "constants" folder. | ||
- Use environment variables which described in the "constants" folder | ||
- Use environment variables for setting timeouts if needed. You can see the list in **`'TimeoutConstants.ts'`**. You can see the list of those variables and their value if you set the `'TS_SELENIUM_PRINT_TIMEOUT_VARIABLES = true'` | ||
- To test one specification export file name as `export USERSTORY=<spec-file-name-without-extension> && npm run test` (example: `-e USERSTORY=Quarkus`) | ||
- To run test without Selenium WebDriver (API tests etc.) use `export USERSTORY=<spec-file-name-without-extension> && npm run driver-less-test` (example: `-e USERSTORY=CloneGitRepoAPI`) | ||
- This project support application testing deployed on Kubernetes or Openshift platform. Openshift is default value. To switch into Kubernetes, please, use `TS_PLATFORM=kubernetes` environmental variable and `TS_SELENIUM_K8S_PASSWORD`, `TS_SELENIUM_K8S_USERNAME` to provide credentials. The sample of test command in this case: | ||
``` | ||
export TS_PLATFORM=kubernetes && \ | ||
export TS_SELENIUM_K8S_USERNAME=<username> && \ | ||
export TS_SELENIUM_K8S_PASSWORD=<password> && \ | ||
export TS_SELENIUM_BASE_URL=<ingress-url> && \ | ||
npm run test | ||
``` | ||
Also, environmental variables can be set in files in "constants" folder. | ||
|
||
## Docker launch | ||
|
||
- open terminal and go to the "e2e" directory | ||
- export the ```"TS_SELENIUM_BASE_URL"``` variable with "Che" url | ||
- run command ```"npm run test-docker"``` | ||
- open terminal and go to the "e2e" directory | ||
- export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url | ||
- run command `"npm run test-docker"` | ||
|
||
## Docker launch with changed tests | ||
|
||
**For launching tests with local changes perform next steps:** | ||
|
||
- open terminal and go to the "e2e" directory | ||
- export the ```"TS_SELENIUM_BASE_URL"``` variable with "Che" url | ||
- run command ```"npm run test-docker-mount-e2e"``` | ||
- open terminal and go to the "e2e" directory | ||
- export the `"TS_SELENIUM_BASE_URL"` variable with "Che" url | ||
- run command `"npm run test-docker-mount-e2e"` | ||
|
||
## Debug docker launch | ||
|
||
The ```'eclipse/che-e2e'``` docker image has VNC server installed inside. For connecting use ```'0.0.0.0:5920'``` address. | ||
The `'eclipse/che-e2e'` docker image has VNC server installed inside. For connecting use `'0.0.0.0:5920'` address. | ||
|
||
## The "Happy Path" scenario launching | ||
|
||
**The easiest way to do that is to perform steps which are described in the "Docker launch" paragraph. | ||
For running tests without docker, please perform next steps:** | ||
|
||
- Deploy Che on Kubernetes infrastructure by using 'Minikube' and 'Chectl' <https://github.com/eclipse-che/che-server/blob/HEAD/deploy/kubernetes/README.md> | ||
- Create workspace by using 'Chectl' and devfile | ||
- link to 'Chectl' manual <https://github.com/che-incubator/chectl#chectl-workspacestart> | ||
- link to devfile ( **```For successfull test passing, exactly provided devfile should be used```** ) | ||
<https://gist.githubusercontent.com/Ohrimenko1988/93f5426f4ebc1705c55feb8ff0396a49/raw/cbea89ad145ba33ed34a151a12c50f045f9f3b78/yaml-ls-bug.yaml> | ||
- Provide the **```'TS_SELENIUM_BASE_URL'```** environment variable as described above | ||
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BaseTestConstants.ts) | ||
- perform command **```export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles```** | ||
- Deploy Che on Kubernetes infrastructure by using 'Minikube' and 'Chectl' <https://github.com/eclipse-che/che-server/blob/HEAD/deploy/kubernetes/README.md> | ||
- Create workspace by using 'Chectl' and devfile | ||
- link to 'Chectl' manual <https://github.com/che-incubator/chectl#chectl-workspacestart> | ||
- link to devfile ( **`For successfull test passing, exactly provided devfile should be used`** ) | ||
<https://gist.githubusercontent.com/Ohrimenko1988/93f5426f4ebc1705c55feb8ff0396a49/raw/cbea89ad145ba33ed34a151a12c50f045f9f3b78/yaml-ls-bug.yaml> | ||
- Provide the **`'TS_SELENIUM_BASE_URL'`** environment variable as described above | ||
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts) | ||
- perform command **`export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles`** | ||
|
||
## Launching the DevWorkspaceHappyPath spec file using Che with oauth authentication | ||
|
||
**Setup next environment variables:** | ||
|
||
- export TS_SELENIUM_BASE_URL=\<Che-URL\> | ||
- export TS_SELENIUM_OCP_USERNAME=\<cluster-username\> | ||
- export TS_SELENIUM_OCP_PASSWORD=\<cluster-password\> | ||
- export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH="true" | ||
- export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE=\<login-provide-title\> | ||
- export TS_SELENIUM_DEVWORKSPACE_URL=\<devworkspace-url\> | ||
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BaseTestConstants.ts) | ||
- export TS_SELENIUM_BASE_URL=\<Che-URL\> | ||
- export TS_SELENIUM_OCP_USERNAME=\<cluster-username\> | ||
- export TS_SELENIUM_OCP_PASSWORD=\<cluster-password\> | ||
- export TS_SELENIUM_VALUE_OPENSHIFT_OAUTH="true" | ||
- export TS_OCP_LOGIN_PAGE_PROVIDER_TITLE=\<login-provide-title\> | ||
- export TS_SELENIUM_DEVWORKSPACE_URL=\<devworkspace-url\> | ||
- export TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME=EmptyWorkspace (default value, see BASE_TEST_CONSTANTS.ts) | ||
|
||
**Execute the npm command:** | ||
- perform command ```export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles``` | ||
|
||
- perform command `export USERSTORY=$TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME && npm run test-all-devfiles` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.