prep for release, fix tests
This commit is contained in:
Родитель
a26ecc4175
Коммит
965275ba30
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
25
package.json
25
package.json
|
@ -2,10 +2,10 @@
|
|||
"name": "sublime-keybindings",
|
||||
"displayName": "Sublime Text Keymap and Settings Importer",
|
||||
"description": "Import Sublime Text settings and keybindings into VS Code.",
|
||||
"version": "4.0.6",
|
||||
"version": "4.0.7",
|
||||
"publisher": "ms-vscode",
|
||||
"engines": {
|
||||
"vscode": "^1.22.0"
|
||||
"vscode": "^1.32.0"
|
||||
},
|
||||
"categories": [
|
||||
"Keymaps"
|
||||
|
@ -35,18 +35,25 @@
|
|||
"url": "https://github.com/Microsoft/vscode-sublime-keybindings/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||
"test": "npm run compile && node ./node_modules/vscode/bin/test",
|
||||
"test": "node ./out/test/runTests.js",
|
||||
"pretest": "npm run compile",
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"watch": "tsc -watch -p ./"
|
||||
"watch": "tsc -watch -p ./",
|
||||
"lint": "tslint -p ./"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^12.0.8",
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/mocha": "^5.2.6",
|
||||
"@types/node": "^12.12.0",
|
||||
"@types/vscode": "^1.32.0",
|
||||
"@types/relaxed-json": "^1.0.0",
|
||||
"typescript": "^3.5.2",
|
||||
"vscode": "^1.1.34"
|
||||
"glob": "^7.1.4",
|
||||
"mocha": "^6.1.4",
|
||||
"source-map-support": "^0.5.12",
|
||||
"tslint": "^5.19.0",
|
||||
"typescript": "^3.8.3",
|
||||
"vscode-test": "^1.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"relaxed-json": "^1.0.1"
|
||||
|
|
|
@ -26,7 +26,7 @@ export class Mapper {
|
|||
parsedSublimeSettings = rjson.parse(sublimeSettings);
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage('The sublime settings file could not be parsed. Please check if it contains syntax errors.');
|
||||
throw(e);
|
||||
throw (e);
|
||||
}
|
||||
return this.mapAllSettings(settingsMappings, parsedSublimeSettings);
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ export class Mapper {
|
|||
if (info && info.globalValue !== undefined) {
|
||||
if (info.globalValue === vscodeSetting.value) {
|
||||
returnVal.alreadyExists = true;
|
||||
} else if(typeof info.globalValue == 'object') {
|
||||
returnVal.existingValue = info.globalValue ? info.globalValue.toString() : '';
|
||||
} else {
|
||||
returnVal.existingValue = returnVal.existingValue === null ? '' : String(info.globalValue);
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
//
|
||||
// This file is providing the test runner to use when running extension tests.
|
||||
// By default the test runner in use is Mocha based.
|
||||
//
|
||||
// You can provide your own test runner if you want to override it by exporting
|
||||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
|
||||
// host can call to run the tests. The test runner is expected to use console.log
|
||||
// to report the results back to the caller. When the tests are finished, return
|
||||
// a possible error to the callback or null if none.
|
||||
|
||||
import * as testRunner from 'vscode/lib/testrunner';
|
||||
|
||||
// You can directly control Mocha options by uncommenting the following lines
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
|
||||
testRunner.configure({
|
||||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
|
||||
useColors: true, // colored output from test results
|
||||
});
|
||||
|
||||
module.exports = testRunner;
|
|
@ -0,0 +1,22 @@
|
|||
import * as path from 'path';
|
||||
import { runTests } from 'vscode-test';
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
// The folder containing the Extension Manifest package.json
|
||||
// Passed to `--extensionDevelopmentPath`
|
||||
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
|
||||
|
||||
// The path to the extension test script
|
||||
// Passed to --extensionTestsPath
|
||||
const extensionTestsPath = path.resolve(__dirname, './suite/index');
|
||||
|
||||
// Download VS Code, unzip it and run the integration test
|
||||
await runTests({ extensionDevelopmentPath, extensionTestsPath });
|
||||
} catch (err) {
|
||||
console.error('Failed to run tests');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
|
@ -1,6 +1,6 @@
|
|||
import * as assert from 'assert';
|
||||
import { Mapper } from '../mapper';
|
||||
import { ISetting, MappedSetting, CategorizedSettings, VscodeSetting } from '../settings';
|
||||
import { Mapper } from '../../mapper';
|
||||
import { ISetting, MappedSetting, CategorizedSettings, VscodeSetting } from '../../settings';
|
||||
import * as testData from './testData';
|
||||
|
||||
suite('Importer Tests', async () => {
|
|
@ -0,0 +1,38 @@
|
|||
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'
|
||||
});
|
||||
mocha.useColors(true);
|
||||
|
||||
const testsRoot = path.resolve(__dirname, '..');
|
||||
|
||||
return new Promise((c, e) => {
|
||||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
|
||||
if (err) {
|
||||
return e(err);
|
||||
}
|
||||
|
||||
// Add files to the test suite
|
||||
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
|
||||
|
||||
try {
|
||||
// Run the mocha test
|
||||
mocha.run(failures => {
|
||||
if (failures > 0) {
|
||||
e(new Error(`${failures} tests failed.`));
|
||||
} else {
|
||||
c();
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
e(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
Загрузка…
Ссылка в новой задаче