Skip to content

feat(selectivity): consider png reference deps#1245

Merged
KuznetsovRoman merged 1 commit intomasterfrom
TESTPLANE-974.selectivity_png_refs
Apr 28, 2026
Merged

feat(selectivity): consider png reference deps#1245
KuznetsovRoman merged 1 commit intomasterfrom
TESTPLANE-974.selectivity_png_refs

Conversation

@KuznetsovRoman
Copy link
Copy Markdown
Member

No description provided.

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-974.selectivity_png_refs branch from c3be6ba to 4be4cdd Compare April 22, 2026 20:29
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1245

commit: 4ac44ed

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-974.selectivity_png_refs branch from 4be4cdd to d2c4c9d Compare April 22, 2026 21:05
});
};

export const addTestplaneSelectivityPngDependency = (pngPath: string): void => {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When called during test run, adds png dependency to test dependencies

Called on "assert-view"

let aInd = 0,
bInd = 0;

if (!a[depType]) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Explicit checks "what if old format had no png dependencies property"

}).catch(() => ({}));
}).catch(() => ({}))) as Record<
string,
Record<string, Partial<NormalizedDependencies> & Pick<NormalizedDependencies, "css" | "js" | "modules" | "png">>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Explicit type check "those properties were added on read and guaranteed to exist"

If new property will be added, typescript would complain:

Types of property 'newTypeDeps' are incompatible.
            Type 'string[] | undefined' is not assignable to type 'string[]'.
              Type 'undefined' is not assignable to type 'string[]'.ts(2322)

Comment on lines +103 to +104
if (isUpdatingRefs) {
addTestplaneSelectivityPngDependency(refImg.path);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

"--update-refs" case

});
});

it("should restore missing dependency properties", async () => {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Extra test to make sure "readTestDependencies" returns complete value, even if file was missing some properties

readJsonWithCompressionStub.resolves(oldFormatDependencies);

const result = await utils.readTestDependencies("/test/selectivity/tests", mockTest, "none");
const completeExpectedBrowserDependencies: NormalizedDependencies = {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Would also get type errors here, if any property will be missed


const testDependencyWriter = getTestDependenciesWriter(testDependenciesPath, compression);
const browserDeps = transformSourceDependencies(cssDependencies, jsDependencies, mapBrowserDepsRelativePath);
const browserDeps = transformSourceDependencies(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

давай просто объединим типы зависимостей в один аргумент deps. Сейчас набор аргументов вида null, jsDeps, null выглядит нечитаено. Ну и ты еще должен запоминать в какой последовательности нужно передать эти зависимости.

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-974.selectivity_png_refs branch from d2c4c9d to 4ac44ed Compare April 23, 2026 23:35
@KuznetsovRoman KuznetsovRoman merged commit 8a60bb5 into master Apr 28, 2026
7 checks passed
@KuznetsovRoman KuznetsovRoman deleted the TESTPLANE-974.selectivity_png_refs branch April 28, 2026 14:13
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.

2 participants