-
Notifications
You must be signed in to change notification settings - Fork 92
test(e2e): fix failures due to latest and canary releases #2587
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -220,8 +220,12 @@ test('requesting a non existing page route that needs to be fetched from the blo | |||||
expect(await page.textContent('h1')).toBe('404 Not Found') | ||||||
|
||||||
// https://github.com/vercel/next.js/pull/66674 made changes to returned cache-control header, | ||||||
// before that 404 page would have `private` directive, after that it would not | ||||||
const shouldHavePrivateDirective = !nextVersionSatisfies('>=14.2.4 <15.0.0 || >=15.0.0-canary.24') | ||||||
// before that 404 page would have `private` directive, after that (14.2.4 and canary.24) it | ||||||
// would not ... and then https://github.com/vercel/next.js/pull/69802 changed it back again | ||||||
// (14.2.10 and canary.147) | ||||||
const shouldHavePrivateDirective = nextVersionSatisfies( | ||||||
'<14.2.4 || >=14.2.10 < 15 || <15.0.0-canary.24 || >= 15.0.0-canary.147', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This condition is different than one used in other places - because this one has This would work (and then probably same condition should be used across the board? maybe we centralize it and add
Suggested change
Or we use the condition used elsewhere with understanding that those earlier canary versions ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. I've read those semver docs a hundred times and I still keep finding things I've misinterpreted. I thought prerelease range specifiers could never match stable releases (and prereleases with a different prefix). That clearly wasn't right:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fascinating:
Maybe this was obvious to you, but I thought this behaved kind of like JS's comparison operators with values like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit more nuanced (or maybe some other word that could fit here better 🙃 ):
The
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I had thought about that, but strangely we'd need two different versions of it (some assertions are affected by the change a few months ago, some are affected by both changes) and I couldn't come up with a reasonable name for these functions I decided this was a case of "a poor abstraction is worse than no abstraction". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Somehow I knew about that nuance but not the more fundamental one above! |
||||||
) | ||||||
|
||||||
expect(headers['netlify-cdn-cache-control']).toBe( | ||||||
(shouldHavePrivateDirective ? 'private, ' : '') + | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.