Add index.js used to test xterm-core

This commit is contained in:
joyceerhl
2021-01-10 22:32:36 -08:00
parent 5e6e65c8da
commit 2f88498ad5
3 changed files with 33 additions and 0 deletions
+10
View File
@@ -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
```
+12
View File
@@ -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
});
+11
View File
@@ -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": ""
}