Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: migratedshared-fixtures toast-spec#6436

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg commentedFeb 7, 2023
edited
Loading

PR Checklist

Overview

Migrates all the oldshared-fixtures fixtures into the newast-spec fixtures. Within that they're given the same folder name as their old fixture path.

It would be better long-term to split these fixtures up as described in#6065:

Each fixture should only cover one hyper-targeted, specific case to keep things easy to debug and review.

...but there are ~375 of them, and I'd rather get them intoast-spec sooner. This way they'll be easier to split up later! If this PR is approved I can file a followup issue & find-and-replace the// TODO comments in fixtures to refer to it.

Most of the work in this PR was done in two steps:

  1. 327aa0c29: Ranyarn tsx tools/migrate-fixtures.ts to createunsorted-fixtures from the oldshared-fixtures
  2. bec1fe800: Deletedshared-fixtures altogether
tools/migrate-fixtures.ts
import*ascpfrom"node:child_process";import{existsSync,promisesasfs}from"node:fs";import{tmpdir}from"node:os";importpathfrom"node:path";import{promisify}from"node:util";importglobfrom"glob";constexec=promisify(cp.exec);constnewFixturesDir="packages/ast-spec/src/unsorted-fixtures";constoldFixtures=glob.sync("packages/shared-fixtures/fixtures/**/*.ts");asyncfunctionmain():Promise<void>{// Make sure the new fixtures directory exists, and has no prior contentsif(existsSync(newFixturesDir)){awaitfs.rm(newFixturesDir,{recursive:true});}awaitfs.mkdir(newFixturesDir,{recursive:true,});// Copy each of the old fixtures into the new fixtures directoryfor(constfixtureofoldFixtures){const[oldFileName,group]=fixture.split("/").reverse();constfixtureName=oldFileName.split(".")[0];constfixtureDirectory=path.join(newFixturesDir,group,"fixtures",fixtureName);awaitfs.mkdir(fixtureDirectory,{recursive:true});awaitfs.writeFile(path.join(fixtureDirectory,"fixture.ts"),awaitfs.readFile(fixture));}// Run Jest on ast-spec to find new fixtures with syntax errorsconsttempFile=path.join(tmpdir(),"temp.json");try{awaitexec(`jest /fixtures --json >${tempFile}`,{cwd:"packages/ast-spec",});}catch{/* expected */}constjestOutput=JSON.parse((awaitfs.readFile(tempFile)).toString())as{testResults:{assertionResults:{ancestorTitles:string[];status:string}[];}[];};awaitfs.rm(tempFile);// Filter & deduplicate messages from those failing testsconstfailingFixtures=Array.from(newSet(jestOutput.testResults[0].filter((assertion)=>assertion.ancestorTitles.includes("unsorted-fixtures")&&assertion.status!=="passed").map((assertion)=>assertion.ancestorTitles.slice(2).join("/"))));// For each failing fixture, move it to an _error_ directoryfor(constfailingFixtureoffailingFixtures){constfailingFixtureDirectory=path.join(newFixturesDir,failingFixture.replace("/","/fixtures/"));constnewErrorFixtureDirectory=path.join(failingFixtureDirectory.replace("/fixtures/","/fixtures/_error_/"));awaitfs.mkdir(newErrorFixtureDirectory,{recursive:true,});awaitfs.rename(path.join(failingFixtureDirectory,"fixture.ts"),path.join(newErrorFixtureDirectory,"fixture.ts"));awaitfs.rm(path.join(failingFixtureDirectory,"snapshots"),{recursive:true,});}// Re-run Jest to update snapshots a second timeawaitexec(`jest /fixtures`,{cwd:"packages/ast-spec",});}main().then(()=>console.log("Done.")).catch((error)=>{throwerror;});

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint.

@nx-cloud
Copy link

nx-cloudbot commentedFeb 7, 2023
edited
Loading

☁️ Nx Cloud Report

CI is running/has finished running commands for commit05446b1. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 47 targets

Sent with 💌 fromNxCloud.

@netlify
Copy link

netlifybot commentedFeb 7, 2023
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit05446b1
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/63e55bb1e7f2da0008d8233e
😎 Deploy Previewhttps://deploy-preview-6436--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify site settings.

@codecov
Copy link

codecovbot commentedFeb 7, 2023
edited
Loading

Codecov Report

Merging#6436 (05446b1) intomain (a9cb860) willdecrease coverage by0.87%.
The diff coverage isn/a.

Additional details and impacted files
@@            Coverage Diff             @@##             main    #6436      +/-   ##==========================================- Coverage   91.53%   90.66%   -0.87%==========================================  Files         371      371                Lines       12662    12662                Branches     3721     3721              ==========================================- Hits        11590    11480     -110- Misses        754      845      +91- Partials      318      337      +19
FlagCoverage Δ
unittest90.66% <ø> (-0.87%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
packages/typescript-estree/src/convert-comments.ts57.14% <0.00%> (-42.86%)⬇️
packages/typescript-estree/src/convert.ts85.67% <0.00%> (-11.46%)⬇️
packages/typescript-estree/src/node-utils.ts83.51% <0.00%> (-7.45%)⬇️
...escript-estree/src/semantic-or-syntactic-errors.ts80.00% <0.00%> (-6.67%)⬇️
...pt-estree/src/parseSettings/createParseSettings.ts95.00% <0.00%> (-2.50%)⬇️

@JoshuaKGoldbergJoshuaKGoldberg marked this pull request as ready for reviewFebruary 7, 2023 23:52
@bradzacher
Copy link
Member

Let's do this:

  1. move this out of thesrc folder to a new folder called likelegacy-fixtures
  2. remove the todo comments and add info to the readme about how to add fixtures and whatnot to do.

Eg

Thelegacy-fixtures folder contains all of the old fixtures from our previous testing framework. No new fixtures should be added to this folder, and instead we should be attempting to migrate and remove cases wherever possible.

insert steps#6065?

After that I think we're in a good spot to land this?

JoshuaKGoldberg reacted with thumbs up emoji

@JoshuaKGoldbergJoshuaKGoldberg changed the titlechore: migrated shared-fixtures to ast-specchore: migratedshared-fixtures toast-specFeb 8, 2023
@bradzacher
Copy link
Member

We'll also want to make sure these fixtures are automatically re-tested using the test tooling, so you'll need to updatethe test to include them

@JoshuaKGoldberg
Copy link
MemberAuthor

Hmm, would you be upset if I movedlegacy-fixtures to withinsrc/? That way I don't have to keep these logic changes for two test directories...

@bradzacher
Copy link
Member

ah yeah I guess the test isn't built to be relative to anything other than thesrc folder.
feel free to drop it in there then.

JoshuaKGoldberg reacted with thumbs up emoji

Copy link
Member

@bradzacherbradzacher left a comment

Choose a reason for hiding this comment

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

yas

JoshuaKGoldberg reacted with rocket emoji
@JoshuaKGoldbergJoshuaKGoldberg merged commitfb799e7 intotypescript-eslint:mainFeb 10, 2023
@JoshuaKGoldbergJoshuaKGoldberg deleted the migrate-shared-fixtures-to-ast-spec branchFebruary 10, 2023 02:33
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsFeb 18, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@bradzacherbradzacherbradzacher approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Repo: moveshared-fixtures tests toast-spec fixtures
2 participants
@JoshuaKGoldberg@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp