Add webpack as part of the smoketest

This commit is contained in:
Alex Dima 2021-11-15 22:16:09 +01:00
parent 423a55b305
commit dfe35b15bb
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
14 changed files with 57 additions and 41 deletions

View file

@ -1,2 +1,3 @@
/scripts/
/src/
/test/
/smoketest/

View file

@ -5,11 +5,12 @@
"main": "out/index.js",
"typings": "./out/index.d.ts",
"scripts": {
"test": "node ./node_modules/webpack/bin/webpack.js --config test/webpack.config.js --progress",
"smoketest": "node ./node_modules/webpack/bin/webpack.js --config smoketest/webpack.config.js --progress",
"test-cross-origin": "node ./node_modules/webpack/bin/webpack.js --config test/webpack-cross-origin.config.js --progress",
"watch": "tsc -w -p tsconfig.json",
"compile": "tsc -p tsconfig.json",
"import-editor": "node ./scripts/import-editor.js",
"prepublishOnly": "tsc -p tsconfig.json"
"prepublishOnly": "npm run compile"
},
"repository": {
"type": "git",

View file

@ -0,0 +1,4 @@
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
// expose the monaco API as a global for tests
window.monacoAPI = monaco;

View file

@ -1,17 +1,19 @@
const MonacoWebpackPlugin = require('../out/index.js');
const path = require('path');
const REPO_ROOT = path.join(__dirname, '../../');
module.exports = {
mode: 'development',
entry: './index.js',
context: __dirname,
output: {
path: path.resolve(__dirname, 'dist'),
path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
filename: 'app.js'
},
resolve: {
alias: {
'monaco-editor': path.resolve(__dirname, '../../release')
'monaco-editor': path.resolve(REPO_ROOT, 'release')
}
},
module: {
@ -28,7 +30,7 @@ module.exports = {
},
plugins: [
new MonacoWebpackPlugin({
monacoEditorPath: path.resolve(__dirname, '../../release')
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
})
]
};

View file

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<div id="container" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
<script type="text/javascript" src="app.js"></script>
</body>
</html>

View file

@ -1,6 +0,0 @@
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
monaco.editor.create(document.getElementById('container'), {
value: 'console.log("Hello, world")',
language: 'javascript'
});