Alex Dima 3 anni fa
parent
commit
c75289c39d
4 ha cambiato i file con 322 aggiunte e 367 eliminazioni
  1. 1 3
      .vscode/launch.json
  2. 301 344
      package-lock.json
  3. 10 10
      package.json
  4. 10 10
      src/test/testRunner.ts

+ 1 - 3
.vscode/launch.json

@@ -5,11 +5,9 @@
 			"name": "Unit Tests",
 			"type": "node",
 			"request": "launch",
-			"program": "${workspaceRoot}/node_modules/.bin/tape",
+			"program": "./test/all.js",
 			"stopOnEntry": false,
 			"args": [
-				"-r",
-				"./test/all.js"
 				// "--grep",
 				// "typescript"
 			],

File diff suppressed because it is too large
+ 301 - 344
package-lock.json


+ 10 - 10
package.json

@@ -6,7 +6,7 @@
 		"compile": "mrmdir ./out && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json",
 		"watch": "tsc -p ./src --watch",
 		"watch-esm": "tsc -p ./src/tsconfig.esm.json --watch",
-		"test": "tape -r ./test/all.js",
+		"test": "node ./test/all.js",
 		"prepublishOnly": "mrmdir ./release && npm run compile && node ./scripts/release.js && node ./scripts/bundle",
 		"prettier": "prettier --write ."
 	},
@@ -20,18 +20,18 @@
 		"url": "https://github.com/Microsoft/monaco-languages/issues"
 	},
 	"devDependencies": {
-		"@types/tape": "^4.13.0",
-		"glob": "^7.1.6",
+		"@types/tape": "^4.13.2",
+		"glob": "^7.2.0",
 		"husky": "^4.3.8",
-		"jsdom": "^16.4.0",
-		"monaco-editor-core": "0.28.1",
+		"jsdom": "^17.0.0",
+		"monaco-editor-core": "0.29.1",
 		"monaco-plugin-helpers": "^1.0.3",
-		"prettier": "^2.2.1",
-		"pretty-quick": "^3.1.0",
+		"prettier": "^2.4.1",
+		"pretty-quick": "^3.1.1",
 		"requirejs": "^2.3.6",
-		"tape": "^5.1.1",
-		"terser": "^5.5.1",
-		"typescript": "4.1.3"
+		"tape": "^5.3.1",
+		"terser": "^5.9.0",
+		"typescript": "4.4.3"
 	},
 	"husky": {
 		"hooks": {

+ 10 - 10
src/test/testRunner.ts

@@ -18,6 +18,12 @@ export interface ITestItem {
 	tokens: IRelaxedToken[];
 }
 
+function timeout(ms: number) {
+	return new Promise((resolve, reject) => {
+		setTimeout(resolve, ms);
+	});
+}
+
 export function testTokenization(_language: string | string[], tests: ITestItem[][]): void {
 	let languages: string[];
 	if (typeof _language === 'string') {
@@ -27,16 +33,10 @@ export function testTokenization(_language: string | string[], tests: ITestItem[
 	}
 	let mainLanguage = languages[0];
 
-	test(mainLanguage + ' tokenization', (t: test.Test) => {
-		Promise.all(languages.map((l) => loadLanguage(l)))
-			.then(() => {
-				// clean stack
-				setTimeout(() => {
-					runTests(t, mainLanguage, tests);
-					t.end();
-				});
-			})
-			.then(null, () => t.end());
+	test(mainLanguage + ' tokenization', async (t: test.Test) => {
+		await Promise.all(languages.map((l) => loadLanguage(l)));
+		await timeout(0);
+		runTests(t, mainLanguage, tests);
 	});
 }
 

Some files were not shown because too many files changed in this diff