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

Codelabs issue with running test on hello-world #11346

Closed
ethereal-sandeep opened this issue Sep 20, 2017 · 5 comments
Closed

Codelabs issue with running test on hello-world #11346

ethereal-sandeep opened this issue Sep 20, 2017 · 5 comments

Comments

@ethereal-sandeep
Copy link
Member

Codelabs bug.

  • While going thought codelabs for creating AMP Component, i came across this error on running gulp test just after clone, install, make-extension ....
    gulp test --files extensions/amp-hello-world/0.1/test/test-amp-hello-world.js
START:
  amp-hello-world
     
       should have hello world when built

Finished in 0.069 secs / 0 secs @ 10:12:20 GMT+0530 (IST)

SUMMARY:
 0 tests completed
 1 test failed

FAILED TESTS:
  amp-hello-world
     
       should have hello world when built
        Chromium 60.0.3112 (Ubuntu 0.0.0)
      TypeError: element.build is not a function
          at Context.<anonymous> (/tmp/extensions/amp-hello-world/0.1/test/test-amp-hello-world.js:35:12 <- /tmp/fdc491679d890352d143f7914ee5ece6.browserify:596:13)

[10:12:20] Shutting down test responses server on localhost:31862
[10:12:20] ERROR: Karma test failed with exit code 1

Then after modifying amp-hello-world.js by replacing

AMP.registerElement('amp-hello-world', AmpHelloWorld);

with

AMP.extension('amp-hello-world', '0.1', AMP => {
  AMP.registerElement('amp-hello-world', AmpHelloWorld);
});

Test passed.

@aghassemi
Copy link
Contributor

/to @erwinmombay to update the codelab.

@jmrog
Copy link
Contributor

jmrog commented Sep 20, 2017

+1, but also want to add:

I don't think this is just a Codelabs bug. I was working locally on an extended component in preparation for submitting a PR, synced my branch with master, fired up my tests to make sure everything was still in good shape, and... tests that were passing before the sync started failing with the same TypeError mentioned in the OP (despite no relevant changes). The component conforms to what is mentioned in the documentation here, though, so that documentation also seems out-of-date (in at least 3 places).

OP's workaround also wasn't quite enough in my case; I had to change a few other things in my test setup (might be too much to describe here, but it involved replacing a call to addElement on an iframe and a couple of other things -- I can try to say more if it's needed).

@ampprojectbot ampprojectbot added this to the Docs Updates milestone Sep 25, 2017
@ampprojectbot
Copy link
Member

This issue hasn't been updated in awhile. @erwinmombay Do you have any updates?

1 similar comment
@ampprojectbot
Copy link
Member

This issue hasn't been updated in awhile. @erwinmombay Do you have any updates?

@ampprojectbot
Copy link
Member

This issue hasn't been updated in awhile. @erwinmombay Do you have any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants