Skip to content
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: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
/build
/package-lock.json
/package-lock.json
/.vscode-test/
9 changes: 9 additions & 0 deletions .vscode-test.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider removing this for next pr -- not using vscode cli at the moment

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// .vscode-test.js
const { defineConfig } = require('@vscode/test-cli');

module.exports = defineConfig([
{
label: 'unitTests',
files: 'build/src/test/**/*.test.js',
}
]);
5 changes: 4 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{
"version": "0.2.0",
"configurations": [

{
"name": "Run Extension",
"type": "extensionHost",
Expand All @@ -20,7 +21,9 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/test/suite/index"
]
],
"outFiles": ["${workspaceFolder}/build/*.js"],
"preLaunchTask": "npm: test-compile"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.configureOnOpen": false
}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ vsc-extension-quickstart.md
**/jsconfig.json
**/*.map
**/.eslintrc.json
**/*.js.map
168 changes: 159 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "0.0.1",
"publisher": "ReactLabyrinthDev",
"engines": {
"vscode": "^1.84.0"
"vscode": "^1.85.1"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -70,17 +70,20 @@
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "node ./test/runTest.js",
"test": "node ./build/src/test/runTest.js",
"test1": "vscode-test",
"dev": "webpack --watch",
"webpack": "webpack"
},
"devDependencies": {
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.3",
"@types/node": "18.x",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/vscode": "^1.84.0",
"@vscode/test-electron": "^2.3.6",
"@types/vscode": "^1.85.1",
"@vscode/test-cli": "^0.0.4",
"@vscode/test-electron": "^2.3.8",
"eslint": "^8.54.0",
"glob": "^10.3.10",
"mocha": "^10.2.0",
Expand Down
12 changes: 9 additions & 3 deletions test/runTest.js → src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
const path = require('path');
import * as path from 'path';

const { runTests } = require('@vscode/test-electron');
import { runTests } from '@vscode/test-electron';

async function main() {
console.log('made it through the line before try block');
try {
console.log('inside try block');
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../');
const extensionDevelopmentPath = path.resolve(__dirname, '../../');

console.log('inside try block after first var declare');

// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index');

console.log('inside try block after second var declare');

// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const assert = require('assert');
import * as assert from 'assert'

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
const vscode = require('vscode');
import * as vscode from 'vscode'
// const myExtension = require('../extension');

suite('Extension Test Suite', () => {
vscode.window.showInformationMessage('Start all tests.');

test('Sample test', () => {
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
assert.strictEqual(-1, [1, 2, 3].indexOf(5)); // false
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
assert.strictEqual(0, [1, 2, 3].indexOf(1)); // true
});
});
13 changes: 5 additions & 8 deletions test/suite/index.js → src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const path = require('path');
const Mocha = require('mocha');
const glob = require('glob');
import * as path from 'path';
import * as Mocha from 'mocha';
import { glob } from 'glob';

async function run() {
export async function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
const mocha = new Mocha.default({
ui: 'tdd',
color: true
});
Expand All @@ -31,6 +31,3 @@ async function run() {
}
}

module.exports = {
run
};
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"allowJs": true,
"strict": false,
},
// "include": ["src", "src/types/index.d.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx"],
"tsnode": {
"esm": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/**/*.tsx", "src/**/**/*.ts"],
"exclude": [
"node_modules",
".vscode-test",
Expand Down