Skip to content

Commit

Permalink
Merge branch 'master' into feat/21639/annotation-lsp-enhancement-manu…
Browse files Browse the repository at this point in the history
…al-tests
  • Loading branch information
vadson71 committed Jun 26, 2023
2 parents 0d40827 + 59b39a8 commit 656f1d0
Show file tree
Hide file tree
Showing 636 changed files with 27,372 additions and 7,025 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ jobs:
with:
cmd: ci # will run `yarn run ci` command

- name: Run SonarCloud scan
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_PAT }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Upload vsix artifact
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '14.x' && github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: vscode-extension-file
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bower_components
build/Release

# Dependency directories
node_modules/
node_modules
jspm_packages/

# TypeScript v1 declaration files
Expand Down Expand Up @@ -97,3 +97,7 @@ test-packages/test-utils/.model-cache

# MacOS cache
.DS_Store

# Test reports
junit-report.xml
test-report.xml
120 changes: 110 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,135 @@
{
"type": "node",
"request": "launch",
"name": "context: run current file",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": ["${fileBasenameNoExtension}"],
"name": "Context: Run Current Jest File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--coverage=false",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${workspaceFolder}/packages/context"
},
{
"type": "node",
"request": "launch",
"name": "fe: run current file",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": ["${fileBasenameNoExtension}"],
"name": "Language Server: Run Current Jest File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--coverage=false",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"cwd": "${workspaceFolder}/packages/fe"
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${workspaceFolder}/packages/language-server"
},
{
"type": "node",
"request": "launch",
"name": "Extension: Run Current Jest File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--coverage=false",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${workspaceFolder}/packages/vscode-ui5-language-assistant"
},
{
"type": "node",
"request": "launch",
"name": "semantic-model: run current file",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": ["${fileBasenameNoExtension}"],
"name": "XML validation: Run Current Jest File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--coverage=false",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${workspaceFolder}/packages/xml-views-validation"
},
{
"type": "node",
"request": "launch",
"name": "Logic Utils: Run Current Jest File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--coverage=false",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${workspaceFolder}/packages/logic-utils"
},
{
"type": "node",
"request": "launch",
"name": "Semantic Model: Run Current Jest File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--coverage=false",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${workspaceFolder}/packages/semantic-model"
},
{
"type": "node",
"request": "launch",
"name": "Annotations Module (FE): Run Current Jest File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--coverage=false",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
},
"cwd": "${workspaceFolder}/packages/fe"
}
]
}
5 changes: 1 addition & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"files.watcherExclude": {
"**/node_modules/*/**": false,
"**/node_modules/[!@]*/**/*": true
}
"files.watcherExclude": {}
}
16 changes: 7 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,13 @@ use the top level scripts to avoid forgetting to (re-)compile a sub-package's de

### Testing

[Mocha][mocha] is used for unit-testing and [Istanbul/Nyc][istanbul] for coverage reports.
Jest was avoided due to increased total tests execution time due to running the tests in multiple processes,
as the Parser initialization (which happens once per process) can take 10-20ms.
[Jest][jest] is used for unit-testing and coverage reports and [Istanbul/Nyc][istanbul] is used to collect integrated coverage report.

[mocha]: https://mochajs.org/
[jest]: https://jestjs.io/
[istanbul]: https://istanbul.js.org/

- To run the tests run `yarn test` in either the top level package or a specific subpackage.
- To run the tests with a coverage report run `yarn coverage:run` in either the top level package or a specific subpackage.
- To run the tests with a coverage report run `yarn coverage` in either the top level package or a specific subpackage.

#### Debugging

Expand All @@ -75,7 +73,7 @@ Open the `package.json` file of the package and debug the `test` script. It will

**In VS Code:**

To debug tests in VS Code, in the root [`launch.json`](./.vscode/launch.json) file, add a `Node.js: Mocha Tests` configuration by using code assist.
To debug tests in VS Code, in the root [`launch.json`](./.vscode/launch.json) file, add a `Node.js: Jest Tests` configuration by using code assist.
Change the following in the added configuration:

- Change `tdd` to `bdd` under the `args` property
Expand All @@ -88,8 +86,8 @@ The result should look similar to this:
{
"type": "node",
"request": "launch",
"name": "language-server Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"name": "language-server Jest Tests",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"-u",
"bdd",
Expand All @@ -108,7 +106,7 @@ When running this launch configuration in VS Code, it will stop on breakpoints y

### Test Coverage

100%\* Test Coverage is enforced for all productive code in this mono repo.
At least 90%\* Test Coverage is enforced for all productive code in this mono repo.

- Specific statements/functions may be [excluded][ignore_coverage] from the report but the reason for that must
specified in the source code.
Expand Down
55 changes: 55 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const { join } = require("path");

module.exports = {
preset: "ts-jest",
testEnvironment: "node",
automock: false,
errorOnDeprecated: true,
notify: false,
notifyMode: "failure",
verbose: true,
testMatch: ["**/unit/**/?(*.)+(test).ts"],
transform: {
"^.+\\.ts?$": "ts-jest",
},
collectCoverage: true,
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
collectCoverageFrom: ["src/**/*.{ts,tsx}"],
coverageDirectory: "reports/test/unit/coverage",
coverageThreshold: {
global: {
branches: 90,
functions: 90,
lines: 90,
statements: 90,
},
},

modulePathIgnorePatterns: [
"<rootDir>/dist/",
"<rootDir>/node_modules/",
"<rootDir>/test/unit/samples/",
"<rootDir>/test/int/test-data/",
"<rootDir>/test/int/test-data-copy/",
],
testPathIgnorePatterns: [
"<rootDir>/node_modules/",
"<rootDir>/dist/",
"<rootDir>/lib/",
],
transformIgnorePatterns: ["<rootDir>/node_modules/", "/node_modules/"],
reporters: [
"default",
[
"jest-sonar",
{
reportedFilePath: "relative",
relativeRootDir: "<rootDir>/../../../",
},
],
],
setupFilesAfterEnv: ["../../jest.setup.js"],
};
5 changes: 5 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jest.setTimeout(120000); // 2 min

// add all jest-extended matchers
const matchers = require("jest-extended");
expect.extend(matchers);
8 changes: 4 additions & 4 deletions packages/nyc.config.js → nyc.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
"check-coverage": true,
all: true,
// https://reflectoring.io/100-percent-test-coverage/
branches: 100,
lines: 100,
functions: 100,
statements: 100,
branches: 95,
lines: 95,
functions: 95,
statements: 95,
};
24 changes: 19 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
"@types/chai": "4.2.14",
"@types/deep-equal-in-any-order": "1.0.1",
"@types/fs-extra": "9.0.11",
"@types/jest": "29.2.6",
"@types/jest-specific-snapshot": "0.5.5",
"@types/klaw-sync": "6.0.0",
"@types/lodash": "4.14.166",
"@types/mocha": "9.1.1",
"@types/rimraf": "3.0.0",
"@types/sinon": "9.0.10",
"@types/sinon-chai": "3.2.5",
Expand All @@ -64,22 +65,30 @@
"glob": "7.1.6",
"husky": "8.0.1",
"i18next": "19.0.2",
"jest": "29.5.0",
"jest-config": "29.5.0",
"jest-environment-node": "29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-esm-transformer": "1.0.0",
"jest-extended": "3.2.3",
"jest-junit": "15.0.0",
"jest-sonar": "0.2.16",
"jest-specific-snapshot": "3.0.0",
"klaw-sync": "6.0.0",
"lerna": "6.0.3",
"lint-staged": "10.5.3",
"make-dir": "3.1.0",
"mocha": "10.0.0",
"mock-fs": "^5.2.0",
"npm-run-all": "4.1.5",
"nyc": "15.1.0",
"prettier": "2.8.7",
"rimraf": "3.0.2",
"shx": "0.3.3",
"simple-git": "3.12.0",
"sinon": "9.2.3",
"sinon-chai": "3.5.0",
"ts-jest": "29.0.5",
"ts-node": "8.5.2",
"source-map-support": "0.5.19",
"typescript": "3.9.7",
"typescript": "4.9.4",
"esbuild": "0.17.12"
},
"lint-staged": {
Expand All @@ -99,5 +108,10 @@
"extends": [
"@commitlint/config-conventional"
]
},
"jest": {
"setupFilesAfterEnv": [
"jest-extended/all"
]
}
}
7 changes: 7 additions & 0 deletions packages/binding-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @ui5-language-assistant/binding-parser

## 1.0.1

### Patch Changes

- d8b77af: Provide a minimal code completion and syntax check for property binding info
15 changes: 15 additions & 0 deletions packages/binding-parser/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { join } = require("path");
const defaultConfig = require("../../jest.config");

module.exports = {
...defaultConfig,
globals: {
"ts-jest": {
tsconfig: join(__dirname, "tsconfig-test.json"),
diagnostics: {
// warnOnly: true,
exclude: /\.(spec|test)\.ts$/,
},
},
},
};

0 comments on commit 656f1d0

Please sign in to comment.