mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
[LOCAL] fix GHA publishTemplate verification
This commit is contained in:
@@ -80,6 +80,17 @@ describe('#publishTemplate', () => {
|
||||
describe('#verifyPublishedTemplate', () => {
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
it("fixes versions prefixed with 'v'", async () => {
|
||||
const dirtyVersion = 'v0.76.0';
|
||||
const cleanVersion = '0.76.0';
|
||||
await verifyPublishedTemplate(dirtyVersion);
|
||||
|
||||
expect(mockGetNpmPackageInfo).toHaveBeenLastCalledWith(
|
||||
'@react-native-community/template',
|
||||
cleanVersion,
|
||||
);
|
||||
});
|
||||
|
||||
it("waits on npm updating for version and not 'latest'", async () => {
|
||||
const NOT_LATEST = false;
|
||||
mockGetNpmPackageInfo
|
||||
|
||||
@@ -68,6 +68,7 @@ module.exports.verifyPublishedTemplate = async (
|
||||
latest = false,
|
||||
retries = MAX_RETRIES,
|
||||
) => {
|
||||
version = version.replace(/^v/, '');
|
||||
log(`🔍 Is ${TEMPLATE_NPM_PKG}@${version} on npm?`);
|
||||
|
||||
let count = retries;
|
||||
@@ -82,11 +83,11 @@ module.exports.verifyPublishedTemplate = async (
|
||||
return;
|
||||
}
|
||||
if (json.version === version) {
|
||||
log(`🎉 ${TEMPLATE_NPM_PKG}@latest → ${version} on npm`);
|
||||
log(`🎉 ${TEMPLATE_NPM_PKG}@latest → ${json.version} on npm`);
|
||||
return;
|
||||
}
|
||||
log(
|
||||
`🐌 ${TEMPLATE_NPM_PKG}@latest → ${pkg.version} on npm and not ${version} as expected, retrying...`,
|
||||
`🐌 ${TEMPLATE_NPM_PKG}@latest → ${json.version} on npm and not ${version} as expected, retrying...`,
|
||||
);
|
||||
} catch (e) {
|
||||
log(`Nope, fetch failed: ${e.message}`);
|
||||
|
||||
Reference in New Issue
Block a user