Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: use new debug -I -P CLI output #2281

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

Merged
merged 8 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: test Arduino state update for extensions
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta committed Dec 13, 2023
commit e149eaa59b4e212e23813e0418105c4fdcddfcd7
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import { BoardsServiceProvider } from '../boards/boards-service-provider';
import { CurrentSketch } from '../sketches-service-client-impl';
import { SketchContribution } from './contribution';

interface UpdateStateParams<T extends ArduinoState> {
/**
* (non-API) exported for tests
*/
export interface UpdateStateParams<T extends ArduinoState = ArduinoState> {
readonly key: keyof T;
readonly value: T[keyof T];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
uno,
unoSerialPort,
} from '../common/fixtures';
import { bindBrowser } from './browser-test-bindings';

disableJSDOM();

Expand Down Expand Up @@ -390,7 +391,7 @@ describe('board-service-provider', () => {
const container = new Container({ defaultScope: 'Singleton' });
container.load(
new ContainerModule((bind, unbind, isBound, rebind) => {
bindCommon(bind);
bindBrowser(bind, unbind, isBound, rebind);
bind(MessageService).toConstantValue(<MessageService>{});
bind(BoardsService).toConstantValue(<BoardsService>{
getDetectedPorts() {
Expand Down
23 changes: 20 additions & 3 deletions 23 arduino-ide-extension/src/test/browser/browser-test-bindings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
import { MockLogger } from '@theia/core/lib/common/test/mock-logger';
import { Container, ContainerModule } from '@theia/core/shared/inversify';
import { bindCommon } from '../common/common-test-bindings';
import {
Bind,
ConsoleLogger,
bindCommon,
} from '../common/common-test-bindings';

export function createBaseContainer(): Container {
export function createBaseContainer(bind: Bind = bindBrowser): Container {
const container = new Container({ defaultScope: 'Singleton' });
container.load(new ContainerModule((bind) => bindCommon(bind)));
container.load(new ContainerModule(bind));
return container;
}

export const bindBrowser: Bind = function (
...args: Parameters<Bind>
): ReturnType<Bind> {
bindCommon(...args);
const [bind, , , rebind] = args;
// IDE2's test console logger does not support `Loggable` arg.
// Rebind logger to suppress `[Function (anonymous)]` messages in tests when the storage service is initialized without `window.localStorage`.
// https://github.com/eclipse-theia/theia/blob/04c8cf07843ea67402131132e033cdd54900c010/packages/core/src/browser/storage-service.ts#L60
bind(MockLogger).toSelf().inSingletonScope();
rebind(ConsoleLogger).toService(MockLogger);
};
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.