Skip to content

Commit 54d06ad

Browse files
committed
moved testing related files into testing folder, eslint deleted unnecessary spacing, took out old comments, and added semi-colon for best syntax practice -- also tested testing and extension again before committing
1 parent 8c88a84 commit 54d06ad

File tree

14 files changed

+61
-138
lines changed

14 files changed

+61
-138
lines changed

.vscode-test.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

jest.config.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
const path = require('path');
22

3-
// module.exports = {
4-
// preset: 'ts-jest',
5-
// testEnvironment: './vscode-environment.js',
6-
// modulePaths: ['<rootDir>'],
7-
// // Add other Jest configurations as needed
8-
// // testMatch: ['**/test/**/*.js', '**/?(*.)+(spec|test).js'], // Match JavaScript files
9-
// moduleNameMapper: {
10-
// // '^@/(.*)$': 'build/src/$1', // Adjust this based on your project structure
11-
// vscode: path.join(__dirname, 'vscode.js') // <----- most important line
12-
// },
13-
// };
14-
153
module.exports = {
164
preset: "ts-jest",
175
testEnvironment: "node",
18-
preset: "ts-jest/presets/default-esm", // or other ESM presets
6+
preset: "ts-jest/presets/default-esm",
197
globals: {
208
"ts-jest": {
219
useESM: true,
2210
},
2311
},
2412
moduleNameMapper: {
25-
// '^@/(.*)$': 'build/src/$1',
26-
vscode: path.join(__dirname, 'vscode.js') // <----- most important line
13+
vscode: path.join(__dirname, 'src', 'test', 'vscode.js')
2714
},
2815
testMatch: ['**/test/**/*.js', '**/?(*.)+(spec|test).js'],
2916
modulePathIgnorePatterns: ["node_modules"]

src/extension.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Tree } from './types/tree';
66
let tree: Parser | undefined = undefined;
77
let panel: vscode.WebviewPanel | undefined = undefined
88

9-
109
// This method is called when your extension is activated
1110
// Your extension is activated the very first time the command is executed
1211
function activate(context: vscode.ExtensionContext) {

src/panel.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export function createPanel(context: vscode.ExtensionContext, data: Tree, column
1010
panel = vscode.window.createWebviewPanel(
1111
'reactLabyrinth',
1212
'React Labyrinth',
13-
1413
// create one new tab
1514
vscode.ViewColumn.One,
1615
{
@@ -19,23 +18,18 @@ export function createPanel(context: vscode.ExtensionContext, data: Tree, column
1918
}
2019
);
2120

22-
2321
// Set the icon logo of extension webview
2422
panel.iconPath = vscode.Uri.joinPath(context.extensionUri, 'media', 'favicon.ico');
2523

26-
2724
// Set URI to be the path to bundle
2825
const bundlePath: vscode.Uri = vscode.Uri.joinPath(context.extensionUri, 'build', 'bundle.js');
2926

30-
3127
// set webview URI to pass into html script
3228
const bundleURI: vscode.Uri = panel.webview.asWebviewUri(bundlePath);
3329

34-
3530
// render html of webview here
3631
panel.webview.html = createWebviewHTML(bundleURI, data);
3732

38-
3933
// Sends data to Flow.tsx to be displayed after parsed data is received
4034
panel.webview.onDidReceiveMessage(
4135
async (msg: any) => {
@@ -51,7 +45,6 @@ export function createPanel(context: vscode.ExtensionContext, data: Tree, column
5145
settings: vscode.workspace.getConfiguration('reactLabyrinth')
5246
});
5347
break;
54-
5548
}
5649
},
5750
undefined,
@@ -61,12 +54,9 @@ export function createPanel(context: vscode.ExtensionContext, data: Tree, column
6154
return panel
6255
};
6356

64-
65-
6657
// getNonce generates a new random string each time ext is used to prevent external injection of foreign code into the html
6758
const nonce: string = getNonce();
6859

69-
7060
// function to create the HTML page for webview
7161
function createWebviewHTML(URI: vscode.Uri, initialData: Tree) : string {
7262
return (

src/test/suite/index.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,5 @@
11
import * as path from 'path';
22
import { glob } from 'glob';
3-
4-
// export async function run(): Promise<void> {
5-
// // Create the mocha test
6-
// const mocha = new Mocha.default({
7-
// ui: 'tdd',
8-
// color: true
9-
// });
10-
11-
// const testsRoot = path.resolve(__dirname, '..');
12-
// const files = await glob('**/**.test.js', { cwd: testsRoot });
13-
14-
// // Add files to the test suite
15-
// files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
16-
17-
// try {
18-
// return new Promise((c, e) => {
19-
// // Run the mocha test
20-
// mocha.run(failures => {
21-
// if (failures > 0) {
22-
// e(new Error(`${failures} tests failed.`));
23-
// } else {
24-
// c();
25-
// }
26-
// });
27-
// });
28-
// } catch (err) {
29-
// console.error(err);
30-
// }
31-
// }
32-
333
import * as jest from 'jest';
344

355
export async function run(): Promise<void> {
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ class VsCodeEnvironment extends TestEnvironment {
1111
this.global.vscode = {};
1212
await super.teardown();
1313
}
14-
15-
// runScript(script) {
16-
// return super.runScript(script);
17-
// }
1814
}
1915

2016
module.exports = VsCodeEnvironment;
File renamed without changes.

src/types/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ export type Builder = {
77
viewData: any;
88
edgeId: number;
99
initialEdges: [];
10-
}
10+
};

src/types/connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ export enum ConnectionLineType {
44
Step = 'step',
55
SmoothStep = 'smoothstep',
66
SimpleBezier = 'simplebezier',
7-
}
7+
};

src/types/hierarchyData.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Tree } from "./tree"
22

3-
43
export interface hierarchyData {
54
id: string,
65
position: { x: number, y: number },
@@ -15,4 +14,4 @@ export interface hierarchyData {
1514
placeItems: string,
1615
backgroundColor: string,
1716
}
18-
}
17+
};

0 commit comments

Comments
 (0)