Skip to content

Move tests outside versions#2503

Merged
balzss merged 2 commits into
masterfrom
move-tests-outside-versions
Apr 27, 2026
Merged

Move tests outside versions#2503
balzss merged 2 commits into
masterfrom
move-tests-outside-versions

Conversation

@balzss

@balzss balzss commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

INSTUI-4975

Summary

  • Move all component test files from inside versioned directories (v1/__tests__/, v2/__tests__/) to component-level __tests__/ directories
  • Update test imports to use @instructure/ui-<package>/latest instead of relative versioned paths (e.g. ../v2)
  • Add create-component-version script to automate creating new component versions with proper git staging, export ordering, and blame preservation
  • Move utility test files (accepts, getEventFiles, cleanString, measureText, cleanData) out of versioned dirs

Test plan

  • pnpm run test:vitest passes (all 2100+ tests)
  • Run pnpm run create-component-version on a test component and verify:
    • package.json is staged
    • ./latest appears last in the exports object
    • The frozen (old) version preserves original git blame

@balzss balzss self-assigned this Apr 7, 2026
@balzss balzss force-pushed the move-tests-outside-versions branch from e45db6f to 160f235 Compare April 7, 2026 13:40
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-27 08:44 UTC

@balzss balzss requested review from ToMESSKa and matyasf April 10, 2026 08:47
@ToMESSKa

Copy link
Copy Markdown
Contributor
  • ui-file-drop/src/FileDrop/v2/utils/__tests__ and ui-truncate-text/src/TruncateText/v2/utils/__tests__ still have some tests files, is that intentional?

@ToMESSKa

Copy link
Copy Markdown
Contributor
  • the test count is smaller than on the master
Image

Comment on lines +29 to +30
import { runAxeCheck } from '@instructure/ui-axe-check'
import { Breadcrumb } from '../index'
import { Breadcrumb } from '../v2'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason why it is not is it not import { Breadcrumb } from '@instructure/ui-breadcrumb/latest' like elsewhere?

@@ -29,7 +29,8 @@ import { vi } from 'vitest'

import '@testing-library/jest-dom'
import { runAxeCheck } from '@instructure/ui-axe-check'
import { RadioInput, type RadioInputHandle } from '../index'
import { RadioInput } from '@instructure/ui-radio-input/latest'
import { type RadioInputHandle } from '../v2/index'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see my question on Breadcrumb

@ToMESSKa

Copy link
Copy Markdown
Contributor

the pnpm run create-component-version does not stage the package.json but it stages the rest after running it?

image

@ToMESSKa

Copy link
Copy Markdown
Contributor

Maybe a nitpick, but the latest isn't the last in order here

image

@ToMESSKa

Copy link
Copy Markdown
Contributor

Also I created a v3 for Avatar and committed but the the whole v3 files are showing me as the author? Maybe I misunderstood something,

@balzss balzss force-pushed the move-tests-outside-versions branch 2 times, most recently from 43acc78 to d7a5ce4 Compare April 14, 2026 16:05
@balzss balzss requested a review from ToMESSKa April 14, 2026 17:07
@ToMESSKa

Copy link
Copy Markdown
Contributor
  • the test count is smaller than on the master
Image

The test count still do not match

@ToMESSKa ToMESSKa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see my comment

@balzss balzss force-pushed the move-tests-outside-versions branch from d7a5ce4 to bde02ee Compare April 16, 2026 11:17
@balzss

balzss commented Apr 20, 2026

Copy link
Copy Markdown
Contributor Author
  • the test count is smaller than on the master
Image

The test count still do not match

you are right, the test count didn't match. there were a couple tests removed accidentally, those were added back, the rest are tests that were duplicated (present in both v1 and v2 folders)

@balzss balzss requested a review from ToMESSKa April 20, 2026 10:53
@@ -0,0 +1,420 @@
/*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FYI In the future we should create TypeScript files in ui-scripts, since newer Node versions can run them natively

@matyasf matyasf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good, just some small changes needed

Comment thread packages/ui-scripts/lib/commands/create-component-version.js Outdated
Comment thread packages/ui-scripts/lib/commands/create-component-version.js Outdated
Comment thread packages/ui-scripts/lib/commands/create-component-version.js Outdated
@balzss balzss force-pushed the move-tests-outside-versions branch from bde02ee to 5c54dc9 Compare April 23, 2026 09:58
@balzss balzss requested a review from matyasf April 23, 2026 09:59
@balzss balzss force-pushed the move-tests-outside-versions branch 2 times, most recently from 1b7b82a to 1c79adb Compare April 23, 2026 10:31

@matyasf matyasf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good!

@balzss balzss force-pushed the move-tests-outside-versions branch from 1c79adb to 9f4de61 Compare April 24, 2026 13:44
@balzss balzss force-pushed the move-tests-outside-versions branch from 9f4de61 to c659071 Compare April 24, 2026 14:06
@balzss balzss merged commit de45942 into master Apr 27, 2026
8 of 9 checks passed
@balzss balzss deleted the move-tests-outside-versions branch April 27, 2026 08:44
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.

3 participants