Skip to content

refactor: move integration tests to Jest #5275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d76d700
feat: add installExtension integration test
jsjoeio Jun 17, 2022
76b4e3c
refactor: s/ test:standalone with test:integration
jsjoeio Jun 17, 2022
7e19b73
refactor: filter unit tests
jsjoeio Jun 17, 2022
a956a41
refactor: add SKIP_SUBMODULE_DEPS to postinstall
jsjoeio Jun 17, 2022
f149e14
refactor: add SKIP_SUBMODULE_DEPS to postinstall
jsjoeio Jun 17, 2022
ada0fd3
fixup!: skip submod deps
jsjoeio Jun 17, 2022
880ac2a
refactor: move runCodeServerCommand into sep. file
jsjoeio Jun 17, 2022
566d29a
fizup: formatting
jsjoeio Jun 17, 2022
7c96c97
fizup: increase timeout
jsjoeio Jun 17, 2022
86d29eb
refactor: use fixture in installExtension test
jsjoeio Jun 22, 2022
acdb3a2
feat: add integration test for listExtensions
jsjoeio Jun 22, 2022
af300c6
chore: ignore integration fixtures
jsjoeio Jun 22, 2022
4c0b5d9
fixup: formatting
jsjoeio Jun 23, 2022
395283b
fixup: remove custom-hacks.css
jsjoeio Jun 22, 2022
f76acab
fixup: formatting
jsjoeio Jun 23, 2022
da4f1f2
Update test/integration/installExtension.test.ts
jsjoeio Jun 23, 2022
233c226
Update test/integration/listExtensions.test.ts
jsjoeio Jun 23, 2022
eca5e2f
Update test/integration/installExtension.test.ts
jsjoeio Jun 23, 2022
5df0fda
Update test/integration/listExtensions.test.ts
jsjoeio Jun 23, 2022
08bb492
fixup: contributing integration tests section
jsjoeio Jun 23, 2022
ca6b445
fixup: update ci/readme
jsjoeio Jun 23, 2022
529ed08
fixup: use RELEASE_PATH in test-integration.sh
jsjoeio Jun 23, 2022
0ffc0e5
refactor: unzip vsix for listExtensions
jsjoeio Jun 23, 2022
73f043a
refactor: use exec instead of spawn
jsjoeio Jun 23, 2022
a0eb6bc
Update docs/CONTRIBUTING.md
jsjoeio Jun 23, 2022
f3c78ca
Update test/integration/listExtensions.test.ts
jsjoeio Jun 23, 2022
ee7d294
Update test/integration/listExtensions.test.ts
jsjoeio Jun 23, 2022
51b9196
Update test/integration/listExtensions.test.ts
jsjoeio Jun 23, 2022
79f6060
refactor: use different default binary path
jsjoeio Jun 23, 2022
025b785
fixup!: formatting
jsjoeio Jun 23, 2022
53e82a6
fixup: lint
jsjoeio Jun 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,11 @@ jobs:
- name: Build standalone release
run: source scl_source enable devtoolset-9 && yarn release:standalone

- name: Sanity test standalone release
run: yarn test:standalone-release
- name: Install test dependencies
run: SKIP_SUBMODULE_DEPS=1 yarn install

- name: Run integration tests on standalone release
run: yarn test:integration

- name: Build packages with nfpm
run: yarn package
Expand Down Expand Up @@ -421,8 +424,11 @@ jobs:
- name: Build standalone release
run: yarn release:standalone

- name: Sanity test standalone release
run: yarn test:standalone-release
- name: Install test dependencies
run: SKIP_SUBMODULE_DEPS=1 yarn install

- name: Run integration tests on standalone release
run: yarn test:integration

- name: Build packages with nfpm
run: yarn package
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: ./install.sh

- name: Test code-server
run: yarn test:standalone-release code-server
run: CODE_SERVER_PATH="code-server" yarn test:integration
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we install code-server in these steps, we need to tell the integration tests to look at code-server and use the CLI/binary.


alpine:
name: Test installer on Alpine
Expand Down Expand Up @@ -66,4 +66,4 @@ jobs:
run: ./install.sh

- name: Test code-server
run: yarn test:standalone-release code-server
run: CODE_SERVER_PATH="code-server" yarn test:integration
33 changes: 0 additions & 33 deletions ci/build/test-standalone-release.sh

This file was deleted.

6 changes: 5 additions & 1 deletion ci/dev/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ main() {

install-deps test
install-deps test/e2e/extensions/test-extension
install-deps lib/vscode
# We don't need these when running the integration tests
# so you can pass SKIP_SUBMODULE_DEPS
if [[ ! ${SKIP_SUBMODULE_DEPS-} ]]; then
install-deps lib/vscode
fi
}

main "$@"
37 changes: 37 additions & 0 deletions ci/dev/test-integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail

help() {
echo >&2 " You can build the standalone release with 'yarn release:standalone'"
echo >&2 " Or you can pass in a custom path."
echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' yarn test:integration"
}

# Make sure a code-server release works. You can pass in the path otherwise it
# will look for release-standalone in the current directory.
#
# This is to make sure we don't have Node version errors or any other
# compilation-related errors.
main() {
cd "$(dirname "$0")/../.."

local path="./release-standalone/bin/code-server"
if [[ ! ${CODE_SERVER_PATH-} ]]; then
echo "Set CODE_SERVER_PATH to test another build of code-server"
else
path="$CODE_SERVER_PATH"
fi

echo "Running tests with code-server binary: '$path'"

if [[ ! -f $path ]]; then
echo >&2 "No code-server build detected"
echo >&2 "Looked in $path"
help
exit 1
fi

CODE_SERVER_PATH="$path" CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration" --testPathIgnorePatterns "./test/integration/fixtures"
}

main "$@"
2 changes: 1 addition & 1 deletion ci/dev/test-unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ main() {
# We must keep jest in a sub-directory. See ../../test/package.json for more
# information. We must also run it from the root otherwise coverage will not
# include our source files.
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@"
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --testRegex "./test/unit/.*ts" --testPathIgnorePatterns "./test/unit/node/test-plugin"
}

main "$@"
6 changes: 2 additions & 4 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Build the release packages (make sure that you run `yarn release` first):

```shell
yarn release:standalone
yarn test:standalone-release
yarn test:integration
yarn package
```

Expand Down Expand Up @@ -188,9 +188,7 @@ We use these to test anything related to our scripts (most of which live under `

### Integration tests

These are a work in progress. We build code-server and run a script called
[test-standalone-release.sh](../ci/build/test-standalone-release.sh), which
ensures that code-server's CLI is working.
These are a work in progress. We build code-server and run tests with `yarn test:integration`, which ensures that code-server's binary works.

Our integration tests look at components that rely on one another. For example,
testing the CLI requires us to build and package code-server.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"release:github-assets": "./ci/build/release-github-assets.sh",
"release:prep": "./ci/build/release-prep.sh",
"test:e2e": "VSCODE_IPC_HOOK_CLI= ./ci/dev/test-e2e.sh",
"test:standalone-release": "./ci/build/test-standalone-release.sh",
"test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles",
"test:integration": "./ci/dev/test-integration.sh",
"test:scripts": "./ci/dev/test-scripts.sh",
"package": "./ci/build/build-packages.sh",
"postinstall": "./ci/dev/postinstall.sh",
Expand Down
Binary file not shown.
44 changes: 44 additions & 0 deletions test/integration/fixtures/wesbos.theme-cobalt2-2.1.6/.vsixmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="theme-cobalt2" Version="2.1.6" Publisher="wesbos"/>
<DisplayName>Cobalt2 Theme Official</DisplayName>
<Description xml:space="preserve">🔥 Official theme by Wes Bos.</Description>
<Tags>VSCode,Themes,theme,color-theme</Tags>
<Categories>Themes</Categories>
<GalleryFlags>Public</GalleryFlags>
<Badges></Badges>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.15.0" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="ui,workspace,web" />
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" />

<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/wesbos/cobalt2-vscode" />
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/wesbos/cobalt2-vscode" />

<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/wesbos/cobalt2-vscode" />




<Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="#193549" />
<Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="dark" />
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" />



</Properties>
<License>extension/LICENSE.txt</License>
<Icon>extension/images/logo.png</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/images/logo.png" Addressable="true" />
</Assets>
</PackageManifest>
21 changes: 21 additions & 0 deletions test/integration/fixtures/wesbos.theme-cobalt2-2.1.6/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Wes Bos, Roberto Achar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions test/integration/fixtures/wesbos.theme-cobalt2-2.1.6/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Cobalt2 Theme for VS Code

[![Version](https://vsmarketplacebadge.apphb.com/version/wesbos.theme-cobalt2.svg)](https://marketplace.visualstudio.com/items?itemName=wesbos.theme-cobalt2)

![Preview](https://raw.githubusercontent.com/wesbos/cobalt2-vscode/cobalt2-updates/images/ss.png)

# Installation

1. Open **Extensions** sidebar panel in VS Code. `View → Extensions`
2. Search for `Cobalt2` - find the one by **Wes Bos** - there are a few other half-baked ones so make sure you have the right one!
3. Click **Install** to install it.
4. Click **Reload** to reload the your editor
5. Code > Preferences > Color Theme > **Cobalt2**
6. Optional: Use the recommended settings below for best experience

## Recommended Settings

```js
{
"workbench.colorTheme": "Cobalt2",
// The Cursive font is operator Mono, it's $200 and you need to buy it to get the cursive
"editor.fontFamily": "Operator Mono, Menlo, Monaco, 'Courier New', monospace",
"editor.fontSize": 17,
"editor.lineHeight": 25,
"editor.letterSpacing": 0.5,
"files.trimTrailingWhitespace": true,
"editor.fontWeight": "400",
"prettier.eslintIntegration": true,
"editor.cursorStyle": "line",
"editor.cursorWidth": 5,
"editor.cursorBlinking": "solid",
"editor.renderWhitespace": "all",
}
```

## Contributing

This is a bit weird, but to get some sort of live feedback for when editing a theme. Please let me know if you have a saner way of doing it

1. Open this repo in your terminal and type `npm install`
1. Start to watch for change on the repo with `npm start` - this runs a nodemon task for you and will automatically recompile any changes
1. Open this repo in VS Code
1. Open your command palette and hit type **VSIX**. Select the one that says **Extensions: Install from VSIX...**
1. Load the VSIX file that was created a few steps back
1. Set your editor to use _this_ Cobalt2 theme - it might help to change the name in package.json to something like "Cobalt2 Dev" so you can differentiate from the Cobalt2 you've installed from the marketplace. If you get confused, just delete all traces of Cobalt2 and then load the VSIX.
1. Go to the debug sidebar `View → Debug`
1. Press the green arrow beside "Launch Extension"
1. This will then open a second window.
1. Make a change, and then hit the refresh button on your debug toolbar - this is in your first editor - not the one that poped open.
1. Wait a sec, your changes should now be reflected!

Whew. Again, if you have an easier way to style these things, let me know!

## I don't like something

First, this theme is new so if something is funky, please open an issue.

These are the things we have control over. If you would like to change something, you can either open a PR and see if I'd like it added, or override the colours in your own settings.json file.

https://code.visualstudio.com/docs/getstarted/theme-color-reference

## Put Cobalt2 in other places!

- [Sublime Text](https://github.com/wesbos/cobalt2)
- [Atom](https://github.com/wesbos/Cobalt2-atom)
- [iTerm2](https://github.com/wesbos/Cobalt2-iterm)
- [Hyper Term](https://github.com/wesbos/hyperterm-cobalt2-theme)
- [Alfred](https://github.com/wesbos/Cobalt2-Alfred-Theme)
- [Slack](https://github.com/wesbos/Cobalt2-Slack)

## Thanks

Thanks to Roberto Achar for doing much of the initial porting to VS Code.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions test/integration/fixtures/wesbos.theme-cobalt2-2.1.6/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "theme-cobalt2",
"version": "2.1.6",
"displayName": "Cobalt2 Theme Official",
"description": "🔥 Official theme by Wes Bos.",
"publisher": "wesbos",
"icon": "images/logo.png",
"repository": {
"type": "git",
"url": "https://github.com/wesbos/cobalt2-vscode"
},
"galleryBanner": {
"color": "#193549",
"theme": "dark"
},
"categories": [
"Themes"
],
"keywords": [
"VSCode",
"Themes"
],
"engines": {
"vscode": "^1.15.0"
},
"scripts": {
"start": "nodemon --exec vsce package"
},
"contributes": {
"themes": [
{
"label": "Cobalt2",
"uiTheme": "vs-dark",
"path": "./theme/cobalt2.json"
}
]
},
"devDependencies": {
"nodemon": "^1.14.12",
"vsce": "^1.36.2"
},
"__metadata": {
"id": "fb374ce1-5343-46c8-a425-900fdad15523",
"publisherDisplayName": null,
"publisherId": "ef56c328-1595-4d1e-9e0b-43d926331358",
"isPreReleaseVersion": false,
"preRelease": false,
"installedTimestamp": 1655919021078
}
}
Loading