Skip to content

Commit

Permalink
Merge branch 'master' into 20201202_add_vsix_to_gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
connorshea authored May 14, 2021
2 parents 43a9d6c + 610b1c7 commit 2631d8c
Show file tree
Hide file tree
Showing 45 changed files with 2,989 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assignees: ''
- Ruby version:
- VS Code version:
- Operating System:
- RSpec version:
- RSpec or Minitest version:

### Expected behavior

Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test


on:
push:
branches:
- master
pull_request: {}

jobs:
test:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 15
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: Update rubygems & bundler
run: |
ruby -v
gem update --system
- name: install dependencies
run: |
bin/setup
- name: Compile extension
run: |
npm run build
npm run package
- name: Run minitest tests
run: |
xvfb-run -a node ./out/test/runMinitestTests.js
- name: Run rspec tests
run: |
xvfb-run -a node ./out/test/runRspecTests.js
- name: Run Ruby test
run: |
cd ruby && bundle exec rake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules/
out/
.DS_Store
ruby/Gemfile.lock
/.vscode-test
*.vsix
26 changes: 25 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,32 @@
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out"
"${workspaceFolder}/out/src"
]
},
{
"name": "Run tests for Minitest",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/frameworks/minitest/index",
"${workspaceFolder}/test/fixtures/minitest"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"]
},
{
"name": "Run tests for RSpec",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/frameworks/rspec/index",
"${workspaceFolder}/test/fixtures/rspec"
],
"outFiles": ["${workspaceFolder}/out/test/**/**/*.js"]
}
]
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tsconfig.json
.vscode/**
.gitignore
*.vsix
out/test/**
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [0.8.1] - 2021-05-14
### Changed
- Increase the minimum VS Code version required for the extension to v1.54 (the February 2021 release).
- Disable the extension in Untrusted Workspaces and Virtual Workspaces. It shouldn't be enabled if the code in the repo isn't trusted (since it essentially executes arbitrary code on-load) and cannot work in a Virtual Workspace since Ruby gems need to be installed and test files must all be available.

### Internal
- Add an automated test suite for the extension. Thanks [@soutaro](https://github.com/soutaro)! ([#74](https://github.com/connorshea/vscode-ruby-test-adapter/pull/74))

## [0.8.0] - 2020-10-25
### Added
- Add support for debugging specs. Thanks [@baelter](https://github.com/baelter) and [@CezaryGapinski](https://github.com/CezaryGapinski)! ([#51](https://github.com/connorshea/vscode-ruby-test-adapter/pull/51))
Expand Down Expand Up @@ -154,7 +162,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Initial release.

[Unreleased]: https://github.com/connorshea/vscode-ruby-test-adapter/compare/v0.8.0...HEAD
[Unreleased]: https://github.com/connorshea/vscode-ruby-test-adapter/compare/v0.8.1...HEAD
[0.8.1]: https://github.com/connorshea/vscode-ruby-test-adapter/compare/v0.8.0...v0.8.1
[0.8.0]: https://github.com/connorshea/vscode-ruby-test-adapter/compare/v0.7.1...v0.8.0
[0.7.1]: https://github.com/connorshea/vscode-ruby-test-adapter/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/connorshea/vscode-ruby-test-adapter/compare/v0.6.1...v0.7.0
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Connor Shea
Copyright (c) 2019-2021 Connor Shea

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Property | Description
`rubyTestExplorer.filePattern` | Define the pattern to match test files by, for example `["*_test.rb", "test_*.rb", "*_spec.rb"]`.
`rubyTestExplorer.debuggerHost` | Define the host to connect the debugger to, for example `127.0.0.1`.
`rubyTestExplorer.debuggerPort` | Define the port to connect the debugger to, for example `1234`.
`rubyTestExplorer.debugCommand` | Define how to run rdebug-ide, for example `rdebug-ide` or `bundle exec rdebug-ide`.
`rubyTestExplorer.rspecCommand` | Define the command to run RSpec tests with, for example `bundle exec rspec`, `spring rspec`, or `rspec`.
`rubyTestExplorer.rspecDirectory` | Define the relative directory of the specs in a given workspace, for example `./spec/`.
`rubyTestExplorer.minitestCommand` | Define how to run Minitest with Rake, for example `./bin/rake`, `bundle exec rake` or `rake`. Must be a Rake command.
Expand All @@ -76,14 +77,25 @@ If all else fails or you suspect something is broken with the extension, please
You'll need VS Code, Node (any version >= 8 should probably work), and Ruby installed.

- Clone the repository: `git clone https://github.com/connorshea/vscode-ruby-test-adapter`
- Run `npm install` to install dependencies.
- Run `bin/setup` to install dependencies.
- Open the directory in VS Code.
- Run `npm run watch` or start the `watch` Task in VS Code to get the TypeScript compiler running.
- Go to the Debug section in the sidebar and run "Ruby adapter". This will start a separate VS Code instance for testing the extension in. It gets updated code whenever "Reload Window" is run in the Command Palette.
- You'll need a Ruby project if you want to actually use the extension to run tests, I generally use my project [VideoGameList](https://github.com/connorshea/VideoGameList) for testing, but any Ruby project with RSpec or Minitest tests will work.
- You'll need a Ruby project if you want to actually use the extension to run tests, I generally use my project [vglist](https://github.com/connorshea/vglist) for testing, but any Ruby project with RSpec or Minitest tests will work.

This extension is based on [the example test adapter](https://github.com/hbenl/vscode-example-test-adapter), it may be useful to check that repository for more information. Test adapters for other languages may also be useful references.

### Running tests

There are two groups of tests included in the repository.

- Tests for Ruby scripts to collect test information and run tests. Run with `bundle exec rake` in `ruby` directory.
- Tests for VS Code extension which invokes the Ruby scripts. Run from VS Code's debug panel with the "Run tests for" configurations.
- There are separate debug configurations for each supported test framework.
- Note that you'll need to run `npm run build && npm run package` before you'll be able to successfully run the extension tests. You'll also need to re-run these every time you make changes to the extension code or your tests.

You can see `.github/workflows/test.yml` for CI configurations.

### Publishing a new version

See [the VS Code extension docs](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) for more info.
Expand Down
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

npm install
bundle install --gemfile=ruby/Gemfile
bundle install --gemfile=test/fixtures/minitest/Gemfile
Loading

0 comments on commit 2631d8c

Please sign in to comment.