mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Add webpack as part of the smoketest
This commit is contained in:
parent
423a55b305
commit
dfe35b15bb
14 changed files with 57 additions and 41 deletions
|
|
@ -12,7 +12,9 @@
|
|||
vs: '../../release/dev/vs'
|
||||
}
|
||||
});
|
||||
require(['vs/editor/editor.main'], () => {});
|
||||
require(['vs/editor/editor.main'], () => {
|
||||
window.monacoAPI = monaco;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -35,14 +35,21 @@ yaserver
|
|||
});
|
||||
|
||||
async function runTests() {
|
||||
await runTest('chromium');
|
||||
await runTest('firefox');
|
||||
// await runTest('webkit');
|
||||
for (const type of ['amd', 'webpack']) {
|
||||
await runTest(type, 'chromium');
|
||||
await runTest(type, 'firefox');
|
||||
// await runTest(type, 'webkit');
|
||||
}
|
||||
}
|
||||
|
||||
function runTest(browser) {
|
||||
/**
|
||||
* @param {string} type
|
||||
* @param {'chromium'|'firefox'|'webkit'} browser
|
||||
* @returns
|
||||
*/
|
||||
function runTest(type, browser) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const env = { BROWSER: browser, ...process.env };
|
||||
const env = { BROWSER: browser, TESTS_TYPE: type, ...process.env };
|
||||
if (DEBUG_TESTS) {
|
||||
env['DEBUG_TESTS'] = 'true';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,12 @@ const { PORT } = require('./common');
|
|||
|
||||
const browserType = process.env.BROWSER || 'chromium';
|
||||
const DEBUG_TESTS = Boolean(process.env.DEBUG_TESTS || false);
|
||||
const URL = `http://127.0.0.1:${PORT}/test/smoke/amd.html`;
|
||||
const TESTS_TYPE = process.env.TESTS_TYPE || 'amd';
|
||||
|
||||
const URL =
|
||||
TESTS_TYPE === 'amd'
|
||||
? `http://127.0.0.1:${PORT}/test/smoke/amd.html`
|
||||
: `http://127.0.0.1:${PORT}/test/smoke/webpack/webpack.html`;
|
||||
|
||||
/** @type {playwright.Browser} */
|
||||
let browser;
|
||||
|
|
@ -59,8 +64,8 @@ afterEach(async () => {
|
|||
});
|
||||
|
||||
describe('Smoke Test', () => {
|
||||
it('`monaco` is exposed as global', async () => {
|
||||
assert.strictEqual(await page.evaluate(`typeof monaco`), 'object');
|
||||
it('`monacoAPI` is exposed as global', async () => {
|
||||
assert.strictEqual(await page.evaluate(`typeof monacoAPI`), 'object');
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -70,7 +75,7 @@ describe('Smoke Test', () => {
|
|||
*/
|
||||
async function createEditor(text, language) {
|
||||
return await page.evaluate(
|
||||
`window.ed = monaco.editor.create(document.getElementById('editor-container'), { value: '${text}', language: '${language}' })`
|
||||
`window.ed = monacoAPI.editor.create(document.getElementById('editor-container'), { value: '${text}', language: '${language}' })`
|
||||
);
|
||||
}
|
||||
|
||||
10
test/smoke/webpack/webpack.html
Normal file
10
test/smoke/webpack/webpack.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="editor-container" style="position: absolute; width: 500px; height: 400px"></div>
|
||||
<script type="text/javascript" src="out/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue