Commit graph

26 commits

Author SHA1 Message Date
Tim Neutkens
e169e73b45
Add hasRedbox fix (#60522)
## What?

As @leerob and I found in-person when opening #57230 the `hasRedBox()`
helper was incorrectly passing when it shouldn't pass in both the true
and false case.

This PR uses a different approach by waiting 7 seconds before checking,
this leaves enough room for HMR / reloads to apply, it doesn't
meaningfully slow down the test suite and increases reliability of the
check as you can see below in the tests that were previously passing
that are no longer passing.

I've moved these to skipped tests for landing this PR as I want to avoid
further issues being introduced while we fix them. @huozhi will
investigate these next week 👍

Failing tests that are temporarily skipped:
-
https://github.com/vercel/next.js/pull/60522/files#diff-513b477050bf1a620697b4d16bc1e6850282cb54e0609bdc5fd34307bfa9e471R9
-
https://github.com/vercel/next.js/pull/60522/files#diff-fa7d7c8c40914005c138d852eaf6a69ac0df51ec77bec548cbc5f0bfbdc8ebc5R25
-
https://github.com/vercel/next.js/pull/60522/files#diff-6f9f7dc131416cb17938311939a56d8c0e685a8fe6e8fc0cf5cd04939c74f388R41
-
https://github.com/vercel/next.js/pull/60522/files#diff-439830e340a320c56645e9d00aaf0fd0b492ddb90b6d7f9db89458ccc5158eb7R8
-
https://github.com/vercel/next.js/pull/60522/files#diff-62938bf5cd4d84f96dde8b6bcb2c8e18099e6dfca269c4302229b79175c0250cR18
-
https://github.com/vercel/next.js/pull/60522/files#diff-513b477050bf1a620697b4d16bc1e6850282cb54e0609bdc5fd34307bfa9e471R9


<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-2059
2024-01-15 09:36:44 +01:00
Tim Neutkens
a961ec0d5f
Skip production tests for Turbopack (#56045)
As Turbopack is only focusing on dev currently. 

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-09-26 22:30:04 +02:00
JJ Kasper
d5a188de06
Update test env variable passing (#44912) 2023-01-15 23:20:16 -08:00
Tim Neutkens
f260328900
BREAKING CHANGE: Enable newNextLinkBehavior (#41459)
- Enable newNextLinkBehavior. See #36436 
- Run next/link codemod on test suite

Note that from when this lands on apps trying canary will need to run
the new-link codemod in order to upgrade.
Ideally we have to detect `<a>` while rendering the new link and warn
for it.

Co-authored-by: Steven <steven@ceriously.com>
2022-10-17 21:20:28 -04:00
JJ Kasper
a92a5caec2
Update test set-up to leverage playwright when able to (#28634)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-13 14:36:25 +02:00
Tim Neutkens
b34a0c98fa
Update err.sh links to use nextjs.org/docs/messages instead (#23353) 2021-03-29 10:25:00 +02:00
JJ Kasper
8b803d79a9
Update error when internal href and external as are used (#20658)
* Update error when internal href and external as are used

* Update to handle error outside invariant

* Update err.sh components
2021-01-01 12:14:42 -06:00
Jan Potoms
20a4928b16
remove unneeded error (#16636)
This is not needed anymore since absolute urls are supported.
Also added an extra test for `mailto:` urls
2020-08-28 02:49:40 +00:00
Jan Potoms
5dbe0d0215
Allow absolute urls in router and Link (#15792)
Fixes https://github.com/vercel/next.js/issues/15639
Fixes https://github.com/vercel/next.js/issues/15820

To Do:
- [x] Doesn't work with `basePath` yet
2020-08-05 18:12:17 +00:00
Jan Potoms
3ffef60280
Fix webdriver error handling (#15491)
errors in script execution will result in timeout instead of failure. This PR makes sure to pass all arguments to `.then` so error handling is correctly set up. (`.then` needs to be able to take a second argument). I also removed `.finally`.

I don't know why, but it looks like the following test does something that prevents the tests after it from opening a new browser window on azure. I'm giving up, I shuffled the tests to put this one last.
```js
    it('shows warning when dynamic route mismatch is used on Link', async () => {
      await showsError(
        '/dynamic-route-mismatch',
        /Mismatching `as` and `href` failed to manually provide the params: post in the `href`'s `query`/,
        true,
        true
      )
    })
```
2020-07-29 10:30:06 +00:00
Jan Potoms
2f50f1f8c9
Stabilize more tests (#15470)
jest retries seem to be masking test failures, like the `auto-export` one (and maybe others). I turned it off for now. The `auto-export` test fails when retries are turned off.
the output of this test failure was a bit unhelpful so I also improved it.
Many tests have anonymous page functions.
2020-07-26 04:57:06 +00:00
Jan Potoms
e6e2722b11
Tweak test retries for invalid-href suite (#15459)
- Reduce jest retries to 2 for a total of 3 attempts
- Disable retries in `invalid-href` test. I noticed jest retries don't help when this test fails (see log output of https://github.com/vercel/next.js/runs/904147534).
2020-07-24 20:04:53 +00:00
Jan Potoms
b12389598b
Stabilize azure test (#14999)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-14 00:25:07 -04:00
Jan Potoms
cd79c829b1
Make sure bad links in router methods resolve in production (#15135)
edge-case I introduced in https://github.com/vercel/next.js/pull/14827
2020-07-13 19:28:32 +00:00
Joe Haddad
30fbd9adc9
Speedup tests (#13461)
This PR checks if our tests can be ran faster by disabling source maps unless they're used for the purpose of testing.
2020-05-29 07:57:51 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Jan Potoms
32057c849d
Use the jest-circus test runner (#12974) 2020-05-16 16:56:06 -04:00
Joe Haddad
ae1daea355
Enable Fast Refresh by Default (#12640) 2020-05-10 19:25:57 -04:00
JJ Kasper
53e9983d83 Add hydration callback for testing (#10195)
* Add hydration callback for testing

* Update size-limit test
2020-01-21 15:33:58 -05:00
Joe Haddad
9b512a850c
Stabilize New Dev Test (#10188) 2020-01-21 09:10:47 -05:00
JJ Kasper
fcfb5959e6
Allow mismatching href and as when manually provided (#9837)
* Allow mismatch href and as when manually provided

* Swap warning and error and throw error in production also

* Add test for mismatch error in production

* Update to only show warning in development
2020-01-20 16:47:52 -06:00
Joe Haddad
302407486e
Specify Invalid Dynamic Route Values (#9525) 2019-11-25 17:15:23 -05:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
JJ Kasper
c941b6129c Trigger error overlay for dynamic route mismatch (#9031) 2019-10-11 11:49:18 +02:00
JJ Kasper
8e4509caf2 Add warning for invalid href being passed to router (#8231)
* Add warning for bad href being passed to router

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Inline invalidHref for better code elimination
2019-08-07 10:47:13 -04:00