From ef193722911e462e6c3f8498c389e6bef8698e69 Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Tue, 21 Nov 2023 11:46:02 -0700 Subject: [PATCH 1/6] Update to node 18.15.0 and vscode 1.82.0 --- .github/workflows/build-and-test.yml | 2 +- .github/workflows/pr-build-and-test.yml | 2 +- .nvmrc | 2 +- contributing/developing.md | 2 +- .../analyticsdx-vscode-core/package.json | 6 ++--- .../telemetry/telemetry.test.ts | 22 +++++++++---------- .../analyticsdx-vscode-templates/package.json | 6 ++--- .../telemetry/telemetry.test.ts | 22 +++++++++---------- extensions/analyticsdx-vscode/package.json | 2 +- package.json | 4 ++-- .../analyticsdx-template-lint/package.json | 2 +- .../package.json | 2 +- 12 files changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 700b6889..8bd99bb8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -6,7 +6,7 @@ on: - develop env: - NODE_VERSION: '16.14.2' + NODE_VERSION: '18.15.0' jobs: # We really only need to run lint on one job so we'll do it here diff --git a/.github/workflows/pr-build-and-test.yml b/.github/workflows/pr-build-and-test.yml index 0c4c6cd5..d07c1b76 100644 --- a/.github/workflows/pr-build-and-test.yml +++ b/.github/workflows/pr-build-and-test.yml @@ -6,7 +6,7 @@ on: - develop env: - NODE_VERSION: '16.14.2' + NODE_VERSION: '18.15.0' jobs: pr-build: diff --git a/.nvmrc b/.nvmrc index 6276cf12..e048c8ca 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16.14.2 +v18.15.0 diff --git a/contributing/developing.md b/contributing/developing.md index abf956af..a69a07e9 100644 --- a/contributing/developing.md +++ b/contributing/developing.md @@ -3,7 +3,7 @@ ## Pre-requisites 1. We are using the same version of Node that the supported release of VSCode uses (see `engines.vscode` in the - extensions' `package.json`'s, currently 16.14.2). + extensions' `package.json`'s, currently 18.15.0). If you need to work with multiple versions of Node (e.g. for other projects), you might consider using [nvm](https://github.com/creationix/nvm). 1. It is suggested, though not required, that you use the Insiders version of VS diff --git a/extensions/analyticsdx-vscode-core/package.json b/extensions/analyticsdx-vscode-core/package.json index a41bc8d4..caa94393 100644 --- a/extensions/analyticsdx-vscode-core/package.json +++ b/extensions/analyticsdx-vscode-core/package.json @@ -19,7 +19,7 @@ }, "license": "BSD-3-Clause", "engines": { - "vscode": "^1.74.0" + "vscode": "^1.82.0" }, "categories": [ "Other" @@ -37,11 +37,11 @@ "@types/chai": "4.3.4", "@types/glob": "7.2.0", "@types/mocha": "10.0.1", - "@types/node": "16.18.14", + "@types/node": "18.11.9", "@types/semver": "7.5.0", "@types/sinon": "10.0.13", "@types/tmp": "0.2.2", - "@types/vscode": "1.74.0", + "@types/vscode": "1.82.0", "@types/which": "2.0.2", "chai": "4.3.7", "cross-env": "7.0.3", diff --git a/extensions/analyticsdx-vscode-core/test/vscode-integration/telemetry/telemetry.test.ts b/extensions/analyticsdx-vscode-core/test/vscode-integration/telemetry/telemetry.test.ts index 8f8264ba..245bbe8f 100644 --- a/extensions/analyticsdx-vscode-core/test/vscode-integration/telemetry/telemetry.test.ts +++ b/extensions/analyticsdx-vscode-core/test/vscode-integration/telemetry/telemetry.test.ts @@ -16,17 +16,17 @@ import { EXTENSION_NAME } from '../../../src/constants'; import { TelemetryService } from '../../../src/telemetry/telemetry'; class MockExtensionContext implements vscode.ExtensionContext { - public secrets!: vscode.SecretStorage; - public extensionUri!: vscode.Uri; - public environmentVariableCollection!: vscode.EnvironmentVariableCollection; - public storageUri: vscode.Uri | undefined; - public globalStorageUri!: vscode.Uri; - public logUri!: vscode.Uri; - public extension!: vscode.Extension; - public subscriptions: Array<{ dispose(): any }> = []; - public workspaceState!: vscode.Memento; - public globalState!: vscode.Memento & { setKeysForSync(keys: readonly string[]): void }; - public extensionPath: string = 'extensionPath'; + public secrets!: vscode.ExtensionContext['secrets']; + public extensionUri!: vscode.ExtensionContext['extensionUri']; + public environmentVariableCollection!: vscode.ExtensionContext['environmentVariableCollection']; + public storageUri: vscode.ExtensionContext['storageUri']; + public globalStorageUri!: vscode.ExtensionContext['globalStorageUri']; + public logUri!: vscode.ExtensionContext['logUri']; + public extension!: vscode.ExtensionContext['extension']; + public subscriptions = []; + public workspaceState!: vscode.ExtensionContext['workspaceState']; + public globalState!: vscode.ExtensionContext['globalState']; + public extensionPath = 'extensionPath'; public asAbsolutePath(relativePath: string): string { return relativePath; } diff --git a/extensions/analyticsdx-vscode-templates/package.json b/extensions/analyticsdx-vscode-templates/package.json index 8f8550d5..5be84b87 100644 --- a/extensions/analyticsdx-vscode-templates/package.json +++ b/extensions/analyticsdx-vscode-templates/package.json @@ -19,7 +19,7 @@ }, "license": "BSD-3-Clause", "engines": { - "vscode": "^1.74.0" + "vscode": "^1.82.0" }, "categories": [ "Other" @@ -38,10 +38,10 @@ "@types/chai": "4.3.4", "@types/lodash.isequal": "4.5.5", "@types/mocha": "10.0.1", - "@types/node": "16.18.14", + "@types/node": "18.11.9", "@types/sinon": "10.0.13", "@types/tmp": "0.2.2", - "@types/vscode": "1.74.0", + "@types/vscode": "1.82.0", "chai": "4.3.7", "cross-env": "7.0.3", "mocha": "10.2.0", diff --git a/extensions/analyticsdx-vscode-templates/test/vscode-integration/telemetry/telemetry.test.ts b/extensions/analyticsdx-vscode-templates/test/vscode-integration/telemetry/telemetry.test.ts index 238b0a74..423d132b 100644 --- a/extensions/analyticsdx-vscode-templates/test/vscode-integration/telemetry/telemetry.test.ts +++ b/extensions/analyticsdx-vscode-templates/test/vscode-integration/telemetry/telemetry.test.ts @@ -15,17 +15,17 @@ import { EXTENSION_NAME } from '../../../src/constants'; import { TelemetryService } from '../../../src/telemetry/telemetry'; class MockExtensionContext implements vscode.ExtensionContext { - public secrets!: vscode.SecretStorage; - public extensionUri!: vscode.Uri; - public environmentVariableCollection!: vscode.EnvironmentVariableCollection; - public storageUri: vscode.Uri | undefined; - public globalStorageUri!: vscode.Uri; - public logUri!: vscode.Uri; - public extension!: vscode.Extension; - public subscriptions: Array<{ dispose(): any }> = []; - public workspaceState!: vscode.Memento; - public globalState!: vscode.Memento & { setKeysForSync(keys: readonly string[]): void }; - public extensionPath: string = 'extensionPath'; + public secrets!: vscode.ExtensionContext['secrets']; + public extensionUri!: vscode.ExtensionContext['extensionUri']; + public environmentVariableCollection!: vscode.ExtensionContext['environmentVariableCollection']; + public storageUri: vscode.ExtensionContext['storageUri']; + public globalStorageUri!: vscode.ExtensionContext['globalStorageUri']; + public logUri!: vscode.ExtensionContext['logUri']; + public extension!: vscode.ExtensionContext['extension']; + public subscriptions = []; + public workspaceState!: vscode.ExtensionContext['workspaceState']; + public globalState!: vscode.ExtensionContext['globalState']; + public extensionPath = 'extensionPath'; public asAbsolutePath(relativePath: string): string { return relativePath; } diff --git a/extensions/analyticsdx-vscode/package.json b/extensions/analyticsdx-vscode/package.json index 06378177..5fdf3d51 100644 --- a/extensions/analyticsdx-vscode/package.json +++ b/extensions/analyticsdx-vscode/package.json @@ -18,7 +18,7 @@ }, "license": "BSD-3-Clause", "engines": { - "vscode": "^1.74.0" + "vscode": "^1.82.0" }, "devDependencies": { "shx": "0.3.4" diff --git a/package.json b/package.json index 621f6152..4c57f164 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,10 @@ "url": "git+https://github.com/forcedotcom/analyticsdx-vscode.git" }, "engines": { - "node": ">=16.14.2" + "node": ">=18.15.0" }, "dependencies": { - "node": "^16.14.2", + "node": "^18.15.0", "npm": "^6" }, "devDependencies": { diff --git a/packages/analyticsdx-template-lint/package.json b/packages/analyticsdx-template-lint/package.json index bad1971e..4278ce10 100644 --- a/packages/analyticsdx-template-lint/package.json +++ b/packages/analyticsdx-template-lint/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@types/chai": "4.3.4", "@types/mocha": "10.0.1", - "@types/node": "16.18.14", + "@types/node": "18.11.9", "ajv": "8.12.0", "better-ajv-errors": "1.2.0", "chai": "4.3.7", diff --git a/packages/analyticsdx-test-utils-vscode/package.json b/packages/analyticsdx-test-utils-vscode/package.json index fb206075..5e454f91 100644 --- a/packages/analyticsdx-test-utils-vscode/package.json +++ b/packages/analyticsdx-test-utils-vscode/package.json @@ -9,7 +9,7 @@ "@types/chai": "4.3.4", "@types/glob": "7.2.0", "@types/mocha": "10.0.1", - "@types/node": "16.18.14", + "@types/node": "18.11.9", "chai": "4.3.7", "decache": "4.6.1", "glob": "8.0.3", From f4fc25edfaf5fda849da883f6eb404dbedbb4137 Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Thu, 30 Nov 2023 11:22:27 -0700 Subject: [PATCH 2/6] Update to typescript 5.2.2 --- extensions/analyticsdx-vscode-core/package.json | 2 +- extensions/analyticsdx-vscode-templates/package.json | 2 +- package.json | 2 +- packages/analyticsdx-template-lint/package.json | 2 +- packages/analyticsdx-test-utils-vscode/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/analyticsdx-vscode-core/package.json b/extensions/analyticsdx-vscode-core/package.json index caa94393..5f9a3248 100644 --- a/extensions/analyticsdx-vscode-core/package.json +++ b/extensions/analyticsdx-vscode-core/package.json @@ -52,7 +52,7 @@ "nyc": "15.1.0", "shx": "0.3.4", "sinon": "15.0.1", - "typescript": "4.9.5" + "typescript": "5.2.2" }, "scripts": { "vscode:prepublish": "npm prune --production", diff --git a/extensions/analyticsdx-vscode-templates/package.json b/extensions/analyticsdx-vscode-templates/package.json index 5be84b87..6a88317a 100644 --- a/extensions/analyticsdx-vscode-templates/package.json +++ b/extensions/analyticsdx-vscode-templates/package.json @@ -52,7 +52,7 @@ "shx": "0.3.4", "sinon": "15.0.1", "tmp": "0.2.1", - "typescript": "4.9.5" + "typescript": "5.2.2" }, "scripts": { "vscode:prepublish": "npm prune --production", diff --git a/package.json b/package.json index 4c57f164..72d8913b 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "shx": "0.3.4", "tslint": "6.1.3", "tslint-no-focused-test": "0.5.0", - "typescript": "4.9.5", + "typescript": "5.2.2", "vsce": "1.103.1" }, "scripts": { diff --git a/packages/analyticsdx-template-lint/package.json b/packages/analyticsdx-template-lint/package.json index 4278ce10..b7c15bee 100644 --- a/packages/analyticsdx-template-lint/package.json +++ b/packages/analyticsdx-template-lint/package.json @@ -21,7 +21,7 @@ "mocha-multi-reporters": "1.5.1", "nyc": "15.1.0", "shx": "0.3.4", - "typescript": "4.9.5" + "typescript": "5.2.2" }, "optionalDependencies": { "vscode-json-languageservice": "^5.3.2" diff --git a/packages/analyticsdx-test-utils-vscode/package.json b/packages/analyticsdx-test-utils-vscode/package.json index 5e454f91..04cdb84f 100644 --- a/packages/analyticsdx-test-utils-vscode/package.json +++ b/packages/analyticsdx-test-utils-vscode/package.json @@ -25,7 +25,7 @@ "mock-spawn": "0.2.6", "shx": "0.3.4", "source-map-support": "0.5.21", - "typescript": "4.9.5" + "typescript": "5.2.2" }, "scripts": { "compile": "tsc -p ./", From 56fdab8becd4dc78ced16881adfe4f7b5132861c Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Thu, 30 Nov 2023 11:52:18 -0700 Subject: [PATCH 3/6] Use implicit extension activation Since 1.74, vscode will automatically add these activation events. --- extensions/analyticsdx-vscode-core/package.json | 11 +---------- extensions/analyticsdx-vscode-templates/package.json | 1 - 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/extensions/analyticsdx-vscode-core/package.json b/extensions/analyticsdx-vscode-core/package.json index 5f9a3248..7c574d69 100644 --- a/extensions/analyticsdx-vscode-core/package.json +++ b/extensions/analyticsdx-vscode-core/package.json @@ -77,16 +77,7 @@ ], "activationEvents": [ "workspaceContains:sfdx-project.json", - "onCommand:analyticsdx.app.create.blank", - "onCommand:analyticsdx.app.delete", - "onCommand:analyticsdx.dashboard.lwc.create", - "onCommand:analyticsdx.studio.open", - "onCommand:analyticsdx.studio.open.app", - "onCommand:analyticsdx.telemetry.send", - "onCommand:analyticsdx.template.create", - "onCommand:analyticsdx.template.delete", - "onCommand:analyticsdx.template.udpate", - "onCommand:analyticsdx.template.updateFromApp" + "onCommand:analyticsdx.telemetry.send" ], "main": "./out/src", "contributes": { diff --git a/extensions/analyticsdx-vscode-templates/package.json b/extensions/analyticsdx-vscode-templates/package.json index 6a88317a..0127cb63 100644 --- a/extensions/analyticsdx-vscode-templates/package.json +++ b/extensions/analyticsdx-vscode-templates/package.json @@ -78,7 +78,6 @@ "activationEvents": [ "onLanguage:json", "onLanguage:jsonc", - "onLanguage:adx-template-json", "onLanguage:html", "onLanguage:xml" ], From 5860e8516b52344ed2cb292a289bbd1ca3240671 Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Mon, 4 Dec 2023 15:48:48 -0700 Subject: [PATCH 4/6] Update devDependencies --- .../analyticsdx-vscode-core/package.json | 22 +++--- .../commands/gatherers/outputDirGatherer.ts | 4 +- .../analyticsdx-vscode-templates/package.json | 16 ++-- package.json | 4 +- .../analyticsdx-template-lint/package.json | 10 +-- .../package.json | 22 +++--- .../src/testrunner.ts | 75 +++++++++---------- .../tsconfig.json | 1 + 8 files changed, 74 insertions(+), 80 deletions(-) diff --git a/extensions/analyticsdx-vscode-core/package.json b/extensions/analyticsdx-vscode-core/package.json index 7c574d69..f9a2e73c 100644 --- a/extensions/analyticsdx-vscode-core/package.json +++ b/extensions/analyticsdx-vscode-core/package.json @@ -27,31 +27,31 @@ "dependencies": { "@salesforce/salesforcedx-utils-vscode": "file:../../lib/salesforcedx-utils-vscode.tgz", "@salesforce/templates": "54.7.0", - "glob": "8.0.3", + "glob": "10.3.10", "semver": "7.5.4", "tmp": "0.2.1", "which": "3.0.0" }, "devDependencies": { "@salesforce/analyticsdx-test-utils-vscode": "1.0.0", - "@types/chai": "4.3.4", - "@types/glob": "7.2.0", - "@types/mocha": "10.0.1", + "@types/chai": "4.3.11", + "@types/glob": "8.1.0", + "@types/mocha": "10.0.6", "@types/node": "18.11.9", - "@types/semver": "7.5.0", - "@types/sinon": "10.0.13", - "@types/tmp": "0.2.2", + "@types/semver": "7.5.6", + "@types/sinon": "17.0.2", + "@types/tmp": "0.2.6", "@types/vscode": "1.82.0", - "@types/which": "2.0.2", - "chai": "4.3.7", + "@types/which": "3.0.3", + "chai": "4.3.10", "cross-env": "7.0.3", "mocha": "10.2.0", - "mocha-junit-reporter": "2.2.0", + "mocha-junit-reporter": "2.2.1", "mocha-multi-reporters": "1.5.1", "mock-spawn": "0.2.6", "nyc": "15.1.0", "shx": "0.3.4", - "sinon": "15.0.1", + "sinon": "17.0.1", "typescript": "5.2.2" }, "scripts": { diff --git a/extensions/analyticsdx-vscode-core/src/commands/gatherers/outputDirGatherer.ts b/extensions/analyticsdx-vscode-core/src/commands/gatherers/outputDirGatherer.ts index af141dbf..f943ece4 100644 --- a/extensions/analyticsdx-vscode-core/src/commands/gatherers/outputDirGatherer.ts +++ b/extensions/analyticsdx-vscode-core/src/commands/gatherers/outputDirGatherer.ts @@ -5,7 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -import * as glob from 'glob'; +import { globSync } from 'glob'; import * as path from 'path'; import * as vscode from 'vscode'; import { nls } from '../../messages'; @@ -59,7 +59,7 @@ export class OutputDirGatherer implements ParametersGatherer { const packages = packageDirs.length > 1 ? `{${packageDirs.join(',')}}` : packageDirs[0]; // glob patterns have to use / (https://github.com/isaacs/node-glob#windows) const pattern = path.join(rootPath, packages, '**', path.sep).replace(/\\/g, '/'); - return new glob.GlobSync(pattern).found.map(value => { + return globSync(pattern).map(value => { const relativePath = path.relative(rootPath, path.join(value, path.sep)); return path.join(relativePath, this.typeDirRequired && !relativePath.endsWith(this.typeDir) ? this.typeDir : ''); }); diff --git a/extensions/analyticsdx-vscode-templates/package.json b/extensions/analyticsdx-vscode-templates/package.json index 0127cb63..1fd48022 100644 --- a/extensions/analyticsdx-vscode-templates/package.json +++ b/extensions/analyticsdx-vscode-templates/package.json @@ -35,22 +35,22 @@ }, "devDependencies": { "@salesforce/analyticsdx-test-utils-vscode": "1.0.0", - "@types/chai": "4.3.4", - "@types/lodash.isequal": "4.5.5", - "@types/mocha": "10.0.1", + "@types/chai": "4.3.11", + "@types/lodash.isequal": "4.5.8", + "@types/mocha": "10.0.6", "@types/node": "18.11.9", - "@types/sinon": "10.0.13", - "@types/tmp": "0.2.2", + "@types/sinon": "17.0.2", + "@types/tmp": "0.2.6", "@types/vscode": "1.82.0", - "chai": "4.3.7", + "chai": "4.3.10", "cross-env": "7.0.3", "mocha": "10.2.0", - "mocha-junit-reporter": "2.2.0", + "mocha-junit-reporter": "2.2.1", "mocha-multi-reporters": "1.5.1", "nyc": "15.1.0", "readdirp": "3.6.0", "shx": "0.3.4", - "sinon": "15.0.1", + "sinon": "17.0.1", "tmp": "0.2.1", "typescript": "5.2.2" }, diff --git a/package.json b/package.json index 72d8913b..02a4eeaa 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ }, "devDependencies": { "@salesforce/dev-config": "1.5.0", - "@types/lerna-alias": "3.0.0", + "@types/lerna-alias": "3.0.4", "@types/shelljs": "0.8.11", - "@vscode/test-electron": "2.3.0", + "@vscode/test-electron": "2.3.8", "eslint": "6.7.2", "eslint-config-prettier": "2.9.0", "lerna": "4.0.0", diff --git a/packages/analyticsdx-template-lint/package.json b/packages/analyticsdx-template-lint/package.json index b7c15bee..fbb874f3 100644 --- a/packages/analyticsdx-template-lint/package.json +++ b/packages/analyticsdx-template-lint/package.json @@ -10,21 +10,21 @@ "jsonc-parser": "3.2.0" }, "devDependencies": { - "@types/chai": "4.3.4", - "@types/mocha": "10.0.1", + "@types/chai": "4.3.11", + "@types/mocha": "10.0.6", "@types/node": "18.11.9", "ajv": "8.12.0", "better-ajv-errors": "1.2.0", - "chai": "4.3.7", + "chai": "4.3.10", "mocha": "10.2.0", - "mocha-junit-reporter": "2.2.0", + "mocha-junit-reporter": "2.2.1", "mocha-multi-reporters": "1.5.1", "nyc": "15.1.0", "shx": "0.3.4", "typescript": "5.2.2" }, "optionalDependencies": { - "vscode-json-languageservice": "^5.3.2" + "vscode-json-languageservice": "^5.3.7" }, "files": [ "out/src" diff --git a/packages/analyticsdx-test-utils-vscode/package.json b/packages/analyticsdx-test-utils-vscode/package.json index 04cdb84f..7b87fab3 100644 --- a/packages/analyticsdx-test-utils-vscode/package.json +++ b/packages/analyticsdx-test-utils-vscode/package.json @@ -6,21 +6,21 @@ "description": "Provides test utilities to run mocha tests", "license": "BSD-3-Clause", "devDependencies": { - "@types/chai": "4.3.4", - "@types/glob": "7.2.0", - "@types/mocha": "10.0.1", + "@types/chai": "4.3.11", + "@types/glob": "8.1.0", + "@types/mocha": "10.0.6", "@types/node": "18.11.9", - "chai": "4.3.7", - "decache": "4.6.1", - "glob": "8.0.3", - "istanbul-lib-coverage": "3.2.0", + "chai": "4.3.10", + "decache": "4.6.2", + "glob": "10.3.10", + "istanbul-lib-coverage": "3.2.2", "istanbul-lib-hook": "3.0.0", - "istanbul-lib-instrument": "5.2.1", - "istanbul-lib-report": "3.0.0", + "istanbul-lib-instrument": "6.0.1", + "istanbul-lib-report": "3.0.1", "istanbul-lib-source-maps": "4.0.1", - "istanbul-reports": "3.1.5", + "istanbul-reports": "3.1.6", "mocha": "10.2.0", - "mocha-junit-reporter": "2.2.0", + "mocha-junit-reporter": "2.2.1", "mocha-multi-reporters": "1.5.1", "mock-spawn": "0.2.6", "shx": "0.3.4", diff --git a/packages/analyticsdx-test-utils-vscode/src/testrunner.ts b/packages/analyticsdx-test-utils-vscode/src/testrunner.ts index dc3e9319..f6dbb886 100644 --- a/packages/analyticsdx-test-utils-vscode/src/testrunner.ts +++ b/packages/analyticsdx-test-utils-vscode/src/testrunner.ts @@ -5,7 +5,7 @@ 'use strict'; import * as fs from 'fs'; -import * as glob from 'glob'; +import { globSync } from 'glob'; import * as paths from 'path'; // tslint:disable:no-var-requires @@ -86,47 +86,40 @@ function run(testsRoot: any, clb: any): any { coverageRunner.setupCoverage(); } - // Glob test files - glob('**/**.test.js', { cwd: testsRoot }, (error, files): any => { - if (error) { - console.error('An error occured: ' + error); - return clb(error); - } - try { - // Fill into Mocha - files.forEach( - (f): Mocha => { - return mocha.addFile(paths.join(testsRoot, f)); - } - ); - // Run the tests - let failureCount = 0; + try { + // Glob test files + const files = globSync('**/**.test.js', { cwd: testsRoot }); + // Fill into Mocha + files.forEach((f): Mocha => { + return mocha.addFile(paths.join(testsRoot, f)); + }); + // Run the tests + let failureCount = 0; - mocha - .run((failures: any) => { - process.on('exit', () => { - console.log(`Existing test process, code should be ${failureCount}`); - process.exit(failures); // exit with non-zero status if there were failures - }); - }) - .on('fail', (test: any, err: any): void => { - const testName = - (test.parent && test.parent.fullTitle ? test.parent.fullTitle() + ' ' : '') + (test.title || test); - console.log(`Failure in test '${testName}': ${err}`); - failureCount++; - }) - .on('end', (): void => { - console.log(`Tests ended with ${failureCount} failure(s)`); - clb(undefined, failureCount); - if (coverageRunner) { - coverageRunner.reportCoverage(); - } + mocha + .run((failures: any) => { + process.on('exit', () => { + console.log(`Existing test process, code should be ${failureCount}`); + process.exit(failures); // exit with non-zero status if there were failures }); - } catch (error) { - console.error('An error occured: ', error); - return clb(error); - } - }); + }) + .on('fail', (test: any, err: any): void => { + const testName = + (test.parent && test.parent.fullTitle ? test.parent.fullTitle() + ' ' : '') + (test.title || test); + console.log(`Failure in test '${testName}': ${err}`); + failureCount++; + }) + .on('end', (): void => { + console.log(`Tests ended with ${failureCount} failure(s)`); + clb(undefined, failureCount); + if (coverageRunner) { + coverageRunner.reportCoverage(); + } + }); + } catch (error) { + console.error('An error occured: ', error); + return clb(error); + } } exports.run = run; @@ -169,7 +162,7 @@ class CoverageRunner { }); const sourceRoot = paths.join(self.testsRoot, self.options.relativeSourcePath); // Glob source files - const srcFiles = glob.sync('**/**.js', { + const srcFiles = globSync('**/**.js', { cwd: sourceRoot, ignore: self.options.ignorePatterns }); diff --git a/packages/analyticsdx-test-utils-vscode/tsconfig.json b/packages/analyticsdx-test-utils-vscode/tsconfig.json index b70a1ab5..62281239 100644 --- a/packages/analyticsdx-test-utils-vscode/tsconfig.json +++ b/packages/analyticsdx-test-utils-vscode/tsconfig.json @@ -10,6 +10,7 @@ "rootDir": ".", "outDir": "out", "preserveConstEnums": true, + "skipLibCheck": true, "strict": true }, "exclude": ["node_modules", "out"] From d6f07e32c0592321bd3c87dd62e5d17bfbaabf0b Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Mon, 4 Dec 2023 17:03:45 -0700 Subject: [PATCH 5/6] Update fuse.js 6.6.2 -> 7.0.0 --- packages/analyticsdx-template-lint/package.json | 2 +- packages/analyticsdx-template-lint/src/utils.ts | 4 ++-- packages/analyticsdx-template-lint/tsconfig.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/analyticsdx-template-lint/package.json b/packages/analyticsdx-template-lint/package.json index fbb874f3..fe8086ae 100644 --- a/packages/analyticsdx-template-lint/package.json +++ b/packages/analyticsdx-template-lint/package.json @@ -6,7 +6,7 @@ "description": "Provides a linting api for Salesforce/TableauCRM analytics templates", "license": "BSD-3-Clause", "dependencies": { - "fuse.js": "6.6.2", + "fuse.js": "7.0.0", "jsonc-parser": "3.2.0" }, "devDependencies": { diff --git a/packages/analyticsdx-template-lint/src/utils.ts b/packages/analyticsdx-template-lint/src/utils.ts index 3c6d777d..5a220488 100644 --- a/packages/analyticsdx-template-lint/src/utils.ts +++ b/packages/analyticsdx-template-lint/src/utils.ts @@ -6,7 +6,7 @@ */ import * as fs from 'fs'; -import Fuse from 'fuse.js'; +import Fuse, { IFuseOptions } from 'fuse.js'; import { JSONPath, Node as JsonNode } from 'jsonc-parser'; const jsonIdRegex = /^[A-Za-z][A-Za-z0-9_]*$/; @@ -190,7 +190,7 @@ export function isValidVariableName(name: string): boolean { } const noFuzzyMatch = () => []; -const fuzzOptions: Fuse.IFuseOptions = { +const fuzzOptions: IFuseOptions = { isCaseSensitive: false, shouldSort: true }; diff --git a/packages/analyticsdx-template-lint/tsconfig.json b/packages/analyticsdx-template-lint/tsconfig.json index 24f2f8db..9c7b1b6c 100644 --- a/packages/analyticsdx-template-lint/tsconfig.json +++ b/packages/analyticsdx-template-lint/tsconfig.json @@ -3,10 +3,10 @@ "module": "commonjs", "target": "ES2020", "lib": ["ES2020"], - // fuse.js only works w/ esModuleInterop on - "esModuleInterop": true, "sourceMap": true, "declaration": true, + // need this for fuse.js to work right + "esModuleInterop": true, "moduleResolution": "node", "noImplicitAny": true, "rootDir": ".", From d41d4ef58aca335c199f84b595d188d1ab243584 Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Mon, 4 Dec 2023 22:23:00 -0700 Subject: [PATCH 6/6] Update which from 3.0.0 to 4.0.0 --- extensions/analyticsdx-vscode-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/analyticsdx-vscode-core/package.json b/extensions/analyticsdx-vscode-core/package.json index f9a2e73c..0e7a894f 100644 --- a/extensions/analyticsdx-vscode-core/package.json +++ b/extensions/analyticsdx-vscode-core/package.json @@ -30,7 +30,7 @@ "glob": "10.3.10", "semver": "7.5.4", "tmp": "0.2.1", - "which": "3.0.0" + "which": "4.0.0" }, "devDependencies": { "@salesforce/analyticsdx-test-utils-vscode": "1.0.0",