Skip to content
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 the official vscode test API and Test Explorer (v1.59) #742

Merged
merged 10 commits into from
Aug 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .vscode-insiders/argv.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enable-proposed-api": ["orta.vscode-jest"]
}
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Bug-fixes within the same version aren't needed
* fix type warning in settings.json when using the `{"autoRun": "off"}` option - @tommy
* fix couple of test result matching issues - @connectdotz (#737)
* update match API/attributes to support up-coming vscode test provider API. - @connectdotz (#737)

* support official vscode Test Explorer and API in v1.59 - @connectdotz (#742)
*
-->

### 4.0.3
Expand Down
106 changes: 74 additions & 32 deletions README.md

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion __mocks__/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Uri = {
joinPath: jest.fn(),
};
const Range = jest.fn();
const Location = jest.fn();
const Position = jest.fn();
const Diagnostic = jest.fn();
const ThemeIcon = jest.fn();
Expand All @@ -69,7 +70,26 @@ const QuickInputButtons = {
Back: {},
};

export {
const tests = {
createTestController: jest.fn(),
};

const TestRunProfileKind = {
Run: 1,
Debug: 2,
Coverage: 3,
};

const TestMessage = jest.fn();
const TestRunRequest = jest.fn();

const EventEmitter = jest.fn().mockImplementation(() => {
return {
fire: jest.fn(),
};
});

export = {
CodeLens,
languages,
StatusBarAlignment,
Expand All @@ -78,6 +98,7 @@ export {
OverviewRulerLane,
Uri,
Range,
Location,
Position,
Diagnostic,
ThemeIcon,
Expand All @@ -86,4 +107,9 @@ export {
debug,
commands,
QuickInputButtons,
tests,
TestRunProfileKind,
EventEmitter,
TestMessage,
TestRunRequest,
};
Binary file added images/test-explorer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "vscode-jest",
"displayName": "Jest",
"description": "Use Facebook's Jest With Pleasure.",
"version": "4.0.3",
"version": "4.1.0-rc.3",
"publisher": "Orta",
"engines": {
"vscode": "^1.45.0"
"vscode": "^1.59.0"
},
"author": {
"name": "Orta Therox, ConnectDotz & Sean Poulter",
Expand All @@ -20,7 +20,8 @@
"color": "#384357"
},
"categories": [
"Other"
"Other",
"Testing"
],
"keywords": [
"jest",
Expand Down Expand Up @@ -63,7 +64,7 @@
],
"configuration": {
"type": "object",
"title": "Jest configuration",
"title": "Jest",
"properties": {
"jest.autoEnable": {
"description": "Automatically start Jest for this project",
Expand Down Expand Up @@ -97,13 +98,6 @@
"default": "",
"scope": "resource"
},
"jest.enableInlineErrorMessages": {
"description": "Whether errors should be reported inline on a file",
"type": "boolean",
"default": false,
"scope": "resource",
"markdownDeprecationMessage": "**Deprecated**: in favor of vscode hovering message"
},
"jest.enableSnapshotUpdateMessages": {
"description": "Whether snapshot update messages should show",
"type": "boolean",
Expand Down Expand Up @@ -197,6 +191,14 @@
],
"default": null,
"scope": "resource"
},
"jest.testExplorer": {
"markdownDescription": "Configure jest TestExplorer. See valid [formats](https://github.com/jest-community/vscode-jest/blob/master/README.md#testexplorer) or [how to use test explorer](https://github.com/jest-community/vscode-jest/blob/master/README.md#how-to-use-the-test-explorer) for more details",
"type": "object",
"default": {
"enabled": true
},
"scope": "resource"
}
}
},
Expand Down Expand Up @@ -401,7 +403,6 @@
"@types/istanbul-lib-source-maps": "^4.0.1",
"@types/jest": "^26.0.15",
"@types/node": "^8.0.31",
"@types/vscode": "^1.45.0",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"copy-webpack-plugin": "^8.1.0",
Expand All @@ -420,7 +421,7 @@
"rimraf": "^3.0.2",
"ts-jest": "^26.5.2",
"ts-loader": "^7.0.1",
"typescript": "^4.2.2",
"typescript": "^4.3.2",
"vscode-test": "^1.3.0",
"webpack": "^5.30.0",
"webpack-cli": "^4.6.0"
Expand Down
3 changes: 1 addition & 2 deletions src/Coverage/CoverageOverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { CoverageMapProvider } from './CoverageMapProvider';
import { DefaultFormatter } from './Formatters/DefaultFormatter';
import { GutterFormatter } from './Formatters/GutterFormatter';
import * as vscode from 'vscode';
import { hasDocument } from '../editor';

export type CoverageStatus = 'covered' | 'partially-covered' | 'uncovered';
export type CoverageColors = {
Expand Down Expand Up @@ -61,7 +60,7 @@ export class CoverageOverlay {
}

update(editor: vscode.TextEditor): void {
if (!hasDocument(editor)) {
if (!editor.document) {
return;
}

Expand Down
Loading