Skip to content

Conversation

@remcohaszing
Copy link
Member

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

This closer resembles real world usage. It also tests that package exports are properly configured.

This closer resembles real world usage. It also tests that package
exports are properly configured.
@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Jul 26, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (61945c9) to head (b0479a6).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #49   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          512       512           
=========================================
  Hits           512       512           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

ShowMessageRequest
} from 'vscode-languageserver-protocol/node.js'

test('exports', (t) => {
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit cautious on removing tests.
There should still be export, even if they are partiallytested elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm a bit cautious on removing tests.

I think that’s a good quality. :)


IMHO this test is a bit superfluous. It literally asserts the export is a function. All other tests test the behaviour of this function (fully, not partially).

Still, if you have strong feelings about this, I can restore it.

Copy link
Member

Choose a reason for hiding this comment

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

I believe that the reason for something like this in the tests was because there was an export that was no longer needed.

A better way to test the API surface, which somewhat makes sure that we don’t export things we don’t need, and we do not accidentally remove things that we do need, would be something along the lines of:

const api = await import('unified-language-server')
const keys = Object.keys(api).sort()
assert.deepEqual(keys, ['something', 'somethingElse'])

@remcohaszing remcohaszing requested a review from wooorm July 26, 2022 20:16
@wooorm wooorm changed the title Use package exports in tests Refactor to use export map instead of paths in tests Jul 27, 2022
@wooorm wooorm merged commit 384a40c into unifiedjs:main Jul 27, 2022
@wooorm wooorm added 🕸️ area/tests This affects tests 💪 phase/solved Post is done labels Jul 27, 2022
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Jul 27, 2022
@wooorm
Copy link
Member

wooorm commented Jul 27, 2022

Released in 3.1.0!

@remcohaszing remcohaszing deleted the test-actual-exports branch August 6, 2022 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🕸️ area/tests This affects tests 💪 phase/solved Post is done

Development

Successfully merging this pull request may close these issues.

4 participants