Closed hereneric closed 7 years ago
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
.
I haven't met this error before. Can you run webppl test_js/1.wppl --require ../.. --random-seed 1
without error?
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?
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.
My webppl works fine -- running npm run test
in the webppl directory, all tests pass.
What version of node are you running?
I'm using v.7.7.1.
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.
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.
Paper trail: the canvas issue is under investigation at Automattic/node-canvas#898
To run this test,
cd
to the test-auto directory (need to cd because of bash intest-viz.js
), and runnode test-viz.js
New files:
test-viz.js
: the script running tests and showing resultssvgs.json
: saves an object, the keys are svg names, the value is the example that generates the keycorrect-svgs/
: a directory of all correct svgs for checkAlso changed a little bit of
index.js
, now therunningInBrowser
function seems to work better?