Skip to content
Open
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
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test/index" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out/test",
Expand Down
5,916 changes: 2,514 additions & 3,402 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"publisher": "rintoj",
"icon": "images/icon.png",
"engines": {
"vscode": "^1.0.0"
"vscode": "^1.14.0"
},
"categories": [
"Other"
],
"repository": {
"type": "git",
"url": "git+https://github.com/rintoj/json-organizer.git"
"url": "https://github.com/rintoj/json-organizer.git"
},
"activationEvents": [
"onCommand:jsono.toggleFormat"
Expand All @@ -36,14 +36,19 @@
]
},
"scripts": {
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
"vscode:prepublish": "tsc -p .",
"compile": "npm run vscode:prepublish -- --watch",
"test": "node ./out/test/runTests.js"
},
"devDependencies": {
"typescript": "^1.8.5",
"vscode": "^0.11.0"
"@types/glob": "^7.2.0",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.23",
"@types/vscode": "^1.14.0",
"@vscode/test-electron": "^2.1.3",
"glob": "^7.2.0",
"mocha": "^9.2.2",
"typescript": "^4.6.3"
},
"dependencies": {
"js-beautify": "^1.8.6"
Expand Down
46 changes: 27 additions & 19 deletions test/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
//
// 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 glob from 'glob';
import * as Mocha from 'mocha';
import * as path from 'path';

var testRunner = require('vscode/lib/testrunner');
export function run(): Promise<void> {
const testDir = __dirname;
const mocha: Mocha = new Mocha({ ui: 'tdd' });

// 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
});
return new Promise<void>(
(resolve, reject) => {
glob("**/*.test.js", { cwd: testDir }, (error, matches) => {
if (error) {
reject(error);
}
else {
matches.forEach(file => mocha.addFile(path.resolve(testDir, file)));

module.exports = testRunner;
mocha.run(
(failures) => {
if (failures > 0) {
reject(new Error(`${failures} test${failures > 1 ? 's' : ''} failed.`));
}
else {
resolve();
}
});
}
});
});
}
10 changes: 10 additions & 0 deletions test/runTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { runTests } from '@vscode/test-electron';
import { resolve } from 'path';

(async () => {
runTests(
{
extensionDevelopmentPath: resolve(__dirname, '..', '..'),
extensionTestsPath: resolve(__dirname, 'index')
});
})();
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"module": "commonjs",
"target": "es5",
"outDir": "out",
"noLib": true,
"sourceMap": true,
"rootDir": "."
},
Expand Down
1 change: 0 additions & 1 deletion typings/node.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion typings/vscode-typings.d.ts

This file was deleted.