diff --git a/e2e/src/command.test.ts b/e2e/src/command.test.ts deleted file mode 100644 index a3dcf092..00000000 --- a/e2e/src/command.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { By, VSBrowser, EditorView, WebView, Workbench, Notification, StatusBar, NotificationType } from "vscode-extension-tester"; -import { expect } from "chai"; -import { sleep } from "./utils"; -import { join } from "path"; - -// https://github.com/microsoft/vscode-java-dependency/blob/4256fa6adcaff5ec24dbdbb8d9a516fad21431c5/test/ui/index.ts -// https://github.com/microsoft/vscode-java-dependency/blob/4256fa6adcaff5ec24dbdbb8d9a516fad21431c5/test/ui/command.test.ts - -describe("Initialization testing", function() { - this.timeout(2 * 60 * 1000 /*ms*/); - - let workbench: Workbench; - let view: WebView; - - before(async function() { - await VSBrowser.instance.openResources(join(__dirname, '../sample')); - await sleep(3000); - workbench = new Workbench(); - - await workbench.executeCommand("frontMatter.dashboard"); - await sleep(3000); - - await new EditorView().openEditor(`FrontMatter Dashboard`); - - view = new WebView(); - await view.switchToFrame(); - }); - - it("1. Open welcome dashboard", async function() { - const element = await view.findWebElement(By.css('h1')); - - const title = await element.getText(); - - expect(title).has.string(`Front Matter`); - }); - - it("2. Initialize project", async function() { - const btn = await view.findWebElement(By.css('[data-test="welcome-init"] button')); - expect(btn).to.exist; - - await btn.click(); - - await sleep(1000); - - await VSBrowser.instance.driver.wait(() => { - return notificationExists(workbench, 'Front Matter:'); - }, 2000) as Notification; - - const notifications = await workbench.getNotifications(); - - let notification!: Notification; - for (const not of notifications) { - console.log(not); - - // const message = await not.get; - // console.log(message); - // if (message.includes('Front Matter:')) { - // notification = not; - // } - } - - expect(await notification.getMessage()).has.string(`Project initialized successfully.`); - }); - - it("3. Check if project file is created", async function() {}); -}); - - -async function notificationExists(workbench: Workbench, text: string): Promise { - const notifications = await (await (new StatusBar()).openNotificationsCenter()).getNotifications(NotificationType.Info); - - for (const notification of notifications) { - const message = await notification.getMessage(); - if (message.indexOf(text) >= 0) { - return notification; - } - } -} diff --git a/e2e/src/runTests.ts b/e2e/src/runTests.ts deleted file mode 100644 index 99a69824..00000000 --- a/e2e/src/runTests.ts +++ /dev/null @@ -1,33 +0,0 @@ -import * as path from 'path' -import * as semver from 'semver' -import { ExTester, ReleaseQuality } from 'vscode-extension-tester' - -async function main(): Promise { - const vsCodeVersion: semver.SemVer = new semver.SemVer(`1.66.0`) - const version = vsCodeVersion.version - - const storageFolder = path.join(__dirname, '..', 'storage') - const extFolder = path.join(__dirname, '..', 'extensions') - - try { - const testPath = path.join(__dirname, 'command.test.js') - - const exTester = new ExTester(storageFolder, ReleaseQuality.Stable, extFolder) - await exTester.downloadCode(version) - await exTester.installVsix({ useYarn: false }) - // await exTester.installFromMarketplace("eliostruyf.vscode-front-matter"); - await exTester.downloadChromeDriver(version) - // await exTester.setupRequirements({vscodeVersion: version}); - const result = await exTester.runTests(testPath, { - vscodeVersion: version, - resources: [storageFolder], - }) - - process.exit(result) - } catch (err) { - console.log(err) - process.exit(1) - } -} - -main() diff --git a/e2e/src/utils/index.ts b/e2e/src/utils/index.ts deleted file mode 100644 index 4d817879..00000000 --- a/e2e/src/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './sleep'; diff --git a/e2e/src/utils/sleep.ts b/e2e/src/utils/sleep.ts deleted file mode 100644 index 9163d274..00000000 --- a/e2e/src/utils/sleep.ts +++ /dev/null @@ -1,3 +0,0 @@ -export async function sleep(time: number) { - await new Promise((resolve) => setTimeout(resolve, time)); -} \ No newline at end of file diff --git a/package.json b/package.json index 3636f731..71790f6b 100644 --- a/package.json +++ b/package.json @@ -2564,9 +2564,6 @@ "prod:panel": "webpack --mode production --config ./webpack/panel.config.js", "test-compile": "tsc -p ./", "clean": "rimraf dist", - "start:site": "cd ./docs && npm run dev", - "clean:test": "rm ./e2e/sample/frontmatter.json || exit 0 && rm -rf ./e2e/sample/.frontmatter || exit 0", - "test": "npm run lint; tsc -p tsconfig.e2e.json && npm run clean:test && npm run i -g @vscode/vsce && node ./e2e/out/runTests.js", "lint": "eslint --max-warnings=0 ./src/{commands,components}", "prettier": "prettier --write ./src", "localization:watch": "node ./scripts/watch-localization.js", diff --git a/src/commands/Article.ts b/src/commands/Article.ts index 7936b622..ca2ad508 100644 --- a/src/commands/Article.ts +++ b/src/commands/Article.ts @@ -363,7 +363,7 @@ export class Article { return; } - let position = editor.selection.active; + const position = editor.selection.active; const selectionText = editor.document.getText(editor.selection); // Check for snippet wrapper diff --git a/src/commands/Cache.ts b/src/commands/Cache.ts index 65eb5306..bdf49a3a 100644 --- a/src/commands/Cache.ts +++ b/src/commands/Cache.ts @@ -22,7 +22,7 @@ export class Cache { await Extension.getInstance().setState(key, data, type); } - public static async clear(showNotification: boolean = true) { + public static async clear(showNotification = true) { const ext = Extension.getInstance(); await ext.setState(ExtensionState.Dashboard.Pages.Cache, undefined, 'workspace', true); diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index 10f8513b..9059ba02 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -283,7 +283,6 @@ export class Folders { public static async getInfo(limit?: number): Promise { const supportedFiles = Settings.get(SETTING_CONTENT_SUPPORTED_FILETYPES); const folders = Folders.get(); - const wsFolder = parseWinPath(Folders.getWorkspaceFolder()?.fsPath || ''); if (folders && folders.length > 0) { const folderInfo: FolderInfo[] = []; diff --git a/src/commands/Preview.ts b/src/commands/Preview.ts index 835b6030..18d05571 100644 --- a/src/commands/Preview.ts +++ b/src/commands/Preview.ts @@ -199,7 +199,7 @@ export class Preview { * @param filePath * @param slug */ - public static async updatePageUrl(filePath: string, slug?: string) { + public static async updatePageUrl(filePath: string, _: string) { const webView = this.webviews[filePath]; if (webView) { const localhost = await this.getLocalServerUrl(); diff --git a/src/commands/Settings.ts b/src/commands/Settings.ts index f87f7460..61a3a0c7 100644 --- a/src/commands/Settings.ts +++ b/src/commands/Settings.ts @@ -24,7 +24,7 @@ export class Settings { }); if (newOption) { - let options = (await TaxonomyHelper.get(type)) || []; + const options = (await TaxonomyHelper.get(type)) || []; if (options.find((o) => o === newOption)) { Notifications.warning(l10n.t(LocalizationKey.commandsSettingsCreateWarning, taxonomy)); diff --git a/src/commands/Template.ts b/src/commands/Template.ts index 3ee00cdc..3c17921f 100644 --- a/src/commands/Template.ts +++ b/src/commands/Template.ts @@ -163,7 +163,7 @@ export class Template { await copyFileAsync(template.fsPath, newFilePath); // Update the properties inside the template - let frontMatter = await ArticleHelper.getFrontMatterByPath(newFilePath); + const frontMatter = await ArticleHelper.getFrontMatterByPath(newFilePath); if (!frontMatter) { Notifications.warning(l10n.t(LocalizationKey.commonError)); return; diff --git a/tsconfig.e2e.json b/tsconfig.e2e.json deleted file mode 100644 index ecaaf0a8..00000000 --- a/tsconfig.e2e.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "outDir": "e2e/out", - "lib": [ - "es6", - "dom" - ], - "sourceMap": true, - "strict": false, - "noUnusedLocals": true, - "experimentalDecorators": true, - "resolveJsonModule": true, - "skipLibCheck": true - }, - "include": [ - "e2e/src/**/*" - ], - "exclude": [ - "node_modules", - "src" - ] -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 2ae4f001..47ede041 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,6 @@ "exclude": [ "node_modules", ".vscode-test", - "docs", - "e2e" + "docs" ] }