Comments (11)
Scoped this out with Jest and RobotJS.
const ioHook = require('./index')
const robot = require("robotjs");
// The assertion for a promise must be returned.
it('receives the text "Hello World"', (done) => {
let currentKey = 0;
const actualCharacters = [];
const expectedChracters = ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'];
const eventCallback = (event) => {
actualCharacters.push(String.fromCharCode(event.keychar))
if (currentKey === expectedChracters.length) {
expect(actualCharacters).toEqual(expectedChracters);
}
currentKey += 1;
done();
};
ioHook.on('keypress', eventCallback);
ioHook.start()
robot.typeString("Hello World");
});
from iohook.
This is great! Do you want to put this in a PR? Currently merging all the existing ones. Thanks !
from iohook.
Let's write a test for the shortcuts and maybe test the mouse.
from iohook.
@DCzajkowski it seems that the test are not passing on CI https://travis-ci.org/WilixLead/iohook/jobs/378076504
from iohook.
It is something Travis related, no?
Cannot find module '/home/travis/build/WilixLead/iohook/builds/node-v64-linux-x64/build/Release/iohook.node' from 'index.js'
from iohook.
I don't know. is there anything you run before npm run test
?
from iohook.
Not really. BUT, I have hard time building the whole thing because of version mismatches etc. I don't think it's my code that broke anything, because I have not touched anything regarding builds... So I have no clue what causes Travis to fail
from iohook.
Actually it is the tests not passing :). I think I will silence them for now.
from iohook.
Ehh... Do you know how to fix them?
from iohook.
This could help: jestjs/jest#5123
from iohook.
Closing as stale.
from iohook.
Related Issues (20)
- how can import iohook into my web-application to get keyboard or mouse click event globally? HOT 1
- Is there a possibility to interrupt a keydown event?
- Update Electron Support HOT 2
- Cannot find module iohook.node HOT 2
- (node:72347) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 keydown listeners added to [IOHook]. Use emitter.setMaxListeners() to increase limit
- Unable to install iohook because of npm errors HOT 4
- How can check iohook is started or stopped
- iohook build different node js version HOT 15
- Update dist-url for build.js script
- Building for node v18.13.0 and Electron 22.0.0 HOT 3
- Release to github fails when manual build.
- Version 0.9.0 is not build for Windows 11 HOT 1
- Uncaught Exception: Error: Cannot find module '/home/logicrays/Documents/practice project/Learn electronjs/web-tracker-electron-app/node_modules/iohook/builds/electron-v113-linux-x64/build/Release/iohook.node' HOT 3
- Non-existing version of iohook, v0.9.3-node-v111-win32-x64 HOT 3
- Build a version for Electron v24.4.0 HOT 5
- Error to install over mac and nodejs v14 & v15 HOT 3
- iohook.node is not a valid Win32 application HOT 3
- Couldn't install iohook in my electron app HOT 3
- when manually building on windows, node-gyp generated .dll, but not .node HOT 19
- Error while installing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iohook.