Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar authored May 22, 2022
2 parents 20373da + d5f78b2 commit 52425c6
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 47 deletions.
35 changes: 32 additions & 3 deletions docs/docs/tutorial/chapter5/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,45 @@ Since we just started the suite, and we haven't changed any files yet, it may no

![tests_running](https://user-images.githubusercontent.com/46945607/165376937-89ed9254-0d8e-4945-a0d9-17178764a4b0.png)

If you cloned the example repo during the intermission and followed along with the Storybook tutorial in this chapter, the test run should finish and you will see something like this:
If you cloned the example repo during the intermission and followed along with the Storybook tutorial in this chapter, the test run should finish and you will see something like this:

![suite_finished](https://user-images.githubusercontent.com/46945607/165378519-2859dd0d-d46a-448f-a62e-0b8f91c55a87.png)

Note that the summary on the bottom indicates that there was 1 test that failed. If you feel curious, you can scroll up in your terminal and see more details on the test that failed. We'll also take a look at that failed test shortly.
:::info

If you decided to keep your codebase from the first part of the tutorial, then you'll get the following error after running

```bash
yarn rw test

Error: Get config: Schema Parsing P1012

error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.
--> schema.prisma:3
|
2 | provider = "postgresql"
3 | url = env("DATABASE_URL")
|

Validation Error Count: 1

error Command failed with exit code 1.
```

To clear the error and to proceed with running the test suite, head over to your `.env` file and add the following line:

```bash
TEST_DATABASE_URL=<the same url as DATABASE_URL>
```

:::

Note that the summary on the bottom indicates that there was 1 test that failed. If you feel curious, you can scroll up in your terminal and see more details on the test that failed. We'll also take a look at that failed test shortly.

If you continued with your own repo from chapters 1-4, you may see some other failures here or none at all: we made a lot of changes to the pages, components and cells we generated, but didn't update the tests to reflect the changes we made. (Another reason to start with the [example repo](#using-the-example-repo)!)

To switch back to the default mode where test are **o**nly run for changed files, press `o` now (or quit and restart `yarn rw test`).

What we want to aim for is all green in that left column and no failed tests. In fact best practices tell us you should not even commit any code to your repo unless the test suite passes locally. Not everyone adheres to this policy quite as strictly as others...*&lt;cough, cough&gt;*

We've got an excellent document on [Testing](../../testing.md) which you should definitely read if you're brand new to testing, especially the [Terminology](../../testing.md#terminology) and [Redwood and Testing](../../testing.md#redwood-and-testing) sections. For now though, proceed to the next section and we'll go over our approach to getting that last failed test passing.
We've got an excellent document on [Testing](../../testing.md) which you should definitely read if you're brand new to testing, especially the [Terminology](../../testing.md#terminology) and [Redwood and Testing](../../testing.md#redwood-and-testing) sections. For now though, proceed to the next section and we'll go over our approach to getting that last failed test passing.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@babel/preset-react": "7.16.7",
"@babel/preset-typescript": "7.16.7",
"@babel/runtime-corejs3": "7.16.7",
"@playwright/test": "1.22.1",
"@playwright/test": "1.22.2",
"@testing-library/jest-dom": "5.16.4",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "8.0.0",
Expand Down Expand Up @@ -84,7 +84,7 @@
"lerna": "4.0.0",
"lodash.template": "4.5.0",
"make-dir-cli": "3.0.0",
"msw": "0.40.1",
"msw": "0.40.2",
"ncp": "2.0.0",
"node-notifier": "10.0.1",
"nodemon": "2.0.16",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@clerk/clerk-js": "3.11.0",
"@clerk/clerk-sdk-node": "3.6.0",
"@clerk/types": "2.13.0",
"@nhost/hasura-auth-js": "1.1.6",
"@nhost/hasura-auth-js": "1.1.9",
"@nhost/nhost-js": "1.1.14",
"@supabase/supabase-js": "1.35.3",
"@types/netlify-identity-widget": "1.9.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"core-js": "3.22.5",
"jest": "27.5.1",
"jest-watch-typeahead": "1.1.0",
"msw": "0.40.1",
"msw": "0.40.2",
"ts-toolbelt": "9.6.0",
"whatwg-fetch": "3.6.2"
},
Expand Down
59 changes: 19 additions & 40 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4947,17 +4947,6 @@ __metadata:
languageName: node
linkType: hard

"@nhost/core@npm:0.5.4":
version: 0.5.4
resolution: "@nhost/core@npm:0.5.4"
dependencies:
axios: ^0.27.2
js-cookie: ^3.0.1
xstate: ^4.31.0
checksum: 9500d3b37b61e94607434b269b1994837e9f9a469d16bce5f6f5d306daa51dca200dc722be2988dac132bcfb2fdc39e60b2deaa0633d9ff7c68e194e8be8cdd5
languageName: node
linkType: hard

"@nhost/core@npm:0.6.0":
version: 0.6.0
resolution: "@nhost/core@npm:0.6.0"
Expand All @@ -4969,17 +4958,6 @@ __metadata:
languageName: node
linkType: hard

"@nhost/hasura-auth-js@npm:1.1.6":
version: 1.1.6
resolution: "@nhost/hasura-auth-js@npm:1.1.6"
dependencies:
"@nhost/core": 0.5.4
jwt-decode: ^3.1.2
xstate: ^4.31.0
checksum: fad26c554ef643ff9f99353ef033d095f8c079260e646ec4fe81742b428b9612cc6a7ee03771c3c7daffa14e68b80443cd2f6ff272ead8591337d790ea977151
languageName: node
linkType: hard

"@nhost/hasura-auth-js@npm:1.1.9":
version: 1.1.9
resolution: "@nhost/hasura-auth-js@npm:1.1.9"
Expand Down Expand Up @@ -5494,14 +5472,15 @@ __metadata:
languageName: node
linkType: hard

"@playwright/test@npm:1.22.1":
version: 1.22.1
resolution: "@playwright/test@npm:1.22.1"
"@playwright/test@npm:1.22.2":
version: 1.22.2
resolution: "@playwright/test@npm:1.22.2"
dependencies:
playwright-core: 1.22.1
"@types/node": "*"
playwright-core: 1.22.2
bin:
playwright: cli.js
checksum: 30ca277c53755d3810c08b18d30e1aac8032b6fc8efeef33a1a1bc927af90ce86f1a46bcf62d94213b479d347e5e039a0bb5018a03f9a1e2907c693a158745bb
checksum: a1e97274733535286496137f3e2e23f61294174c01c0fb957d8d626ac01503085e4d4c94073fce9a52e84db2fc9bc8b510a2eb48281421a4ba9867da2a2d51f1
languageName: node
linkType: hard

Expand Down Expand Up @@ -5926,7 +5905,7 @@ __metadata:
"@clerk/clerk-js": 3.11.0
"@clerk/clerk-sdk-node": 3.6.0
"@clerk/types": 2.13.0
"@nhost/hasura-auth-js": 1.1.6
"@nhost/hasura-auth-js": 1.1.9
"@nhost/nhost-js": 1.1.14
"@supabase/supabase-js": 1.35.3
"@types/netlify-identity-widget": 1.9.3
Expand Down Expand Up @@ -6411,7 +6390,7 @@ __metadata:
core-js: 3.22.5
jest: 27.5.1
jest-watch-typeahead: 1.1.0
msw: 0.40.1
msw: 0.40.2
ts-toolbelt: 9.6.0
typescript: 4.6.4
whatwg-fetch: 3.6.2
Expand Down Expand Up @@ -22505,9 +22484,9 @@ __metadata:
languageName: node
linkType: hard

"msw@npm:0.40.1":
version: 0.40.1
resolution: "msw@npm:0.40.1"
"msw@npm:0.40.2":
version: 0.40.2
resolution: "msw@npm:0.40.2"
dependencies:
"@mswjs/cookies": ^0.2.0
"@mswjs/interceptors": ^0.15.1
Expand All @@ -22529,13 +22508,13 @@ __metadata:
type-fest: ^1.2.2
yargs: ^17.3.1
peerDependencies:
typescript: 4.2.x || 4.3.x
typescript: ">= 4.2.x <= 4.6.x"
peerDependenciesMeta:
typescript:
optional: true
bin:
msw: cli/index.js
checksum: fb5f80fad647f6c9461d05ced2b89323e573ebe5c46bdc87df27ab870c837872135937a089e320f23a0d8b6f52aceb66d3426109c352ccf8987d0204c17e8575
checksum: 74faccb399c0b98835d909b1be4f08e135181266b665b2859de62057ac4e1c7bdc939bf77aac1403ccfc9e44d87df0e00651d8e7d588c90859bfac008218525d
languageName: node
linkType: hard

Expand Down Expand Up @@ -24428,12 +24407,12 @@ __metadata:
languageName: node
linkType: hard

"playwright-core@npm:1.22.1":
version: 1.22.1
resolution: "playwright-core@npm:1.22.1"
"playwright-core@npm:1.22.2":
version: 1.22.2
resolution: "playwright-core@npm:1.22.2"
bin:
playwright: cli.js
checksum: 64588363f6e1ab7da8e7287387abe3388fdb98d203a42650ba1e379578068d890c5ee871e203057a538260c4ddc42af8d77e1ab76d07eb2d0148d182d8353508
checksum: 98935d7906d52093fe260cd2bc74924cad0abb908f96a92867aa71e26eb3ce45d79185280a361e16fab2422a86936dfa1bb7306c5629d5b276f0ce1c99928f04
languageName: node
linkType: hard

Expand Down Expand Up @@ -26899,7 +26878,7 @@ __metadata:
"@babel/preset-react": 7.16.7
"@babel/preset-typescript": 7.16.7
"@babel/runtime-corejs3": 7.16.7
"@playwright/test": 1.22.1
"@playwright/test": 1.22.2
"@testing-library/jest-dom": 5.16.4
"@testing-library/react": 12.1.5
"@testing-library/react-hooks": 8.0.0
Expand Down Expand Up @@ -26928,7 +26907,7 @@ __metadata:
lerna: 4.0.0
lodash.template: 4.5.0
make-dir-cli: 3.0.0
msw: 0.40.1
msw: 0.40.2
ncp: 2.0.0
node-notifier: 10.0.1
nodemon: 2.0.16
Expand Down

0 comments on commit 52425c6

Please sign in to comment.