-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d3198b
commit 772855e
Showing
28 changed files
with
16,996 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vscode.d.ts | ||
vscode.proposed.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/**@type {import('eslint').Linter.Config} */ | ||
// eslint-disable-next-line no-undef | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
plugins: [ | ||
'@typescript-eslint', | ||
], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
rules: { | ||
'semi': [2, "always"], | ||
'@typescript-eslint/no-unused-vars': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'@typescript-eslint/explicit-module-boundary-types': 0, | ||
'@typescript-eslint/no-non-null-assertion': 0, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: 🔎 CodeQL | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'javascript' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||
# Learn more: | ||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Release | ||
on: | ||
repository_dispatch: | ||
types: [semantic-release] | ||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v2 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
with: | ||
semantic_version: 17.4.4 | ||
branches: main | ||
dry_run: true | ||
extra_plugins: | | ||
@felipecrs/semantic-release-vsce@3.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
out | ||
node_modules | ||
.vscode-test/ | ||
*.vsix | ||
|
||
/vscode.d.ts | ||
/vscode.proposed.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
branches: | ||
- name: main | ||
ci: false | ||
debug: true | ||
dryRun: true | ||
npmPublish: false | ||
# repositoryUrl: — no need, will use from git origin | ||
tagFormat: 'v${version}' | ||
plugins: | ||
- '@semantic-release/commit-analyzer' | ||
|
||
# Global plugin options (will be passed to all plugins) | ||
preset: 'conventionalcommits' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
"ms-vscode.powershell-preview", | ||
"github.vscode-pull-request-github", | ||
"cschleiden.vscode-github-actions" | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// A launch configuration that compiles the extension and then opens it inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [{ | ||
"name": "Run Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"--install-extension=ms-vscode.powershell-preview", | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"${workspaceFolder}/sample" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/out/**/*.js" | ||
], | ||
"preLaunchTask": "npm: watch", | ||
"smartStep": true, | ||
"skipFiles": [ | ||
"C:/users/jgrote/AppData/Local/Programs/Microsoft VS Code Insiders/**/*.js", | ||
"**/app/out/vs/**", | ||
"**\\app\\out\\vs\\**", | ||
"<node_internals>/**" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": { | ||
"owner": "typescript", | ||
"source": "ts", | ||
"applyTo": "closedDocuments", | ||
"fileLocation": [ | ||
"relative", | ||
"${cwd}" | ||
], | ||
"pattern": "$tsc", | ||
"background": { | ||
"activeOnStart": true, | ||
"beginsPattern": { | ||
"regexp": "^\\s*(?:message TS6032:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(├\\D*\\d{1,2}\\D+┤)?(?:\\]| -)) File change detected\\. Starting incremental compilation\\.\\.\\." | ||
}, | ||
"endsPattern": { | ||
"regexp": "Found \\d+ errors" | ||
} | ||
} | ||
}, | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"type": "npm", | ||
"script": "compile", | ||
"problemMatcher": "$tsc", | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": "build" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Welcome! There are many ways you can contribute to the extension | ||
|
||
# Documentation / Non-Code Changes | ||
I recommend you use the Remote Repositories extension to check this repository out in VSCode, make adjustments, and | ||
submit a pull request, all without ever having to clone the repository locally. | ||
|
||
TODO: "Peek with VSCode Remote Repositories" button | ||
|
||
# Development | ||
|
||
The extension is broken into the following abstraction layers: | ||
1. **Extension** - The main extension, verifies prerequisites and registers the test controller | ||
1. **PesterTestController** - An implementation of the vscode test controller | ||
1. **PesterTestTree** - A "live object" model that represents the tests to run and their organization. For now they follow | ||
the Pester hierarchy (File/Describe/Context/It) though additional hierarchies (Group by Tag/Function/etc) are planned | ||
1. **PesterTestRunner** - Contains methods for running pester tests, used by Pester Test Controller | ||
1. **PowershellRunner** - Contains methods for running powershell scripts, used by PesterTestRunner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# vscode-adapter | ||
# vscode-adapter | ||
This is an extension for Visual Studio Code that enables Pester Testing using the native vscode Testing API. | ||
|
||
# Configuration | ||
This extension will use the Powershell pester verbosity settings for the output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
param ($Path) | ||
|
||
$VerbosePreference = 'Ignore' | ||
$WarningPreference = 'Ignore' | ||
$DebugPreference = 'Ignore' | ||
Import-Module Pester -MinimumVersion 5.0.0 -ErrorAction Stop | ||
function Discover-Test { | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory)] | ||
[String[]] $Path, | ||
[String[]] $ExcludePath | ||
) | ||
& (Get-Module Pester) { | ||
param ( | ||
$Path, | ||
$ExcludePath, | ||
$SessionState) | ||
|
||
Reset-TestSuiteState | ||
# to avoid Describe thinking that we run in interactive mode | ||
$invokedViaInvokePester = $true | ||
$files = Find-File -Path $Path -ExcludePath $ExcludePath -Extension $PesterPreference.Run.TestExtension.Value | ||
$containers = foreach ($f in $files) { | ||
<# HACK: We check to see if there is a single Describe block in the file so that we don't accidentally execute code that shouldn't need to be executed. #> | ||
if (!(Select-String -Path $f -SimpleMatch 'Describe')) { | ||
continue | ||
} | ||
New-BlockContainerObject -File (Get-Item $f) | ||
} | ||
Find-Test -BlockContainer $containers -SessionState $SessionState } -Path $Path -ExcludePath $ExcludePath -SessionState $PSCmdlet.SessionState | ||
} | ||
|
||
function New-SuiteObject ($Block) { | ||
[PSCustomObject]@{ | ||
type = 'suite' | ||
id = $Block.ScriptBlock.File + ';' + $Block.StartLine | ||
file = $Block.ScriptBlock.File | ||
line = $Block.StartLine - 1 | ||
label = $Block.Name | ||
children = [Collections.Generic.List[Object]]@() | ||
} | ||
} | ||
|
||
function New-TestObject ($Test) { | ||
[PSCustomObject]@{ | ||
type = 'test' | ||
id = $Test.ScriptBlock.File + ';' + $Test.StartLine | ||
file = $Test.ScriptBlock.File | ||
line = $Test.StartLine - 1 | ||
label = $Test.Name | ||
} | ||
} | ||
|
||
function fold ($children, $Block) { | ||
foreach ($b in $Block.Blocks) { | ||
$o = (New-SuiteObject $b) | ||
$children.Add($o) | ||
fold $o.children $b | ||
} | ||
|
||
$hashset = [System.Collections.Generic.HashSet[string]]::new() | ||
foreach ($t in $Block.Tests) { | ||
$key = "$($t.ExpandedPath):$($t.StartLine)" | ||
if ($hashset.Contains($key)) { | ||
continue | ||
} | ||
$children.Add((New-TestObject $t)) | ||
$hashset.Add($key) | Out-Null | ||
} | ||
$hashset.Clear() | Out-Null | ||
} | ||
|
||
$found = Discover-Test -Path $Path | ||
|
||
# whole suite | ||
$suite = [PSCustomObject]@{ | ||
Blocks = [Collections.Generic.List[Object]] $found | ||
Tests = [Collections.Generic.List[Object]]@() | ||
} | ||
|
||
$testSuiteInfo = [PSCustomObject]@{ | ||
type = 'suite' | ||
id = 'root' | ||
label = 'Pester' | ||
children = [Collections.Generic.List[Object]]@() | ||
} | ||
|
||
foreach ($file in $found) { | ||
$fileSuite = [PSCustomObject]@{ | ||
type = 'suite' | ||
id = $file.BlockContainer.Item.FullName | ||
file = $file.BlockContainer.Item.FullName | ||
label = $file.BlockContainer.Item.Name | ||
children = [Collections.Generic.List[Object]]@() | ||
} | ||
$testSuiteInfo.children.Add($fileSuite) | ||
fold $fileSuite.children $file | ||
} | ||
|
||
$testSuiteInfo | ConvertTo-Json -Depth 100 |
Oops, something went wrong.