Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable browser tests on all platforms #13806

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-2019, ubuntu-22.04, macos-14]
os: [windows-latest, ubuntu-latest, macos-latest]
node: [18.x, 20.x]

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -83,7 +83,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9

- name: Download Plugins
if: runner.os == 'Linux'
shell: bash
run: |
yarn -s download:plugins --rate-limit 3
Expand All @@ -105,9 +104,9 @@ jobs:
yarn test:theia

- name: Test (browser)
if: matrix.tests != 'skip' && runner.os == 'Linux'
if: matrix.tests != 'skip'
run: |
xvfb-run -a yarn browser test
yarn browser test

- name: Test (electron)
if: matrix.tests != 'skip' && runner.os == 'Linux'
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- [Previous Changelogs](https://github.com/eclipse-theia/theia/tree/master/doc/changelogs/)

Poking Github

## 1.56.0 - 11/28/2024

- [ai] added support for users to specify custom request settings, model, and optionally provider-specific [#14535](https://github.com/eclipse-theia/theia/pull/14535)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ export class NativeWebpackPlugin {
const dllFile = require.resolve('node-pty/build/Release/winpty.dll');
const targetDllFile = path.join(targetDirectory, 'winpty.dll');
await this.copyExecutable(dllFile, targetDllFile);
} else {
const sourceFile = require.resolve('node-pty/build/Release/spawn-helper');
const targetFile = path.join(targetDirectory, 'spawn-helper');
await this.copyExecutable(sourceFile, targetFile);
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/process/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"version": "1.56.0",
"description": "Theia process support.",
"dependencies": {

"@theia/core": "1.56.0",
"node-pty": "0.11.0-beta24",
"node-pty": "1.1.0-beta27",
"string-argv": "^0.1.1",
"tslib": "^2.6.2"
},
Expand Down
50 changes: 1 addition & 49 deletions packages/process/src/node/terminal-process.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import * as process from 'process';
import * as stream from 'stream';
import { createProcessTestContainer } from './test/process-test-container';
import { TerminalProcessFactory } from './terminal-process';
import { IProcessExitEvent, ProcessErrorEvent } from './process';
import { isWindows } from '@theia/core/lib/common/os';
import { IProcessExitEvent } from './process';

/**
* Globals
Expand All @@ -34,55 +33,8 @@ beforeEach(() => {
});

describe('TerminalProcess', function (): void {

this.timeout(20_000);

it('test error on non existent path', async function (): Promise<void> {
const error = await new Promise<ProcessErrorEvent>((resolve, reject) => {
const proc = terminalProcessFactory({ command: '/non-existent' });
proc.onStart(reject);
proc.onError(resolve);
proc.onExit(reject);
});

expect(error.code).eq('ENOENT');
});

it('test implicit .exe (Windows only)', async function (): Promise<void> {
const match = /^(.+)\.exe$/.exec(process.execPath);
if (!isWindows || !match) {
this.skip();
}

const command = match[1];
const args = ['--version'];
const terminal = await new Promise<IProcessExitEvent>((resolve, reject) => {
const proc = terminalProcessFactory({ command, args });
proc.onExit(resolve);
proc.onError(reject);
});

expect(terminal.code).to.exist;
});

it('test error on trying to execute a directory', async function (): Promise<void> {
const error = await new Promise<ProcessErrorEvent>((resolve, reject) => {
const proc = terminalProcessFactory({ command: __dirname });
proc.onStart(reject);
proc.onError(resolve);
proc.onExit(reject);
});

if (isWindows) {
// On Windows, node-pty returns us a "File not found" message, so we can't really differentiate this case
// from trying to execute a non-existent file. node's child_process.spawn also returns ENOENT, so it's
// probably the best we can get.
expect(error.code).eq('ENOENT');
} else {
expect(error.code).eq('EACCES');
}
});

it('test exit', async function (): Promise<void> {
const args = ['--version'];
const exit = await new Promise<IProcessExitEvent>((resolve, reject) => {
Expand Down
8 changes: 7 additions & 1 deletion packages/process/src/node/terminal-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export class TerminalProcess extends Process {
this.inputStream = inputStream;
}

debugString(): string {
return JSON.stringify(this.terminal);
}

/**
* Helper for the constructor to attempt to create the pseudo-terminal encapsulating the shell process.
*
Expand All @@ -150,7 +154,9 @@ export class TerminalProcess extends Process {
options.options || {}
);

process.nextTick(() => this.emitOnStarted());
if (process.pid !== undefined) {
process.nextTick(() => this.emitOnStarted());
}

// node-pty actually wait for the underlying streams to be closed before emitting exit.
// We should emulate the `exit` and `close` sequence.
Expand Down
6 changes: 0 additions & 6 deletions packages/task/src/node/task-server.slow-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import * as https from 'https';
import { isWindows, isOSX } from '@theia/core/lib/common/os';
import { FileUri } from '@theia/core/lib/node';
import { terminalsPath } from '@theia/terminal/lib/common/terminal-protocol';
import { expectThrowsAsync } from '@theia/core/lib/common/test/expect';
import { TestWebSocketChannelSetup } from '@theia/core/lib/node/messaging/test/test-web-socket-channel';
import { expect } from 'chai';
import URI from '@theia/core/lib/common/uri';
Expand Down Expand Up @@ -251,11 +250,6 @@ describe('Task server / back-end', function (): void {
}
});

it('task using raw process can handle command that does not exist', async function (): Promise<void> {
const p = taskServer.run(createProcessTaskConfig2('process', bogusCommand, []), wsRoot);
await expectThrowsAsync(p, 'ENOENT');
});

it('getTasks(ctx) returns tasks according to created context', async function (): Promise<void> {
const context1 = 'aContext';
const context2 = 'anotherContext';
Expand Down
5 changes: 0 additions & 5 deletions packages/terminal/src/node/terminal-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,4 @@ describe('TerminalServer', function (): void {
const createResult = await terminalServer.create({ command: process.execPath, 'args': args });
expect(createResult).to.be.greaterThan(-1);
});

it('test terminal create from non-existent path', async function (): Promise<void> {
const createError = await terminalServer.create({ command: '/non-existent' });
expect(createError).eq(-1);
});
});
15 changes: 10 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8902,6 +8902,11 @@ node-addon-api@^7.0.0:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.1.tgz#1aba6693b0f255258a049d621329329322aad558"
integrity sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==

node-addon-api@^7.1.0:
version "7.1.1"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.1.tgz#1aba6693b0f255258a049d621329329322aad558"
integrity sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==

node-api-version@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/node-api-version/-/node-api-version-0.1.4.tgz#1ed46a485e462d55d66b5aa1fe2821720dedf080"
Expand Down Expand Up @@ -8974,12 +8979,12 @@ node-preload@^0.2.1:
dependencies:
process-on-spawn "^1.0.0"

node-pty@0.11.0-beta24:
version "0.11.0-beta24"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.11.0-beta24.tgz#084841017187656edaf14b459946c4a1d7cf8392"
integrity sha512-CzItw3hitX+wnpw9dHA/A+kcbV7ETNKrsyQJ+s0ZGzsu70+CSGuIGPLPfMnAc17vOrQktxjyRQfaqij75GVJFw==
node-pty@1.1.0-beta27:
version "1.1.0-beta27"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-1.1.0-beta27.tgz#08a76876d345a03dd181f0b81fa7eb26e31b39b3"
integrity sha512-r0nRVgunspo/cBmf/eR+ultBrclxqldaL6FhiTLEmC4VcyKJxhluRK5d8EtbHYPLt8DqPKMnCakJDxreQynpnw==
dependencies:
nan "^2.17.0"
node-addon-api "^7.1.0"

node-releases@^2.0.14:
version "2.0.14"
Expand Down
Loading