actions-on-google / actions-on-google-testing-nodejs

Apache License 2.0
75 stars 18 forks source link

Examples do not run #13

Closed tkirshboim closed 6 years ago

tkirshboim commented 6 years ago

When trying to run the 'number-genie' example the test run fails with the following error message:

> actions-on-google-testing@0.0.1 test /omitted/actions-on-google-testing-nodejs/examples/number-genie
> ava -c 1 -s ./test/*.js

module.js:478
    throw err;
    ^

Error: Cannot find module '../../../dist/'
    at Function.Module._resolveFilename (module.js:476:15)
    at Function.Module._load (module.js:424:25)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/omitted/actions-on-google-testing-nodejs/examples/number-genie/test/number-genie.test.js:32:32)
    at Module._compile (module.js:577:32)
    at extensions.(anonymous function) (/omitted/actions-on-google-testing-nodejs/examples/number-genie/node_modules/require-precompiled/index.js:13:11)
    at Object.require.extensions.(anonymous function) [as .js] (/omitted/actions-on-google-testing-nodejs/examples/number-genie/node_modules/ava/lib/process-adapter.js:100:4)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/omitted/actions-on-google-testing-nodejs/examples/number-genie/node_modules/ava/lib/test-worker.js:61:1)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)

  1 exception

  ✖ test/number-genie.test.js exited with a non-zero exit code: 1
npm ERR! Test failed.  See above for more details.

It seems that the test script is looking for ActionsOnGoogleAva in '../../../dist/' and fails when it doesn't find it.

I didn't try the facts-about-google and facts-about-google-ts examples, but since I can see that they are looking for ActionsOnGoogleAva the same way, I suppose they will fail with the same error message.

What steps am I missing to get the examples to run? Could the README of the examples include the required folder setup? I can see for example that I'll also need to have the test-credentials.json in a specific folder for it to run as well.

Fleker commented 6 years ago

Have you executed npm run build in order to generate JS from the Typescript source?

The README may not include that step.

tkirshboim commented 6 years ago

@Fleker That solves the issue for me. Thanks.