
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
webgl-mock-threejs
Advanced tools
A simple implementation-less interface for testing code outside of WebGL/works with three.js
A simple implementation-less interface for testing code outside of WebGL & three.js, forked from webgl-mock
Since THREE.WebGLRenderer
asks WebGLContext
much detail of graphic capability of device, original webgl-mock
could not be used to test apps with three.js, causing NPE stuffs. This package simply has additional mock-answers for THREE.WebGLRenderer
, allowing it to run in node.
It also includes mock for navigator
object since THREE.WebGLRenderer
does not run without it.
Requires node.
npm i -D webgl-mock-threejs
Instantiate HTMLCanvasElement
and pass it to your app which uses THREE.WebGLRenderer
:
require('webgl-mock-threejs');
const canvas = new HTMLCanvasElement( 640, 480 );
describe("App test", () => {
it("Can initialize successfully", async () => {
let app = new YourApp(canvas);
await app.init();
})
})
Your app would be like:
class YourApp {
constructor( canvas ) {
this.renderer = null;
this.canvas = canvas;
}
async init() {
this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas });
/* your code continues.. */
}
}
Importing this module results to inject global.nagivator
mock to global namespace of Node, if no another exists.
If you get some problems around navigator
, this module may have caused it.
I'm planning jsdom integration which enables to add HTMLCanvasElement
into DOM elements.
FAQs
A simple implementation-less interface for testing code outside of WebGL/works with three.js
The npm package webgl-mock-threejs receives a total of 124 weekly downloads. As such, webgl-mock-threejs popularity was classified as not popular.
We found that webgl-mock-threejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.