Update e2e tests

- Tweak things on win for settings combinations which might
  work with all trouble you're getting from win versions and
  node-pty, etc.
- Relates #401
This commit is contained in:
Janne Valkealahti
2022-05-10 09:40:56 +01:00
parent 8af3bd892e
commit 1a1864f8c5
7 changed files with 4431 additions and 3105 deletions

View File

@@ -11,7 +11,7 @@ jobs:
matrix:
include:
- nickname: win
os: windows-2019
os: windows-latest
graal: 22.0.0.2
- nickname: macos
os: macos-latest
@@ -36,7 +36,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '16'
- run: |
./mvnw clean package -Pnative
- uses: actions/upload-artifact@v2

File diff suppressed because it is too large Load Diff

View File

@@ -41,31 +41,10 @@ describe('builtin commands', () => {
cli?.dispose();
}, testTimeout);
/**
* native commands
*/
describe(nativeDesc, () => {
beforeAll(() => {
command = nativeCommand;
});
it(
versionReturnsInfoDesc,
async () => {
cli = new Cli({
command: command,
options: [...options, ...versionCommand]
});
await versionReturnsInfo(cli);
},
testTimeout
);
});
/**
* fatjar commands
*/
describe(jarDesc, () => {
describe(jarDesc, () => {
beforeAll(() => {
command = jarCommand;
options = jarOptions;
@@ -83,4 +62,26 @@ describe('builtin commands', () => {
testTimeout
);
});
/**
* native commands
*/
describe(nativeDesc, () => {
beforeAll(() => {
command = nativeCommand;
options = [];
});
it(
versionReturnsInfoDesc,
async () => {
cli = new Cli({
command: command,
options: [...options, ...versionCommand]
});
await versionReturnsInfo(cli);
},
testTimeout
);
});
});

View File

@@ -65,27 +65,6 @@ describe('flow commands', () => {
cli?.dispose();
}, testTimeout);
/**
* native commands
*/
describe(nativeDesc, () => {
beforeAll(() => {
command = nativeCommand;
});
it(
flowConditionalField2SkipsFields1Desc,
async () => {
cli = new Cli({
command: command,
options: [...options, ...flowConditionalCommand]
});
await flowConditionalField2SkipsFields1(cli);
},
testTimeout
);
});
/**
* fatjar commands
*/
@@ -107,4 +86,26 @@ describe('flow commands', () => {
testTimeout
);
});
/**
* native commands
*/
describe(nativeDesc, () => {
beforeAll(() => {
command = nativeCommand;
options = [];
});
it(
flowConditionalField2SkipsFields1Desc,
async () => {
cli = new Cli({
command: command,
options: [...options, ...flowConditionalCommand]
});
await flowConditionalField2SkipsFields1(cli);
},
testTimeout
);
});
});

View File

@@ -1,8 +1,73 @@
{
"name": "spring-shell-e2e",
"version": "2.1.0",
"lockfileVersion": 1,
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "spring-shell-e2e",
"version": "2.1.0",
"license": "ISC",
"dependencies": {
"node-pty": "0.11.0-beta19",
"xterm-headless": "^4.18.0"
},
"devDependencies": {
"prettier": "^2.6.2",
"typescript": "^4.6.4"
}
},
"node_modules/nan": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
"integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
},
"node_modules/node-pty": {
"version": "0.11.0-beta19",
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.11.0-beta19.tgz",
"integrity": "sha512-1cdUx15rCVYEcvOvqNRO4S52vYM9mnFyTAceut+lW8/+YWcYQl1TQ3naDqtWHDcVjZI/FbDX1j4iQFwypmJSLQ==",
"hasInstallScript": true,
"dependencies": {
"nan": "^2.14.0"
},
"peerDependencies": {
"node-gyp": "^8.3.0"
}
},
"node_modules/prettier": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz",
"integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/typescript": {
"version": "4.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
"integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/xterm-headless": {
"version": "4.18.0",
"resolved": "https://registry.npmjs.org/xterm-headless/-/xterm-headless-4.18.0.tgz",
"integrity": "sha512-VwSPG2cyVOwesVVLBVrybYNY6cUMiVkD2fLnIXcBs/1iJ3M7bhD3lP9HdQOHGtOkbxV2Duf7MZNmEfngBXL/iQ=="
}
},
"dependencies": {
"nan": {
"version": "2.15.0",
@@ -10,9 +75,9 @@
"integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
},
"node-pty": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.10.1.tgz",
"integrity": "sha512-JTdtUS0Im/yRsWJSx7yiW9rtpfmxqxolrtnyKwPLI+6XqTAPW/O2MjS8FYL4I5TsMbH2lVgDb2VMjp+9LoQGNg==",
"version": "0.11.0-beta19",
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.11.0-beta19.tgz",
"integrity": "sha512-1cdUx15rCVYEcvOvqNRO4S52vYM9mnFyTAceut+lW8/+YWcYQl1TQ3naDqtWHDcVjZI/FbDX1j4iQFwypmJSLQ==",
"requires": {
"nan": "^2.14.0"
}

View File

@@ -35,7 +35,7 @@
"typescript": "^4.6.4"
},
"dependencies": {
"node-pty": "^0.10.1",
"node-pty": "0.11.0-beta19",
"xterm-headless": "^4.18.0"
}
}

View File

@@ -17,6 +17,7 @@ export class Cli {
private cols: number = 80;
private rows: number = 20;
private exit: Promise<number> | undefined;
private hasExit: boolean = false;
constructor(private options: CliOptions) {
if (options.keyWait) {
@@ -31,20 +32,22 @@ export class Cli {
}
public run(): void {
this.pty = pty.spawn(this.options.command, this.options.options || [], {
name: 'xterm-256color',
cols: this.cols,
rows: this.rows
});
this.term = new Terminal({
cols: this.cols,
rows: this.rows
});
this.pty = pty.spawn(this.options.command, this.options.options || [], {
name: 'xterm-256color',
cols: this.cols,
rows: this.rows,
useConpty: false
});
this.pty.onData(data => {
this.term?.write(data);
});
this.exit = new Promise(resolve => {
this.pty?.onExit(data => {
this.hasExit = true;
resolve(data.exitCode);
});
});
@@ -109,12 +112,12 @@ export class Cli {
if (this.isDisposed) {
return;
}
if (this.pty) {
this.pty.kill();
}
if (this.term) {
this.term.dispose();
try {
this.pty?.kill();
} catch (error) {
console.log(error);
}
this.term?.dispose();
this.isDisposed = true;
}