gundb / panic-server Goto Github PK
View Code? Open in Web Editor NEWTesting for collaborative apps and tools
Testing for collaborative apps and tools
If a job throws an error asynchronously, the panic coordinator won't be notified (however node.js will log an error message, or call 'uncaughtException' on it's process).
Example:
function error (done) {
setTimeout(function () {
throw new Error('Out of bacon.')
}, 1000)
}
// Run the jobs in parallel
panic.clients.run(error)
panic.clients.run(error)
// The promise resolves
Since the jobs are asynchronously parallel, it'd be pretty difficult to track down which job it belongs to, and report back to that job ID - but I've got an idea!
Solution?
Use the line number. window.onerror
is supported in IE6, and will always pass the line number as the third param, which can be used to look up the job. Since we have the luxury of using eval
, each job function could be prefixed by a bunch of whitespace, creating a fake "file" that addresses job instances by the line space they occupy.
So: 500 newlines prefixed to a 10 line function. We address the job instance as 500-510. If anything calls the global error handler ('uncaughtException'
or window.onerror
), grab the line number (say 507), go to the lookup "table", and see what job corresponds to that space. If it exists, call job.fail(error)
, otherwise ignore it.
Admittedly hacky, but it just might work.
Hi there, is there a more complete example on testing collaborative app? Say a collaborative spread sheet like Google sheets?
The readme doesn't cover the client .get
and .set
methods. They're critical to keeping tests modular without exposing globals or mutating shared objects.
More details in this panic-client commit message.
The bluebird dependency used within this package is unneeded in modern javascript engines. All I've tested recently include native promises.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.