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

Adopt type=module #281

Merged
merged 24 commits into from
Jun 7, 2021
Merged

Adopt type=module #281

merged 24 commits into from
Jun 7, 2021

Conversation

Fil
Copy link
Member

@Fil Fil commented Apr 27, 2021

follow changes in d3-format:

  • type=module
  • add exports
  • remove zip
  • license: ISC
  • update dependencies

TODO:

  • update README.md
  • check LICENSE
  • merge remove all children #276
  • fix the failing tests (90!), due to a different environment (global is undefined)
  • switch the default branch to main

follow changes in d3-format:
* type=module
* add exports
* remove zip
* license: ISC
* update dependencies
@Fil Fil requested a review from mbostock April 27, 2021 13:26
Copy link
Contributor

@aulonm aulonm left a comment

Choose a reason for hiding this comment

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

This is just a suggestion, not an actual way of doing it, since I'm not 100% sure how to fix it completely.

The reason why some of the tests fail, is because the select-methods create a javascript function (correct me if I'm wrong) and then in the tests we are asserting a function with an object.

d3.select returns:

Selection {
  _groups: [ [ HTMLHeadingElement {} ] ],
  _parents: [ HTMLHtmlElement {} ]
}

Trying to deepStrictEqual-assert it against an object:

{
  _groups: [ [ HTMLHeadingElement {} ] ],
  _parents: [ HTMLHtmlElement {} ]
}

This will fail off course, while it would pass when using deepEqual because its not strict

A more simple example:

function ex(msg) {
  this._msg = msg;
}

const f = new ex('hello');
console.log(f); // -> f { _msg: 'hello' }

const object = { _msg: 'hello' };
console.log(object) // -> { _msg: 'hello' }

console.log(f === object) // -> false

The reason we get document is not defined is because jsdom does not make a global.document, we would need to do that ourselves, which I've added as a suggestion in the /tests/jsdom.js file

test/jsdom.js Outdated Show resolved Hide resolved
test/select-test.js Outdated Show resolved Hide resolved
test/select-test.js Outdated Show resolved Hide resolved
Fil and others added 4 commits April 29, 2021 22:02
Co-authored-by: Aulon Mujaj <aulon.mujaj@gmail.com>
Co-authored-by: Aulon Mujaj <aulon.mujaj@gmail.com>
Co-authored-by: Aulon Mujaj <aulon.mujaj@gmail.com>
@Fil
Copy link
Member Author

Fil commented Apr 29, 2021

some progress! thanks for the hints. We're down to 44 fails :)

Fil added a commit to d3/d3-zoom that referenced this pull request Apr 29, 2021
@mbostock mbostock mentioned this pull request Jun 4, 2021
35 tasks
@mbostock mbostock marked this pull request as ready for review June 7, 2021 17:26
@mbostock mbostock merged commit 54a3acf into main Jun 7, 2021
@mbostock mbostock deleted the fil/type-module branch June 7, 2021 17:26
mbostock added a commit to d3/d3-zoom that referenced this pull request Jun 10, 2021
* Adopt type=module

follow changes in d3-format:
* type=module
* add exports
* remove zip
* license: ISC
* update dependencies

* all tests pass!

thank you, @aulonm! (cf. d3/d3-selection#281 (review))

* browser rather than no-undef

* update dependencies

* add eslint.json

* remove Sublime project

* extract copyrights from license

* cleaner tests

* update README

* update homepage

Co-authored-by: Mike Bostock <mbostock@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants