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

run test on all examples in docs/index.html #79

Merged
merged 6 commits into from
Jun 13, 2017

Conversation

hereneric
Copy link
Contributor

@hereneric hereneric commented Mar 16, 2017

To run this test, cd to the test-auto directory (need to cd because of bash in test-viz.js), and run node test-viz.js

New files:
test-viz.js: the script running tests and showing results
svgs.json: saves an object, the keys are svg names, the value is the example that generates the key
correct-svgs/: a directory of all correct svgs for check

Also changed a little bit of index.js, now the runningInBrowser function seems to work better?

@longouyang
Copy link
Member

I cloned your repository and tried running node test-viz.js but got errors:

Executing: webppl test_js/1.wppl --require ../.. --random-seed 1
Command failed: webppl test_js/1.wppl --require ../.. --random-seed 1
/Users/long/Desktop/webppl-viz/node_modules/units-css/lib/utilities.js:114
  return utilities.getCreatedElementWidth(document.body, {
                                          ^

ReferenceError: document is not defined
    at /Users/long/Desktop/webppl-viz/node_modules/units-css/lib/utilities.js:114:43
    at Object.<anonymous> (/Users/long/Desktop/webppl-viz/node_modules/units-css/lib/utilities.js:117:2)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/long/Desktop/webppl-viz/node_modules/units-css/lib/conversions/length.js:6:17)

Executing: webppl test_js/10.wppl --require ../.. --random-seed 1
Command failed: webppl test_js/10.wppl --require ../.. --random-seed 1
/Users/long/Desktop/webppl-viz/node_modules/units-css/lib/utilities.js:114
  return utilities.getCreatedElementWidth(document.body, {

Also, I would like for the testing script to us webppl programmatically as a devDependency rather than calling it using child_process.exec.

@hereneric
Copy link
Contributor Author

I haven't met this error before. Can you run webppl test_js/1.wppl --require ../.. --random-seed 1 without error?

@longouyang
Copy link
Member

No -- I get the same error about document being undefined. Are you maybe using a node package that isn't listed in package.json? jsdom, perhaps?

@hereneric
Copy link
Contributor Author

That's weird. webppl test_js/1.wppl --require ../.. --random-seed 1 just runs an ordinary webppl script right? So I'm guessing your webppl is not running successfully? My test.js just use native node packages fs, readline, child_process, nothing to do with extra packages like dom or css.

@longouyang
Copy link
Member

My webppl works fine -- running npm run test in the webppl directory, all tests pass.

What version of node are you running?

@hereneric
Copy link
Contributor Author

hereneric commented Mar 24, 2017

I'm using v.7.7.1.

@longouyang
Copy link
Member

Summarizing our meeting today: the cuplrit is the latest version of canvas, 1.6.5.

1.6.4 works fine, but we now need to figure out how to pin to this version.

@hereneric
Copy link
Contributor Author

hereneric commented Mar 29, 2017

Fixed canvas version problem by shrinkwrap: https://nodejs.org/en/blog/npm/managing-node-js-dependencies-with-shrinkwrap/

Now npm install can figure out the correct version, with the existence of preset npm-shrinkwrap.json.

Got rid of child process exec.

@longouyang
Copy link
Member

Paper trail: the canvas issue is under investigation at Automattic/node-canvas#898

@longouyang longouyang merged commit fefc2a8 into probmods:master Jun 13, 2017
@longouyang longouyang mentioned this pull request Jun 13, 2017
This pull request was closed.
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 this pull request may close these issues.

2 participants