-
Notifications
You must be signed in to change notification settings - Fork 903
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
WIP - Run all tests using Jest #1306
Closed
lindapaiste
wants to merge
82
commits into
ml5js:joeyklee.637-rm-other-testing-libs
from
lindapaiste:migrate-tests-to-jest
Closed
WIP - Run all tests using Jest #1306
lindapaiste
wants to merge
82
commits into
ml5js:joeyklee.637-rm-other-testing-libs
from
lindapaiste:migrate-tests-to-jest
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Word2vec.nearestFromSet() is giving always null output. Reason: !miniModel.length is always true because miniModel is object and length attribute is undefined.
added a line break
you had to manually add 'model.json' to the url and its confusing for beginners
heirarchy -> hierarchy
Fix typo in examples/CONTRIBUTING.md
accidentally added wrong contribution type, now fixed
DBSCAN Clustering Algorithm
docs: add asvsfs as a contributor for code, example
PoseNet examples
…function is provided.
…all `index_test.js` files. * Set `env: { jest: true }` in .eslint.js to fix es-lint errors re: undefined variable `jest`. * Import the functions to test from local files instead of a global `ml5` variable. * Rewrite test imports from `const { charRNN } = ml5;` to `import charRNN from './index';`. * import `tf` directly from `@tensorflow/tfjs` in NeuralNetwork instead of using `ml5.tf` alias. * Replace all instances of `jasmine.DEFAULT_TIMEOUT_INTERVAL = n;` with `jest.setTimeout(n);`. * Replace `spyOn` with `jest.spyOn` (which internally calls the jasmine `spyOn` function). * Modify chained function calls, eg. `.and.callFake` to `.mockImplementation`, `.and.returnValue` to `.mockReturnValue`, etc. * Install node polyfill for `canvas`.
…ests. * Utility `randomImageData` creates an `ImageData` object of any size with random pixels. (TODO: needs node polyfill)
* Add `typeof HTMLVideoElement !== 'undefined'` check to prevent errors in Node.js environments. * Reject `loadVideo` promise if there is no video. * Check that `this.size` is a non-zero number before using it. * Set `this.videoReady` to `true` from the base class.
Code clean-up: Video class.
…iste docs: add lindapaiste as a contributor for code, ideas, bug
# Conflicts: # package-lock.json
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Completed:
Settings:
"_test\\.js"
alongside the deafult JesttestRegex
to match allindex_test.js
files.testEnvironmentOptions: { resources: "usable" }
to Jest config so that images will call theonload
function.env: { jest: true }
in .eslint.js to fix es-lint errors re: undefined variablejest
.canvas
.Rewrites:
ml5
variable.const { charRNN } = ml5;
toimport charRNN from './index';
.tf
directly from@tensorflow/tfjs
in NeuralNetwork instead of usingml5.tf
alias.jasmine.DEFAULT_TIMEOUT_INTERVAL = n;
withjest.setTimeout(n);
.spyOn
withjest.spyOn
(which internally calls the jasminespyOn
function)..and.callFake
to.mockImplementation
,.and.returnValue
to.mockReturnValue
, etc.General Clean-up:
testUtils
.TODO:
describe
in each file and addedpassWithNoTests: true
to Jest config, but this doesn't work.fetch
calls which are executed internally in theface-api.js
package."cross-fetch/polyfill"
tosetupFiles
in Jest config prevents the fetch errors, but then the test just hangs.ImageData
to avoid errorImageData is not defined
in the node environment and/or install polyfill.@tensorflow/tfjs-node
in tests.