Skip to content
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

Implement Jest #10

Closed
pailhead opened this issue Jun 4, 2020 · 5 comments · Fixed by #43
Closed

Implement Jest #10

pailhead opened this issue Jun 4, 2020 · 5 comments · Fixed by #43
Assignees

Comments

@pailhead
Copy link
Contributor

pailhead commented Jun 4, 2020

Premise

Jest seems like a sane choice for a JavaScript unit testing framework. However it has some limitations and may not be straightforward to install.

Eg. using jest with a webpack based build system has challenges. I think the crux of problem is making jest understand various proposals and supersets of JavaScript. It seems that some plugins are available to help with this off the shelf (eg. babel-jest), while other configs may require the build tool to be customized.

Proposal

Unless a framework better suited for TypeScript is identified, I would like to propose to move forward with implementing Jest.

Definition of done

  • Jest framework along with any of it's dependencies is installed via npm i or yarn
  • Running jest with a single some.test.ts will load the said file.
  • some.test.ts is to load some module from the library, preferably something simple
    • (but it may be a good idea to test something that imports a .glsl file if that happens)
  • The test is to implement a simple it() block that instantiates a module, or calls some method if said module is static/singleton.
@pailhead
Copy link
Contributor Author

pailhead commented Jun 4, 2020

Investigation

  • It seems the config needed is fairly minimal, but it requires babel.
  • i think there's choice when it comes to structuring the test files, they can be next to the source or in /__test__/

@pailhead
Copy link
Contributor Author

pailhead commented Jun 4, 2020

@bhouston Please assign this to me.

@bhouston
Copy link
Owner

bhouston commented Jun 6, 2020

Sorry, I missed that you wanted me to assign it to you. I will track these issues a bit closer going forward.

@bhouston
Copy link
Owner

bhouston commented Jun 6, 2020

I notice a discussion here that seems to suggest that Jest is it. It is actually used by React-Create-App.

i can likely port across a lot of the math tests from Three.js relatively quickly: https://github.com/mrdoob/three.js/tree/dev/test/unit/src/math

@bhouston
Copy link
Owner

bhouston commented Jun 6, 2020

I do not care if it is in test or beside the code. Go with whatever you feel is best for now and we can change it in the future if needed.

bhouston added a commit that referenced this issue Jun 15, 2020
github-actions bot pushed a commit that referenced this issue Jun 26, 2020
# [1.2.0](v1.1.1...v1.2.0) (2020-06-26)

### Bug Fixes

* restored example1 triangles index.ts file ([e7a420e](e7a420e))
* update directories in examples. ([d928c8c](d928c8c))
* **ci:** fix broken release action ([c304902](c304902))
* **ci:** fix checking master on master ([8ed115c](8ed115c))
* **eslint:** ignore JS example ([a4735fe](a4735fe))
* **eslint:** resolve tsconfig paths ([315d3b3](315d3b3))

### Features

* add debug renderer info support ([c22865a](c22865a))
* add Plane and Ray math primitives ([4f15436](4f15436))
* Add Plane geometry creator. ([46c88ee](46c88ee))
* add stride support to PrimitiveArray ([25d54bc](25d54bc))
* add support for 'WEBGL_debug_shaders' extension ([286f21b](286f21b))
* add support for optional anisotropy mipmaps ([5588055](5588055))
* depth texture example ([f85573e](f85573e))
* encodings work well ([5fcc413](5fcc413))
* example [#1](#1) - basic triangle. ([705ab3d](705ab3d))
* example 3, textured & indexed plane. ([ae9660a](ae9660a))
* example 4 lambert cube ([c6269d1](c6269d1))
* go back to WebGL1 with guarrenteed extensions. :( ([4b21a2e](4b21a2e))
* HDR loader WIP ([73f2581](73f2581))
* integration test support via ts-jest ([b9cadb7](b9cadb7)), closes [#10](#10)
* interleaved buffers example (not yet working) ([f4c8620](f4c8620))
* optimize math class size and dependencies ([ca74267](ca74267))
* orthographic example, fix perspective camera sign bug, improve uniformity of maker-functions. ([fc62362](fc62362))
* render to texture example ([0f7b79d](0f7b79d))
* roughness example works ([0132ba9](0132ba9))
* second example, animated uniforms ([077d33e](077d33e))
* simplify framebuffer attachment creation ([515ebbe](515ebbe))
* tetrahedral, octahedron, isocahedron, dodecahedron, PrimitiveArray ([9c86560](9c86560))
* upgrade shaders to es 300 (WebGL2 only) ([62e7da7](62e7da7))
* use module facades in examples ([bd565fb](bd565fb))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants