-
Notifications
You must be signed in to change notification settings - Fork 52
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
Support parallel rspec tests #122
base: main
Are you sure you want to change the base?
Changes from all commits
329ff79
4035eeb
65e76a9
61a4174
7af0a7e
3820feb
c9441cd
2151803
a0fc44c
0501e67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node | ||
{ | ||
"name": "Node.js & TypeScript", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-20" | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
branches: | ||
- main | ||
pull_request: {} | ||
workflow_dispatch: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's you manually start it from the ui for a branch |
||
|
||
jobs: | ||
test: | ||
|
@@ -35,6 +36,9 @@ jobs: | |
- name: Run rspec tests | ||
run: | | ||
xvfb-run -a node ./out/test/runRspecTests.js | ||
- name: Run parallel tests | ||
run: | | ||
xvfb-run -a node ./out/test/runParallelRspecTests.js | ||
- name: Run Ruby test | ||
run: | | ||
cd ruby && bundle exec rake |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,9 @@ | |
"--extensionDevelopmentPath=${workspaceFolder}" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/out/src" | ||
] | ||
"${workspaceFolder}/out/**/*.js" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found this helped the debugger correctly pick up break points, guess it meant source maps where available but not sure |
||
], | ||
"preLaunchTask": "npm: watch" | ||
}, | ||
{ | ||
"name": "Run tests for Minitest", | ||
|
@@ -36,6 +37,18 @@ | |
"${workspaceFolder}/test/fixtures/rspec" | ||
], | ||
"outFiles": ["${workspaceFolder}/out/test/**/**/*.js"] | ||
}, | ||
{ | ||
"name": "Run tests for Parallel RSpec", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"--extensionTestsPath=${workspaceFolder}/out/test/suite/frameworks/rspec/index", | ||
"${workspaceFolder}/test/fixtures/parallel_rspec" | ||
], | ||
"outFiles": ["${workspaceFolder}/out/test/**/**/*.js"] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source "https://rubygems.org" | ||
|
||
gem "rspec" | ||
gem "rake" | ||
gem "parallel_tests" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
diff-lcs (1.4.4) | ||
parallel (1.23.0) | ||
parallel_tests (4.2.1) | ||
parallel | ||
rake (13.0.3) | ||
rspec (3.10.0) | ||
rspec-core (~> 3.10.0) | ||
rspec-expectations (~> 3.10.0) | ||
rspec-mocks (~> 3.10.0) | ||
rspec-core (3.10.1) | ||
rspec-support (~> 3.10.0) | ||
rspec-expectations (3.10.1) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.10.0) | ||
rspec-mocks (3.10.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.10.0) | ||
rspec-support (3.10.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
parallel_tests | ||
rake | ||
rspec | ||
|
||
BUNDLED WITH | ||
2.4.13 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Abs | ||
def apply(n) | ||
case | ||
when n > 0 | ||
n | ||
when n == 0 | ||
raise "Abs for zero is not supported" | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Square | ||
def apply(n) | ||
n + n | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "test_helper" | ||
|
||
describe Abs do | ||
it "finds the absolute value of 1" do | ||
expect(Abs.new.apply(1)).to eq(1) | ||
end | ||
|
||
it "finds the absolute value of 0" do | ||
expect(Abs.new.apply(0)).to eq(0) | ||
end | ||
|
||
it "finds the absolute value of -1" do | ||
skip | ||
expect(Abs.new.apply(-1)).to eq(1) | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require "test_helper" | ||
|
||
describe Square do | ||
it "finds the square of 2" do | ||
expect(Square.new.apply(2)).to eq(4) | ||
end | ||
|
||
it "finds the square of 3" do | ||
expect(Square.new.apply(3)).to eq(9) | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$LOAD_PATH << File.join(__dir__, "../lib") | ||
|
||
require "abs" | ||
require "square" | ||
require "rspec" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as path from 'path'; | ||
import * as cp from 'child_process'; | ||
|
||
import { runTests, downloadAndUnzipVSCode, resolveCliPathFromVSCodeExecutablePath } from 'vscode-test'; | ||
|
||
async function main() { | ||
try { | ||
const extensionDevelopmentPath = path.resolve(__dirname, '../../'); | ||
|
||
const vscodeExecutablePath = await downloadAndUnzipVSCode('stable') | ||
|
||
const cliPath = resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath) | ||
cp.spawnSync(cliPath, ['--install-extension', 'hbenl.vscode-test-explorer'], { | ||
encoding: 'utf-8', | ||
stdio: 'inherit' | ||
}) | ||
|
||
await runTests( | ||
{ | ||
extensionDevelopmentPath, | ||
extensionTestsPath: path.resolve(__dirname, './suite/frameworks/parallel_rspec/index'), | ||
launchArgs: [path.resolve(extensionDevelopmentPath, 'test/fixtures/parallel_rspec')] | ||
} | ||
); | ||
} catch (err) { | ||
console.error(err); | ||
console.error('Failed to run tests'); | ||
// process.exit(1); | ||
} | ||
} | ||
|
||
main(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as path from 'path'; | ||
import * as Mocha from 'mocha'; | ||
import * as glob from 'glob'; | ||
|
||
export function run(): Promise<void> { | ||
// Create the mocha test | ||
const mocha = new Mocha({ | ||
ui: 'tdd' | ||
}); | ||
|
||
return new Promise((c, e) => { | ||
glob('**.test.js', { cwd: __dirname }, (err, files) => { | ||
if (err) { | ||
return e(err); | ||
} | ||
|
||
// Add files to the test suite | ||
files.forEach(f => mocha.addFile(path.resolve(__dirname, f))); | ||
|
||
try { | ||
// Run the mocha test | ||
mocha.run(failures => { | ||
if (failures > 0) { | ||
e(new Error(`${failures} tests failed.`)); | ||
} else { | ||
c(); | ||
} | ||
}); | ||
} catch (err) { | ||
e(err); | ||
} | ||
}); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to remove this one, added as I was testing in codespaces but haven't tweaked it to have everything needed, just a basic starting point