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

Integrate unused CommonJS tests where applicable #195

Merged
merged 1 commit into from
Apr 28, 2019

Conversation

raphinesse
Copy link
Contributor

@raphinesse raphinesse commented Apr 28, 2019

Motivation and Context

There has been an unused copy of The Official Specs for CommonJS lying around in our repository for who knows how long. They needed to be built using a python script and then manually executed in a browser.

This commit integrates all of those tests that also apply to our module system into our existing test suite for require & define.

Description

Adds adapted versions of the following CommonJs tests to our test.require.js:

absolute, transitive, determinism, method, nested, hasOwnProperty

The hasOwnProperty test actually uncovered a bug in our module system implementation and thus is deactivated right now.

The following CommonJS tests were not applicable to Cordova's module system since it does not support cyclic dependencies at all:

cyclic, monkeys

The following CommonJS tests were already covered by tests in test.require.js:

  • missing: covered by Test#005
  • relative: covered by Test#012
  • exactExports: covered by multiple tests

Future Work

I will follow up with a patch for the disabled hasOwnProperty test once this is merged.

There has been an unused copy of [The Official Specs for CommonJS][1]
lying around in our repository for who knows how long. They needed to be
built using a python script and then manually executed in a browser.
This commit integrates all of those tests that also apply to our module
system into our existing test suite for `require` & `define`.

Adds adapted versions of the following CommonJs tests to our
`test.require.js`:

    absolute, transitive, determinism, method, nested, hasOwnProperty

The hasOwnProperty test actually uncovered a bug in our module system
implementation and thus is deactivated right now.

The following CommonJS tests were not applicable to Cordova's module
system since it does not support cyclic dependencies at all:

    cyclic, monkeys

The following CommonJS tests were already covered by tests in
`test.require.js`:

- missing: covered by Test#005
- relative: covered by Test#012
- exactExports: covered by multiple tests

[1]: https://github.com/commonjs/commonjs
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Would like to get rid of the Test#### : from being in the it description...

This is just what I feel. Messages should be descriptive enough. If tests are dropped, injected in middle or even moved to other files or repos, it takes effort to keep the numbers. in sync.

Other then my opinion on the description, everything else looks good.

@raphinesse raphinesse merged commit dd8b78f into apache:master Apr 28, 2019
@raphinesse raphinesse deleted the integrate-commonjs-tests branch April 28, 2019 18:55
@raphinesse
Copy link
Contributor Author

@erisu Yeah, I'm very ambivalent about these test numbers. OTOH I agree with your point. OTOH, unique identifiers allow to quickly identify failing tests and find them in the source code. 🤷‍♂️

raphinesse added a commit that referenced this pull request Apr 28, 2019
One of the CommonJS tests adopted in #195 exposed a defect in Cordova's module system:

When trying to define a module with a name that also is a property of Object.prototype, an exception would occur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants