Skip to content

Commit

Permalink
test: remove E2E tests (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFaucherre authored Nov 20, 2023
1 parent c54eb0c commit cbda711
Show file tree
Hide file tree
Showing 62 changed files with 5,923 additions and 8,877 deletions.
37 changes: 0 additions & 37 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ commands:
app-dir: ~/project/editors/vscode
pkg-manager: yarn

install-e2e-tests-deps:
steps:
- node/install-packages:
app-dir: ~/project
pkg-manager: yarn

notify-success:
parameters:
title:
Expand Down Expand Up @@ -363,16 +357,9 @@ jobs:
node-version: '18'
- node/install-yarn
- install-vscode-extensions-deps
- install-e2e-tests-deps
- run:
name: Linter check for Go
command: if [[ $(gofmt -l pkg | wc -c) -ne 0 ]]; then exit 1; fi
- run:
name: Linter check for VSCE extension
command: cd editors/vscode && npm run lint-check
- run:
name: "Linter check for E2E test"
command: npm run lint:e2e

Lint PR title:
docker:
Expand Down Expand Up @@ -535,25 +522,6 @@ jobs:
monitor-on-build: false
project: '${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BRANCH}'

E2E Tests:
docker:
- image: cimg/node:18.16
environment:
RPC_SERVER_BIN: ~/project/bin/linux-amd64-lsp
PORT: 10001
parallelism: 5
steps:
- checkout
- attach_workspace:
at: ~/
- node/install-yarn
- install-e2e-tests-deps
- run:
name: Running tests
command: yarn test:e2e:ci
- store_test_results:
path: reports

Auto-assign PR:
docker:
- image: cimg/node:18.16
Expand Down Expand Up @@ -629,9 +597,6 @@ workflows:
filters:
branches:
only: *release-branches
- E2E Tests:
requires:
- Build Linux x86_64
- Pre-Release:
filters:
branches:
Expand All @@ -644,7 +609,6 @@ workflows:
- Build MacOS arm64
- Build Windows
- Copy JSON schema
- E2E Tests
context:
- devex-release
- Github Release:
Expand All @@ -661,7 +625,6 @@ workflows:
- Build MacOS arm64
- Build Windows
- Copy JSON schema
- E2E Tests
- Upload artifacts:
filters:
branches:
Expand Down
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .husky/hooks/pre-commit

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

74 changes: 0 additions & 74 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,77 +124,3 @@ task prepare:vscode
3. Next, open a VSCode instance at the root of the project, open the
`Run and Debug` tab and run it via the `Run Extension` on the dropdown menu
at the top of the tab.

## Running End-2-End tests

End-to-end tests are tests performed on a running LSP server.
Tests are written in typescript (using Jest) and located in the `e2e` folder.

### Prepare your environment
You can run E2E tests, you will need NodeJS (16+) installed in your environment.

Prepare the tests with the command:

```
task prepare:test:e2e
```

This command will install all NodeJS dependencies needed for the tests (see `e2e/package.json`).

### Run tests


(Re)-build the server binary using the command:
```
task build
```

You can now run the test at any time using the command:

```
task test:e2e
```

This will:
* start a LSP server on port 10001 (update `PORT` env variable to change this)
* run all tests in `e2e/src` folders
* close the LSP server

If you want your tests to reach a already running server, use the following command:
```
task test:e2e:standalone
```

You may have to set the `PORT`.

### Debug in VSCode
It is possible to easily debug tests in VSCode.

#### Scenario 1: debug tests

You can simply debug your tests by running the configuration "E2E tests" in the "run and debug" menu:
The debugger will stop on any breakpoints you will place in the `*.ts` file in the `e2e/` folder.

#### Scenario 2: debug LSP code

Run the two following configuration:
* `Start server`: this will start a LSP server on port 10001.
* `E2E tests (standalone)`: this will run the tests without spawning the LSP server. Tests will try to reach the LSP server on port 10001.

By running those two configuration simultaneously, you will be able to add breakpoints on both Go and `e2e/*.ts` files.

### Update snapshots

To update snapshots, run:

```
task test:e2e:update
```

Snapshots are located at `e2e/src/snapshots`.

### Related environment variables
* `SPAWN_LSP_SERVER`: (default: `yes`) If truthy, then the LSP server will be spawn for tests and stopped at the end. Accepted value: `true`, `false`, `on`, `off`, `yes`, `no`, `1`, `0`.
* `PORT` (default: 10001) Port where to reach (and spawn if requested) the LSP server
* `LSP_SERVER_HOST`: Default: `localhost`. Host address of the LSP server
* `RPC_SERVER_BIN`: Default: `bin/start_server`. Name of the binary to use if the LSP server spawn has been requested.
32 changes: 0 additions & 32 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ tasks:
lint:
cmds:
- task: lint:go
- task: lint:e2e

lint:e2e:
cmds:
- yarn lint:e2e

lint:go:
cmds:
Expand All @@ -90,38 +85,13 @@ tasks:
- yarn install --immutable
- yarn run build

prepare:test:e2e:
cmds:
- yarn install --immutable

test:
cmds:
- task: test:go

test:all:
cmds:
- task: test:go
- task: test:e2e

test:e2e:
env:
SPAWN_LSP_SERVER: '{{.SPAWN_LSP_SERVER | default true}}'
PORT: 10001
cmds:
- task: build
- yarn test:e2e {{.JEST_ARGS}}

test:e2e:update:
cmds:
- task: test:e2e
vars:
JEST_ARGS: --updateSnapshot

test:e2e:standalone:
cmds:
- task: test:e2e
vars:
SPAWN_LSP_SERVER: false

test:go:
cmds:
Expand All @@ -130,10 +100,8 @@ tasks:
validate:
desc: Run all necessary task to build, lint and test the project
deps:
- prepare:test:e2e
- prepare:vscode
cmds:
- task: lint
- task: build:all
- task: test
- task: test:e2e
18 changes: 0 additions & 18 deletions e2e/.env/CustomEvent.ts

This file was deleted.

Loading

0 comments on commit cbda711

Please sign in to comment.