mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 12:45:39 +01:00
Replace mocha with tape (for security issue)
This commit is contained in:
parent
e47349321a
commit
f697f2e5ba
7 changed files with 154 additions and 695 deletions
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"delay": true,
|
||||
"ui": "tdd",
|
||||
"spec": "test/all.js"
|
||||
}
|
||||
|
|
@ -8,6 +8,5 @@
|
|||
/tsconfig.json
|
||||
/.npmignore
|
||||
/.travis.yml
|
||||
/.mocharc.json
|
||||
/.editorconfig
|
||||
/azure-pipelines.yml
|
||||
|
|
|
|||
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
|
|
@ -5,9 +5,11 @@
|
|||
"name": "Unit Tests",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
|
||||
"program": "${workspaceRoot}/node_modules/.bin/tape",
|
||||
"stopOnEntry": false,
|
||||
"args": [
|
||||
"-r",
|
||||
"./test/all.js",
|
||||
// "--grep",
|
||||
// "typescript"
|
||||
],
|
||||
|
|
|
|||
802
package-lock.json
generated
802
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,8 @@
|
|||
"scripts": {
|
||||
"compile": "mrmdir ./release && tsc -p ./src/tsconfig.json && tsc -p ./src/tsconfig.esm.json",
|
||||
"watch": "tsc -p ./src --watch",
|
||||
"test": "mocha",
|
||||
"watch-esm": "tsc -p ./src/tsconfig.esm.json --watch",
|
||||
"test": "tape -r ./test/all.js",
|
||||
"prepublishOnly": "npm run compile && node ./scripts/bundle"
|
||||
},
|
||||
"author": "Microsoft Corporation",
|
||||
|
|
@ -18,12 +19,13 @@
|
|||
"url": "https://github.com/Microsoft/monaco-languages/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/tape": "^4.2.34",
|
||||
"glob": "^7.1.6",
|
||||
"jsdom": "^16.2.1",
|
||||
"mocha": "^7.1.0",
|
||||
"monaco-editor-core": "0.20.0",
|
||||
"monaco-plugin-helpers": "^1.0.2",
|
||||
"requirejs": "^2.3.6",
|
||||
"tape": "^4.13.2",
|
||||
"terser": "^4.6.6",
|
||||
"typescript": "3.7.5"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import '../monaco.contribution';
|
||||
import {loadLanguage} from '../_.contribution';
|
||||
import * as assert from 'assert';
|
||||
import * as test from 'tape';
|
||||
|
||||
// Allow for running under nodejs/requirejs in tests
|
||||
const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
||||
|
|
@ -28,24 +28,23 @@ export function testTokenization(_language:string|string[], tests:ITestItem[][])
|
|||
languages = _language;
|
||||
}
|
||||
let mainLanguage = languages[0];
|
||||
suite(mainLanguage + ' tokenization', () => {
|
||||
test('', (done) => {
|
||||
|
||||
test(mainLanguage + ' tokenization', (t: test.Test) => {
|
||||
Promise.all(languages.map(l => loadLanguage(l))).then(() => {
|
||||
// clean stack
|
||||
setTimeout(() => {
|
||||
runTests(mainLanguage, tests);
|
||||
done();
|
||||
});
|
||||
}).then(null, done);
|
||||
runTests(t, mainLanguage, tests);
|
||||
t.end();
|
||||
});
|
||||
}).then(null, () => t.end());
|
||||
});
|
||||
}
|
||||
|
||||
function runTests(languageId:string, tests:ITestItem[][]): void {
|
||||
tests.forEach((test) => runTest(languageId, test));
|
||||
function runTests(t: test.Test, languageId:string, tests:ITestItem[][]): void {
|
||||
tests.forEach((test) => runTest(t, languageId, test));
|
||||
}
|
||||
|
||||
function runTest(languageId:string, test:ITestItem[]): void {
|
||||
function runTest(t: test.Test, languageId:string, test:ITestItem[]): void {
|
||||
|
||||
let text = test.map(t => t.line).join('\n');
|
||||
let actualTokens = _monaco.editor.tokenize(text, languageId);
|
||||
|
|
@ -61,5 +60,5 @@ function runTest(languageId:string, test:ITestItem[]): void {
|
|||
};
|
||||
});
|
||||
|
||||
assert.deepEqual(actual, test);
|
||||
t.deepEqual(actual, test);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ requirejs(['./test/setup'], function () {
|
|||
return;
|
||||
}
|
||||
requirejs(files.map(f => f.replace(/\.js$/, '')), function () {
|
||||
run(); // We can launch the tests!
|
||||
// We can launch the tests!
|
||||
}, function (err) {
|
||||
console.log(err);
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue