mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add index.js used to test xterm-core
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
Cursory test that 'xterm-core' works:
|
||||
|
||||
```
|
||||
# From root of this repo
|
||||
npm run compile # Outputs to xterm-core
|
||||
npx webpack --config core-webpack.config.js # Outputs to lib
|
||||
cd node-test
|
||||
npm link ../lib/
|
||||
node index.js
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
import { createRequire } from 'module';
|
||||
const require = createRequire(import.meta.url);
|
||||
const xterm = require('xterm-core');
|
||||
|
||||
console.log('Creating xterm-core terminal...');
|
||||
const terminal = new xterm.Terminal();
|
||||
console.log('Writing `ls` to terminal...')
|
||||
terminal.write('ls', () => {
|
||||
const bufferLine = terminal.buffer.normal.getLine(terminal.buffer.normal.cursorY);
|
||||
const contents = bufferLine.translateToString();
|
||||
console.log(`Contents of terminal active buffer are: ${contents}`); // ls
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": ""
|
||||
}
|
||||
Reference in New Issue
Block a user