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

Add isNodeJs and process getters to cli_pkg/js.dart #143

Merged
merged 11 commits into from
Oct 5, 2023
Merged

Conversation

Goodwine
Copy link
Contributor

Related to sass/dart-sass#2113

Copy link
Collaborator

@nex3 nex3 left a comment

Choose a reason for hiding this comment

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

As discussed offline, also add checks for this to the browser tests.

lib/js.dart Outdated Show resolved Hide resolved
lib/js.dart Outdated Show resolved Hide resolved
@Goodwine Goodwine requested a review from nex3 September 30, 2023 01:11
Copy link
Collaborator

@nex3 nex3 left a comment

Choose a reason for hiding this comment

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

When I suggested adding tests in browser_library_test, I meant updating the existing test files to verify that isNodeJs returns false for them. We specifically want to verify that their bundling strategies don't make it look like they're running under Node.js when we know they aren't.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this should be in browser_library_test, since it's not running in a browser and it's not loading a JS library exposed by the package. It would probably make more sense to put it in test/node_js_test.dart.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is actually running in a browser 🤔, just without any other libraries involved. There are tests for running within Node already. I will rename this file to make it less confusing.

github results showing "dart test -p chrome" list of executed tests which includes this file on testing

I guess it's a good idea to expand browser_test_shared.dart to verify none of those libraries would incorrectly return isNodeJs == true

browser_library_test/test/node_js_test.dart Outdated Show resolved Hide resolved
lib/js.dart Show resolved Hide resolved
@Goodwine Goodwine requested a review from nex3 October 3, 2023 23:22
lib/js.dart Outdated Show resolved Hide resolved
@Goodwine Goodwine requested a review from nex3 October 3, 2023 23:28
@Goodwine Goodwine merged commit e8c1f78 into main Oct 5, 2023
15 checks passed
@Goodwine Goodwine deleted the js-is-node branch October 5, 2023 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants