Version Packages - #59
Open
github-actions[bot] wants to merge 1 commit into
Open
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@noctcore/eslint-plugin-code-quality@0.4.0
Minor Changes
#53
954f5b2Thanks @Shironex! - Four new opt-in test-discipline rules and two stricter existing rules.A project that spreads
recommendedsees new errors from two rules it already runs:no-vacuous-expectnow reports a test whose only assertion is that the render root is present (soleRenderRootExpect):expect(container).not.toBeEmptyDOMElement(),expect(container.firstChild).toBeInTheDocument(),expect(container.innerHTML).not.toBe('')and the like, on acontainerorbaseElementbound from a call (const { container } = render(...),view.container,render(...).container). Such a test passes for anything that renders, an error fallback included. Assert on a role, a label or a text instead, or set the newrenderRootsoption to[]to keep the old behaviour.skipped-tests-need-trackingnow also readsnode:testskips: askiportodooption whose value is a truthy literal ({ skip: true },{ skip: 'reason' },{ todo: 1 }) ontest/it/describe/suite(and at.testsubtest), andt.skip()/t.todo()(awaited or not) as a statement of the test callback's own body. Only unconditional skips are reported: a computed value ({ skip: process.platform === 'win32' },{ skip: !ready }) or at.skip(...)inside anifis a platform guard and stays silent. Add an issue URL orTODO(@owner)near the skip, as for.skip(.New rules, left out of
recommended(each needs a per-project fact; enabling them is up to you):no-message-only-throw-assertion:toThrow()/toThrowError()with no argument, or with only a string, template or regex, and the message snapshotstoThrowErrorMatchingSnapshot()/toThrowErrorMatchingInlineSnapshot(), sync or after.rejects. Any error passes those, including aTypeErrorfrom a broken mock. A class argument, an asymmetric matcher,.rejects.toMatchObject(...)and.not.toThrow()are fine, and a message-only assertion is accepted when the same test pins the class of the same subject in the same or an enclosing block (a baretoThrow()is never excused that way). Options:throwMatchers,allowMessageOnly(report only the argless form),trustErrorInstances(setfalseunder Jest, wheretoThrow(new X('m'))and.rejects.toEqual(new X('m'))compare only the message; a.rejects.toMatchObject({ message })ortoHaveProperty('message')is never a class pin) andassertionHelpers.no-sleep-in-unit-tests: a real sleep in a unit test file:new Promise((r) => setTimeout(r, n)),setTimeoutfromtimers/promises, andpromisify(setTimeout). A zero or omitted delay (allowZeroDelay, on by default) a reject-only timeout guard and a deadline whose kept handle the file passes toclearTimeoutare not sleeps, and a file that installs fake timers (fakeTimerMethods, defaultuseFakeTimers) is not checked, since its waits are virtual. SametestFileSuffixes/integrationMarkersoptions asno-real-network-in-unit-tests.no-real-clock-in-unit-tests:Date.now(), an arglessnew Date()andDate()in a unit test file that never fakes the clock (useFakeTimers,setSystemTime, aDate.nowspy, a stubbed or replaced globalDate, or a mocked module matchingclockModules). An offset from now (Date.now() + 60_000,new Date().getTime() - 1000) is allowed.typed-mock-over-double-cast: an object literal containingjest.fn()/vi.fn()castas unknown as T(or throughanyornever, inasor angle-bracket form). Type it asjest.Mocked<Pick<T, ...>>or check it withsatisfies. Options:mockFactories,allowTargetsfor types too wide toPickfrom.