Skip to content

Commit

Permalink
Update to [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenWeatherford committed Jul 22, 2024
1 parent 8deb09e commit 30cacc2
Show file tree
Hide file tree
Showing 11 changed files with 2,301 additions and 590 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin"
"ms-vscode.vscode-typescript-tslint-plugin",
"ms-vscode.extension-test-runner"
]
}
37 changes: 32 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"stopOnEntry": false,
"sourceMaps": true,
// outFiles is used for locating generated JavaScript files, see https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps
"outFiles": [
Expand All @@ -36,7 +35,6 @@
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/index",
],
"stopOnEntry": false,
"sourceMaps": true,
// outFiles is used for locating generated JavaScript files, see https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps
"outFiles": [
Expand All @@ -46,6 +44,7 @@
"env": {
// =================================================================
"MOCHA_grep": "", // RegExp of tests to run (empty for all)
// NOTE: To change this for tests run on the command line, set env.MOCHA_grep in "gulpfile.ts"
// =================================================================
"MOCHA_invert": "0", // Invert the RegExp
"MOCHA_bail": "0", // Bail after first failure
Expand All @@ -70,7 +69,6 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
Expand All @@ -94,15 +92,44 @@
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test"
],
"stopOnEntry": false,
"sourceMaps": true,
// outFiles is used for locating generated JavaScript files, see https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: pretest-dev",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty for all)
"MOCHA_grep": "", // RegExp of tests to run (empty for all) -- affects F5 only asdfg?
"MOCHA_invert": "0", // Invert the RegExp
"MOCHA_bail": "0", // Bail after first failure
"MOCHA_enableTimeouts": "0", // Disable time-outs
"DEBUGTELEMETRY": "1", // 1=quiet; verbose=see telemetry in console; 0=send telemetry
"NODE_DEBUG": "",
"AZCODE_ARM_IGNORE_BUNDLE": "0",
"IS_RUNNING_TESTS": "1",
"ECHO_OUTPUT_CHANNEL_TO_CONSOLE": "1",
"BREAK_ON_ASSERT": "",
"ALWAYS_ECHO_TEST_LOG": "" // If 1 or true, always immediately echos test log to console; otherwise test log is only echoed after a failed testcase
}
},
// Launch tests with webpack
{
"name": "Launch Tests With Webpack (release)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test"
],
"sourceMaps": true,
// outFiles is used for locating generated JavaScript files, see https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: pretest-prod",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty for all) -- works for F5 only asdfg?
"MOCHA_invert": "0", // Invert the RegExp
"MOCHA_bail": "0", // Bail after first failure
"MOCHA_enableTimeouts": "0", // Disable time-outs
Expand Down
10 changes: 8 additions & 2 deletions extension.bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

// tslint:disable: no-consecutive-blank-lines // Format-on-save tends to add an extra line to the end of this file

/**
* This is the external face of extension.bundle.js, the main webpack bundle for the extension.
* Anything needing to be exposed outside of the extension sources must be exported from here, because
Expand All @@ -12,9 +14,13 @@
*
* The tests are not packaged with the webpack bundle and therefore only have access to code exported from this file.
*
* The tests should import '../extension.bundle.ts'. At design-time they live in tests/ and so will pick up this file (extension.bundle.ts).
* At runtime the tests live in dist/tests and will therefore pick up the main webpack bundle at dist/extension.bundle.js.
* The only non-test source files the .test.ts files should import is '../extension.bundle.ts'.
* At design-time and when running tests without webpack, the test sources are in <root>/test, so '../extension.bundle.ts' will
* point the ts compiler to this Typescript file (<root>/extension.bundle.ts).
* When running tests in webpack, the test sources live in <root>/dist/test, so '../extension.bundle.ts' will pick up the main
* webpacked bundle at <root>/dist/extension.bundle.js.
*/

import * as TLE from "./src/language/expressions/TLE";
import * as Json from "./src/language/json/JSON";
import * as basic from "./src/language/json/Tokenizer";
Expand Down
12 changes: 3 additions & 9 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import * as os from 'os';
import * as path from 'path';
import * as process from 'process';
import * as recursiveReadDir from 'recursive-readdir';
import * as rimraf from 'rimraf';
import * as shelljs from 'shelljs';
import { gulp_webpack } from 'vscode-azureextensiondev';
import { DEFAULT_TESTCASE_TIMEOUT_MS, langServerDotnetVersion, languageServerFolderName } from './common';
import { getTempFilePath } from './test/support/getTempFilePath';

import rimraf = require('rimraf');

const filesAndFoldersToPackage: string[] = [
// NOTE: License.txt and languageServer folder are handled separately so should not be in this list
Expand Down Expand Up @@ -76,14 +76,13 @@ interface IExpressionMetadata {
}[];
}

async function test(): Promise<void> {
async function pretest(): Promise<void> {
env.DEBUGTELEMETRY = '0'; // 1=quiet; verbose=see telemetry in console; 0=send telemetry
env.CODE_TESTS_PATH = path.join(__dirname, 'dist/test');
env.IS_RUNNING_TESTS = '1';
// This is the timeout for individual tests
env.MOCHA_timeout = String(DEFAULT_TESTCASE_TIMEOUT_MS);
env.MOCHA_enableTimeouts = "1";
env.MOCHA_grep = "";
env.DISABLE_SLOW_TESTS = "";
env.ALWAYS_ECHO_TEST_LOG = "";

Expand Down Expand Up @@ -129,11 +128,6 @@ async function test(): Promise<void> {
if (result.error) {
process.exit(1);
}

result = cp.spawnSync('node', ['./out/test/runTest.js'], { encoding: "utf-8", stdio: 'inherit', env, shell: true });
if (result.status !== 0) {
throw new Error("Tests failed");
}
}

function buildTLEGrammar(): void {
Expand Down Expand Up @@ -427,7 +421,7 @@ async function verifyTestsReferenceOnlyExtensionBundle(testFolder: string): Prom

exports['webpack-dev'] = gulp.series(() => gulp_webpack('development'), buildGrammars);
exports['webpack-prod'] = gulp.series(() => gulp_webpack('production'), buildGrammars);
exports.test = gulp.series(test);
exports.pretest = gulp.series(pretest);
exports['build-grammars'] = buildGrammars;
exports['watch-grammars'] = (): unknown => gulp.watch('grammars/**', buildGrammars);
exports['get-language-server'] = getLanguageServer;
Expand Down
Loading

0 comments on commit 30cacc2

Please sign in to comment.