Skip to content

Commit

Permalink
fix: random test failures
Browse files Browse the repository at this point in the history
Refactor of tests to more reliable, including being independent
of each other so if one test fails others are not effected.

Fix path to workspace files of "Language Server E2E Test" and
rename to "Run Extension Tests" to make it clear what its used
for.

Add mochaExplorer configuration, to improve test visibility.

Re-enable big groovy test file, now it works as expected.

Rename test files to eliminate suttering

Fix test debugging by using NPM_DEBUG instead of DEBUG env var
which is filtered out by vscode, see:
microsoft/vscode#197494.

Also:
* Update Node and JVM versions in README.md
* Update all packages, to address security issues and bring in
  the latest version of npm-groovy-lint
* Clean up imports
* Use onDidChangeContent to trigger re-linting to improve
  performance and remove skipNextOnDidChangeContents which
  conflicts with this change
* Eliminate else statements where previous block returns,
  to improve code readability
* Refactor resetDiagnostics into deleteDiagnostics as its now
  only used for the delete flow, so we can remove unnessary
  logic and diagnostic changes
* Remove commented out code
* Convert high noise debugging to trace
* Add missing await to docManager.updateDocumentSettings call
  • Loading branch information
stevenh committed Dec 11, 2023
1 parent e0c1251 commit cfe836d
Show file tree
Hide file tree
Showing 31 changed files with 4,536 additions and 1,822 deletions.
10 changes: 10 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
"ETIMEOUT",
"extglob",
"extsprintf",
"failon",
"favicon",
"fixrules",
"flattendeep",
"fontawesome",
"fromentries",
Expand All @@ -71,6 +73,8 @@
"imurmurhash",
"isexe",
"isstream",
"javaexecutable",
"javaoptions",
"javascripts",
"jdeploy",
"jenkinsfile",
Expand Down Expand Up @@ -100,6 +104,7 @@
"nashorn",
"Nashorn",
"njre",
"nolintafter",
"nonblock",
"notif",
"npmignore",
Expand All @@ -108,6 +113,7 @@
"nvuillam",
"OPENVSX",
"optionator",
"optns",
"ovsx",
"oxsecurity",
"paren",
Expand All @@ -124,15 +130,19 @@
"prototypejs",
"pymdownx",
"querystringify",
"QUICKFIX",
"quickstart",
"qunit",
"readdirp",
"readonly",
"regexpp",
"returnrules",
"rulesets",
"Rulesets",
"rulesetsoverridetype",
"Serv",
"serviceworker",
"sourcefilepath",
"sprintf",
"sshpk",
"stefanzweifel",
Expand Down
13 changes: 7 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,20 @@
"timeout": 60000
},
{
"name": "Language Server E2E Test",
"name": "Run Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/client/out/test",
"${workspaceRoot}/client/testFixture"
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/client/out/test/suite/index",
],
"env": {
"DEBUG": "vscode-groovy-lint,npm-groovy-lint"
"NPM_DEBUG": "vscode-groovy-lint,npm-groovy-lint"
},
"outFiles": ["${workspaceRoot}/client/out/test/**/*.js"],
"outFiles": ["${workspaceFolder}/client/out/test/**/*.js"],
"preLaunchTask": "npm: watch",
"smartStep": true,
"skipFiles": ["<node_internals>/**"]
},
Expand Down
14 changes: 13 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,17 @@
"editor.insertSpaces": false,
"tslint.enable": true,
"typescript.tsc.autoDetect": "off",
"typescript.preferences.quoteStyle": "single"
"typescript.preferences.quoteStyle": "single",
"mochaExplorer.launcherScript": "node_modules/mocha-explorer-launcher-scripts/vscode-test",
"mochaExplorer.autoload": false,
"mochaExplorer.ipcRole": "server",
"mochaExplorer.env": {
"VSCODE_VERSION": "stable",
"ELECTRON_RUN_AS_NODE": null
},
"mochaExplorer.ui":"tdd",
"mochaExplorer.files": "client/src/test/**/*.test.ts",
"mochaExplorer.require": "ts-node/register",
"mochaExplorer.logpanel": true,
"mochaExplorer.ipcTimeout": 10000
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ coverage/**
**/out/test/**
**/.github/**
src/**
**/*.js.map

client/node_modules/**/*.md
client/node_modules/**/AUTHORS
Expand Down
35 changes: 29 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
# CONTRIBUTE

Contributions are very welcome !
Contributions are very welcome!

- Fork the repo and clone it on your computer
- Open is with [Visual Studio Code Insiders Version](https://code.visualstudio.com/insiders/)
- To debug, launch debug configuration `Groovy Lint Debug`
- Once your code is ready, documented and linted, please create a [pull request](https://github.com/nvuillam/vscode-groovy-lint/pulls) :)
## Setup

If your updates are related to the linter and not its VsCode extension, please Contribute to [NPM Grovvy Lint](https://github.com/nvuillam/npm-groovy-lint/blob/master/CONTRIBUTING.md)
To contribute first [fork the repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
and [clone it](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
on your computer.

Now you can open it in with [Visual Studio Code](https://code.visualstudio.com/)
and make changes.

## Testing & Debugging

To test and debug the extension, launch the `Groovy Lint Debug`
[Run and Debug](https://code.visualstudio.com/docs/editor/debugging) configuration.

To debug the tests, launch the `Run Extension Tests`
[Run and Debug](https://code.visualstudio.com/docs/editor/debugging) configuration.

## Raise PR

Once your code is ready, documented and linted, raise a
[pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
with your changes [here](https://github.com/nvuillam/vscode-groovy-lint/pulls).

## NPM Groovy Lint

If your updates are related to the linter and not the
[Groovy Lint, Format and Fix Extension](https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-groovy-lint),
please [contribute to NPM Grovvy Lint](https://github.com/nvuillam/npm-groovy-lint/blob/main/CONTRIBUTING.md)
instead.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@

## Troubleshooting

- [**Node.js**](https://nodejs.org) version **12 or higher** is required to run this extension. If you can't upgrade, you can use [nvm](https://github.com/nvm-sh/nvm) to have [different node versions on your computer](https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/)
- [**Node.js**](https://nodejs.org) version **18 or higher** is required to run this extension. If you can't upgrade, you can use [nvm](https://github.com/nvm-sh/nvm) to have [different node versions on your computer](https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/)

- [**Java**](https://www.java.com/download) version **8 or higher** is required to run this extension
- [**Java**](https://www.java.com/download) version **17 or higher** is required to run this extension

- As CodeNarc is run in background with java/groovy, performances could be improved on large files (do not hesitate to provide advices !)
But do not worry, as the groovy linting is provided by a background local server, your VsCode won't be slowed.
Expand Down
Loading

0 comments on commit cfe836d

Please sign in to comment.