Add documentation for using Milkdown with various frameworks
- Created a new document for using components in Milkdown. - Added a guide for using plugins in Milkdown, including toggling plugins programmatically and listing official plugins. - Introduced a recipe for integrating Milkdown with Angular, including installation steps and component creation. - Added a recipe for using Milkdown with Next.js, detailing installation and component setup. - Created a guide for integrating Milkdown with NuxtJS, including installation and component creation. - Added a comprehensive guide for using Milkdown with React, covering both Crepe and core Milkdown usage. - Introduced a recipe for SolidJS integration with Milkdown, including installation and component creation. - Added a guide for using Milkdown with Svelte, detailing installation and component setup. - Created a comprehensive guide for integrating Milkdown with Vue, covering both Crepe and core Milkdown usage. - Added a recipe for using Milkdown with Vue2, including installation and component creation.
This commit is contained in:
75
completions-sample-code/vscode-node/extension/test/run.js
Normal file
75
completions-sample-code/vscode-node/extension/test/run.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
require('tsx/cjs');
|
||||
|
||||
const { globSync } = require('glob');
|
||||
const Mocha = require('mocha');
|
||||
const path = require('path');
|
||||
const dotenv = require('dotenv');
|
||||
const envfile = path.join(__dirname, '../../../../../../.env');
|
||||
dotenv.config({ path: envfile });
|
||||
|
||||
function run() {
|
||||
const projectRoot = path.resolve(__dirname, '../..');
|
||||
const mochaOptions = {
|
||||
ui: 'tdd',
|
||||
color: !process.env.NO_COLOR && process.env.TERM !== 'dumb',
|
||||
reporter: 'mocha-multi-reporters',
|
||||
reporterOptions: {
|
||||
reporterEnabled: 'spec',
|
||||
},
|
||||
};
|
||||
if (process.env.MOCHA_GREP) {
|
||||
mochaOptions.grep = process.env.MOCHA_GREP;
|
||||
}
|
||||
if (process.env.CI) {
|
||||
mochaOptions.forbidOnly = true;
|
||||
mochaOptions.retries = 2;
|
||||
mochaOptions.reporterOptions.reporterEnabled += ', mocha-junit-reporter';
|
||||
mochaOptions.reporterOptions.mochaJunitReporterReporterOptions = {
|
||||
testCaseSwitchClassnameAndName: true,
|
||||
testsuitesTitle: 'Copilot VS Code Extension Tests',
|
||||
mochaFile: path.resolve(projectRoot, 'test-results-Extension.xml'),
|
||||
};
|
||||
}
|
||||
if (process.env.GITHUB_EVENT_NAME === 'merge_group') {
|
||||
mochaOptions.retries = 3;
|
||||
}
|
||||
|
||||
// Create the mocha test
|
||||
const mocha = new Mocha(mochaOptions);
|
||||
|
||||
let fileCount = 0;
|
||||
(process.env.MOCHA_FILES || [
|
||||
path.resolve(projectRoot, 'lib/src/**/*.test.{ts,tsx}'),
|
||||
path.resolve(projectRoot, 'extension/src/**/*.test.{ts,tsx}')
|
||||
].join('\n')).split('\n').forEach(f => {
|
||||
globSync(f, { windowsPathsNoEscape: true }).forEach(f => {
|
||||
fileCount++;
|
||||
mocha.addFile(f);
|
||||
});
|
||||
});
|
||||
if (!fileCount) {
|
||||
throw new Error('No tests to run');
|
||||
}
|
||||
|
||||
return new Promise((c, e) => {
|
||||
try {
|
||||
// Run the mocha test
|
||||
mocha.run(failures => {
|
||||
if (failures > 0) {
|
||||
e(new Error(`${failures} tests failed.`));
|
||||
} else {
|
||||
c();
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
e(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { run };
|
||||
@@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { promises as fs } from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import yargs from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
||||
import { runTests } from '@vscode/test-electron';
|
||||
|
||||
async function main() {
|
||||
const tempdir = await fs.mkdtemp(os.tmpdir() + '/copilot-extension-test-');
|
||||
|
||||
let exitCode;
|
||||
try {
|
||||
// The folder containing the Extension Manifest package.json
|
||||
// Passed to `--extensionDevelopmentPath`
|
||||
const extensionDevelopmentPath = path.resolve(__dirname, '../..');
|
||||
|
||||
// The path to the extension test script (must be javascript)
|
||||
// Passed to --extensionTestsPath
|
||||
const extensionTestsPath = path.resolve(__dirname, './run');
|
||||
|
||||
const launchArgs = [];
|
||||
// Disable other extensions while testing,
|
||||
launchArgs.push('--disable-extensions');
|
||||
|
||||
// use a temporary folder so we can run multiple instances of the same VS Code together
|
||||
// see https://github.com/microsoft/vscode/issues/137678
|
||||
launchArgs.push('--user-data-dir', tempdir);
|
||||
|
||||
const argv = await yargs(hideBin(process.argv))
|
||||
.options({
|
||||
stable: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
grep: {
|
||||
alias: 'g',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
.parse();
|
||||
const version = argv.stable ? 'stable' : 'insiders';
|
||||
|
||||
const extensionTestsEnv: typeof process.env = {};
|
||||
// Pass arguments to mocha by environment variables
|
||||
if (argv.grep) { extensionTestsEnv.MOCHA_GREP = argv.grep; }
|
||||
if (argv._.length > 0) { extensionTestsEnv.MOCHA_FILES = argv._.join('\n'); }
|
||||
if (!process.stdout.isTTY) { extensionTestsEnv.NO_COLOR = 'true'; }
|
||||
const workspaceFolder = await fs.mkdtemp(path.join(os.tmpdir(), 'copilot-extension-test-'));
|
||||
launchArgs.push(workspaceFolder);
|
||||
|
||||
extensionTestsEnv.CORETEST = 'true';
|
||||
//@dbaeumer This can be removed as soon as we have the cache handle CORETEST
|
||||
extensionTestsEnv.VITEST = 'true';
|
||||
|
||||
// Download VS Code, unzip it and run the integration test
|
||||
exitCode = await runTests({
|
||||
version,
|
||||
extensionDevelopmentPath,
|
||||
extensionTestsPath,
|
||||
launchArgs,
|
||||
extensionTestsEnv,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Failed to run tests', err);
|
||||
exitCode = 1;
|
||||
} finally {
|
||||
await fs.rm(tempdir, { recursive: true });
|
||||
}
|
||||
process.exit(exitCode);
|
||||
}
|
||||
|
||||
void main();
|
||||
Reference in New Issue
Block a user