Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.
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 .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.vscode/**
.vscode-test/**
fixtures/**
test/**
out/test/**
src/**
.gitignore
.prettierignore
prettier.config.js
vsc-extension-quickstart.md
**/tsconfig.json
**/tslint.json
Expand Down
2,544 changes: 781 additions & 1,763 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,33 @@
"onLanguage:rust",
"workspaceContains:Cargo.toml"
],
"main": "./out/extension.js",
"main": "./out/src/extension.js",
"scripts": {
"vscode:prepublish": "npm run check:version && npm run lint && npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"lint": "tslint --config ./tslint.json './src/**/*.ts'",
"test": "npm run compile && node ./node_modules/vscode/bin/test",
"test": "node ./out/test/runTest.js",
"prettier": "prettier **/*.ts",
"check:version": "node cmd/check-version.js",
"postinstall": "node ./node_modules/vscode/bin/install",
"installDevExtension": "npm install && ./node_modules/.bin/vsce package -o ./out/rls-vscode-dev.vsix && code --install-extension ./out/rls-vscode-dev.vsix"
},
"dependencies": {
"vscode-languageclient": "^4.3.0"
},
"devDependencies": {
"@types/mocha": "^2.2.43",
"@types/glob": "^7.1.1",
"@types/mocha": "^5.2.6",
"@types/node": "~10.1.0",
"@types/vscode": "^1.31.0",
"glob": "^7.1.4",
"mocha": "^6.1.4",
"prettier": "^1.16.4",
"tslint": "^5.14.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.0.0",
"vsce": "^1.58.0",
"vscode": "^1.1.30"
"vsce": "^1.63.0",
"vscode-test": "^0.4.3"
},
"contributes": {
"languages": [
Expand Down
24 changes: 0 additions & 24 deletions src/test/index.ts

This file was deleted.

13 changes: 13 additions & 0 deletions test/runTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as path from 'path';
// tslint:disable-next-line: no-implicit-dependencies
import { runTests } from 'vscode-test';

(async () => {
const extensionPath = path.resolve(__dirname, '../../');
const testRunnerPath = path.resolve(__dirname, './suite');

await runTests({
extensionPath,
testRunnerPath,
});
})();
4 changes: 3 additions & 1 deletion src/test/extension.test.ts → test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import * as vscode from 'vscode';
// tslint:disable-next-line: no-duplicate-imports
import { Uri } from 'vscode';

const fixtureDir = path.resolve(path.join(__dirname, '..', '..', 'fixtures'));
const fixtureDir = path.resolve(
path.join(__dirname, '..', '..', '..', 'fixtures'),
);

suite('Extension Tests', () => {
test('cargo tasks are auto-detected', async () => {
Expand Down
32 changes: 32 additions & 0 deletions test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as glob from 'glob';
import * as Mocha from 'mocha';
import * as path from 'path';

export function run(
testsRoot: string,
// tslint:disable-next-line: no-any
cb: (error: any, failures?: number) => void,
): void {
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
}).useColors(true);

glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
if (err) {
return cb(err);
}

// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));

try {
// Run the mocha test
mocha.run(failures => {
cb(null, failures);
});
} catch (err) {
cb(err);
}
});
}
2 changes: 1 addition & 1 deletion src/test/rustup.test.ts → test/suite/rustup.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as assert from 'assert';
import * as child_process from 'child_process';

import * as rustup from '../rustup';
import * as rustup from '../../src/rustup';

// We need to ensure that rustup works and is installed
const rustupVersion = child_process.execSync('rustup --version').toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from 'assert';

import * as wslpath from '../../utils/wslpath';
import * as wslpath from '../../../src/utils/wslpath';

function mkConverterCheck(converter: (arg: string) => string) {
return (from: string, to: string) => assert.equal(converter(from), to);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"outDir": "out",
"lib": ["es6"],
"sourceMap": true,
"rootDir": "src",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src", "test"],
"exclude": [
"node_modules",
".vscode-test"
Expand Down