Skip to content

Feature/533/optional default providers #534

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 5 commits into from
Sep 23, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
npm run coverage:merge
npm run coverage:merge-report
- name: Send results to SonarCloud
uses: SonarSource/sonarcloud-github-action@v1.6
uses: SonarSource/sonarcloud-github-action@v2.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
12 changes: 12 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const DISABLE_DEFAULT_PROVIDERS_ENV_VAR =
"NUT_JS_DISABLE_DEFAULT_PROVIDERS";
export const DISABLE_DEFAULT_CLIPBOARD_PROVIDER_ENV_VAR =
"NUT_JS_DISABLE_DEFAULT_CLIPBOARD_PROVIDER";
export const DISABLE_DEFAULT_KEYBOARD_PROVIDER_ENV_VAR =
"NUT_JS_DISABLE_DEFAULT_KEYBOARD_PROVIDER";
export const DISABLE_DEFAULT_MOUSE_PROVIDER_ENV_VAR =
"NUT_JS_DISABLE_DEFAULT_MOUSE_PROVIDER";
export const DISABLE_DEFAULT_SCREEN_PROVIDER_ENV_VAR =
"NUT_JS_DISABLE_DEFAULT_SCREEN_PROVIDER";
export const DISABLE_DEFAULT_WINDOW_PROVIDER_ENV_VAR =
"NUT_JS_DISABLE_DEFAULT_WINDOW_PROVIDER";
1 change: 1 addition & 0 deletions lib/expect/jest.matcher.function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare global {
interface Matchers<R> {
toBeAt: (position: Point) => ReturnType<typeof toBeAt>;
toBeIn: (region: Region) => ReturnType<typeof toBeIn>;
// @ts-ignore
toShow: (
needle: FindInput,
confidence?: number
Expand Down
3 changes: 3 additions & 0 deletions lib/keyboard.class.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const providerRegistryMock = mockPartial<ProviderRegistry>({
setKeyboardDelay: jest.fn(),
});
},
hasKeyboard(): boolean {
return true;
},
});

describe("Keyboard", () => {
Expand Down
8 changes: 5 additions & 3 deletions lib/keyboard.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ export class KeyboardClass {
* @param providerRegistry
*/
constructor(private providerRegistry: ProviderRegistry) {
this.providerRegistry
.getKeyboard()
.setKeyboardDelay(this.config.autoDelayMs);
if (this.providerRegistry.hasKeyboard()) {
this.providerRegistry
.getKeyboard()
.setKeyboardDelay(this.config.autoDelayMs);
}
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/mouse.class.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const providerRegistryMock = mockPartial<ProviderRegistry>({
setMouseDelay: jest.fn(),
});
},
hasMouse(): boolean {
return true;
},
});

describe("Mouse class", () => {
Expand Down
4 changes: 3 additions & 1 deletion lib/mouse.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class MouseClass {
* @param providerRegistry
*/
constructor(private providerRegistry: ProviderRegistry) {
this.providerRegistry.getMouse().setMouseDelay(0);
if (this.providerRegistry.hasMouse()) {
this.providerRegistry.getMouse().setMouseDelay(0);
}
}

/**
Expand Down
35 changes: 0 additions & 35 deletions lib/provider/native/clipboardy-clipboard.class.spec.ts

This file was deleted.

36 changes: 0 additions & 36 deletions lib/provider/native/clipboardy-clipboard.class.ts

This file was deleted.

Loading