Repository: microsoft/vscode (TypeScript) — Bug Fix

Issue:
Unit testing README is missing a flag
<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
- VS Code Version: 1.55
- OS Version: MacOS Big Sur

The unit testing readme instructions for running unit tests from node is missing the --ui tdd flag and doesn't work without it.

<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported direct to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->



Discussion:

Resolving patch:
diff --git a/src/vs/editor/contrib/linesOperations/linesOperations.ts b/src/vs/editor/contrib/linesOperations/linesOperations.ts
--- a/src/vs/editor/contrib/linesOperations/linesOperations.ts
+++ b/src/vs/editor/contrib/linesOperations/linesOperations.ts
@@ -1058,7 +1058,7 @@ export class SnakeCaseAction extends AbstractCaseAction {
 	protected _modifyText(text: string, wordSeparators: string): string {
 		return (text
 			.replace(/(\p{Ll})(\p{Lu})/gmu, '$1_$2')
-			.replace(/([^\b_])(\p{Lu})(\p{Ll})/gmu, '$1_$2$3')
+			.replace(/(\p{Lu}|\p{N})(\p{Lu})(\p{Ll})/gmu, '$1_$2$3')
 			.toLocaleLowerCase()
 		);
 	}


Test patch:
diff --git a/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts b/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts
--- a/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts
+++ b/src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts
@@ -549,7 +549,10 @@ suite('Editor Contrib - Line Operations', () => {
 				`function helloWorld() {
 				return someGlobalObject.printHelloWorld("en", "utf-8");
 				}
-				helloWorld();`.replace(/^\s+/gm, '')
+				helloWorld();`.replace(/^\s+/gm, ''),
+				`'JavaScript'`,
+				'parseHTML4String',
+				'_accessor: ServicesAccessor'
 			], {}, (editor) => {
 				let model = editor.getModel()!;
 				let uppercaseAction = new UpperCaseAction();
@@ -659,6 +662,21 @@ suite('Editor Contrib - Line Operations', () => {
 				}
 				hello_world();`.replace(/^\s+/gm, ''));
 				assertSelection(editor, new Selection(14, 1, 17, 15));
+
+				editor.setSelection(new Selection(18, 1, 18, 13));
+				executeAction(snakecaseAction, editor);
+				assert.strictEqual(model.getLineContent(18), `'java_script'`);
+				assertSelection(editor, new Selection(18, 1, 18, 14));
+
+				editor.setSelection(new Selection(19, 1, 19, 17));
+				executeAction(snakecaseAction, editor);
+				assert.strictEqual(model.getLineContent(19), 'parse_html4_string');
+				assertSelection(editor, new Selection(19, 1, 19, 19));
+
+				editor.setSelection(new Selection(20, 1, 20, 28));
+				executeAction(snakecaseAction, editor);
+				assert.strictEqual(model.getLineContent(20), '_accessor: services_accessor');
+				assertSelection(editor, new Selection(20, 1, 20, 29));
 			}
 		);
 
diff --git a/test/unit/README.md b/test/unit/README.md
--- a/test/unit/README.md
+++ b/test/unit/README.md
@@ -8,6 +8,7 @@ All unit tests are run inside a electron-browser environment which access to DOM
 
 - use the `--debug` to see an electron window with dev tools which allows for debugging
 - to run only a subset of tests use the `--run` or `--glob` options
+- use `yarn watch` to automatically compile changes
 
 For instance, `./scripts/test.sh --debug --glob **/extHost*.test.js` runs all tests from `extHost`-files and enables you to debug them.
 
@@ -24,7 +25,7 @@ Unit tests from layers `common` and `browser` are run inside `chromium`, `webkit
 
 ## Run (with node)
 
-	yarn run mocha --run src/vs/editor/test/browser/controller/cursor.test.ts
+	yarn run mocha --ui tdd --run src/vs/editor/test/browser/controller/cursor.test.ts
 
 
 ## Coverage