Skip to content

Commit

Permalink
Test playright as default provider
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisalmen committed Nov 27, 2024
1 parent 746e1d6 commit 1b59630
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ jobs:
shell: bash
run: |
npm run report:versions
npm run test:install
npm run test:run
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"start:example:server:python": "npm run start:server:python --workspace packages/examples",
"release:prepare": "npm run reset:repo && npm ci && npm run build && npm run lint && npm run test:run",
"reset:repo": "git clean -f -X -d",
"test": "npm run test:webdriverio",
"test:run": "npm run test:webdriverio:run",
"test": "npm run test:playwright",
"test:run": "npm run test:playwright:run",
"test:webdriverio": "vitest",
"test:webdriverio:run": "vitest --run",
"test:playwright": "vitest --config vitest.debug.config.ts",
Expand Down
16 changes: 6 additions & 10 deletions packages/wrapper-react/test/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,13 @@ describe('Test MonacoEditorReactComp', () => {
};

const handleOnLoad = async (wrapper: MonacoEditorLanguageClientWrapper) => {
await wrapper.updateCodeResources({
main: {
text: 'goodbye world',
fileExt: 'js'
}
});
count++;

setTimeout(async () => {
await wrapper.updateCodeResources({
main: {
text: 'goodbye world',
fileExt: 'js'
}
});
}, 100);

};
render(<MonacoEditorReactComp wrapperConfig={wrapperConfig} onLoad={handleOnLoad} onTextChanged={textReceiver} />);
});
Expand Down
45 changes: 20 additions & 25 deletions packages/wrapper/test/languageClientWrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */

import { describe, expect, test } from 'vitest';
import { LanguageClientConfig, LanguageClientWrapper, MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper';
import { LanguageClientWrapper, MonacoEditorLanguageClientWrapper } from 'monaco-editor-wrapper';
import { createWrapperConfigExtendedApp } from './helper.js';

describe('Test LanguageClientWrapper', () => {
Expand All @@ -18,37 +18,28 @@ describe('Test LanguageClientWrapper', () => {
});

test('Constructor: no config', async () => {
// create a web worker to pass to the wrapper
const worker = new Worker('./worker/langium-server.ts', {
type: 'module',
name: 'Langium LS',
});
const languageClientConfig: LanguageClientConfig = {
clientOptions: {
documentSelector: ['javascript']
},
connection: {
options: {
$type: 'WorkerDirect',
worker
const languageClientWrapper = new LanguageClientWrapper({
languageClientConfig: {
clientOptions: {
documentSelector: ['javascript']
},
connection: {
options: {
$type: 'WorkerDirect',
// create a web worker to pass to the wrapper
worker: new Worker('./worker/langium-server.ts', {
type: 'module',
name: 'Langium LS',
})
}
}
}
};

const languageClientWrapper = new LanguageClientWrapper({
languageClientConfig
});
expect(languageClientWrapper).toBeDefined();
expect(languageClientWrapper.haveLanguageClient).toBeTruthy();
});

test('Dispose: direct worker is cleaned up afterwards', async () => {
// create a web worker to pass to the wrapper
const worker = new Worker('./worker/langium-server.ts', {
type: 'module',
name: 'Langium LS',
});

// setup the wrapper
const config = createWrapperConfigExtendedApp();
config.languageClientConfigs = {
Expand All @@ -59,7 +50,11 @@ describe('Test LanguageClientWrapper', () => {
connection: {
options: {
$type: 'WorkerDirect',
worker
// create a web worker to pass to the wrapper
worker: new Worker('./worker/langium-server.ts', {
type: 'module',
name: 'Langium LS',
})
}
}
}
Expand Down

0 comments on commit 1b59630

Please sign in to comment.