Skip to content

Commit 1e2f3d7

Browse files
JakobJingleheimerAugustinMauroymikeesto
authored
Add how-to guide for node's test runner (#6770)
* Add how-to guide for node's test runner Signed-off-by: Jacob Smith <[email protected]> * adjust markdown to special flavour Co-authored-by: Augustin Mauroy <[email protected]> Signed-off-by: Jacob Smith <[email protected]> * fix: code snippet * chore(learn-content): add introduction for test-runner * chore(navigation): add learn entry * feedback on the formulation Co-authored-by: Jacob Smith <[email protected]> Signed-off-by: Augustin Mauroy <[email protected]> * Update i18n/locales/en.json Co-authored-by: Michael Esteban <[email protected]> Signed-off-by: Augustin Mauroy <[email protected]> * Update navigation.json Co-authored-by: Michael Esteban <[email protected]> Signed-off-by: Augustin Mauroy <[email protected]> * fix grammar Co-authored-by: Michael Esteban <[email protected]> Signed-off-by: Augustin Mauroy <[email protected]> * fix: npm init command --------- Signed-off-by: Jacob Smith <[email protected]> Signed-off-by: Augustin Mauroy <[email protected]> Co-authored-by: Augustin Mauroy <[email protected]> Co-authored-by: Michael Esteban <[email protected]> Co-authored-by: Augustin Mauroy <[email protected]>
1 parent 3fb72c2 commit 1e2f3d7

File tree

4 files changed

+394
-39
lines changed

4 files changed

+394
-39
lines changed

i18n/locales/en.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@
9797
"poorPerformance": "Poor Performance",
9898
"flameGraphs": "Flame Graphs"
9999
}
100+
},
101+
"testRunner": {
102+
"links": {
103+
"testRunner": "Test Runner",
104+
"introduction": "Discovering Node.js's test runner",
105+
"usingTestRunner": "Using Node.js's test runner"
106+
}
100107
}
101108
},
102109
"about": {

navigation.json

Lines changed: 52 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -330,48 +330,61 @@
330330
"label": "components.navigation.learn.diagnostics.links.flameGraphs"
331331
}
332332
}
333-
}
334-
}
335-
},
336-
"download": {
337-
"items": {
338-
"shaSums": {
339-
"link": "https://nodejs.org/dist/{nodeVersion}/SHASUMS256.txt.asc",
340-
"label": "components.downloadList.links.shaSums.title"
341-
},
342-
"allDownloads": {
343-
"link": "https://nodejs.org/dist/{nodeVersion}/",
344-
"label": "components.downloadList.links.allDownloads"
345-
},
346-
"packageManager": {
347-
"link": "/download/package-manager",
348-
"label": "components.downloadList.links.packageManager"
349-
},
350-
"previousReleases": {
351-
"link": "/about/previous-releases",
352-
"label": "components.downloadList.links.previousReleases"
353-
},
354-
"nightlyReleases": {
355-
"link": "https://nodejs.org/download/nightly/",
356-
"label": "components.downloadList.links.nightlyReleases"
357333
},
358-
"unofficialBuilds": {
359-
"link": "https://unofficial-builds.nodejs.org/download/",
360-
"label": "components.downloadList.links.unofficialBuilds"
361-
},
362-
"buildingFromSource": {
363-
"link": "https://github.com/nodejs/node/blob/main/BUILDING.md#building-nodejs-on-supported-platforms",
364-
"label": "components.downloadList.links.buildingFromSource"
365-
},
366-
"installingOnLinux": {
367-
"link": "https://github.com/nodejs/help/wiki/Installation",
368-
"label": "components.downloadList.links.installingOnLinux"
369-
},
370-
"installingOnWsl": {
371-
"link": "https://github.com/nodejs/node/blob/main/BUILDING.md#building-nodejs-on-supported-platforms",
372-
"label": "components.downloadList.links.installingOnWsl"
334+
"testRunner": {
335+
"label": "components.navigation.learn.testRunner.links.testRunner",
336+
"items": {
337+
"introduction": {
338+
"link": "/learn/test-runner/introduction",
339+
"label": "components.navigation.learn.testRunner.links.introduction"
340+
},
341+
"usingTestRunner": {
342+
"link": "/learn/test-runner/using-test-runner",
343+
"label": "components.navigation.learn.testRunner.links.usingTestRunner"
344+
}
345+
}
373346
}
374347
}
375348
}
349+
},
350+
"download": {
351+
"items": {
352+
"shaSums": {
353+
"link": "https://nodejs.org/dist/{nodeVersion}/SHASUMS256.txt.asc",
354+
"label": "components.downloadList.links.shaSums.title"
355+
},
356+
"allDownloads": {
357+
"link": "https://nodejs.org/dist/{nodeVersion}/",
358+
"label": "components.downloadList.links.allDownloads"
359+
},
360+
"packageManager": {
361+
"link": "/download/package-manager",
362+
"label": "components.downloadList.links.packageManager"
363+
},
364+
"previousReleases": {
365+
"link": "/about/previous-releases",
366+
"label": "components.downloadList.links.previousReleases"
367+
},
368+
"nightlyReleases": {
369+
"link": "https://nodejs.org/download/nightly/",
370+
"label": "components.downloadList.links.nightlyReleases"
371+
},
372+
"unofficialBuilds": {
373+
"link": "https://unofficial-builds.nodejs.org/download/",
374+
"label": "components.downloadList.links.unofficialBuilds"
375+
},
376+
"buildingFromSource": {
377+
"link": "https://github.com/nodejs/node/blob/main/BUILDING.md#building-nodejs-on-supported-platforms",
378+
"label": "components.downloadList.links.buildingFromSource"
379+
},
380+
"installingOnLinux": {
381+
"link": "https://github.com/nodejs/help/wiki/Installation",
382+
"label": "components.downloadList.links.installingOnLinux"
383+
},
384+
"installingOnWsl": {
385+
"link": "https://github.com/nodejs/node/blob/main/BUILDING.md#building-nodejs-on-supported-platforms",
386+
"label": "components.downloadList.links.installingOnWsl"
387+
}
388+
}
376389
}
377390
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Discovering Node.js's test runner
3+
layout: learn
4+
authors: AugustinMauroy
5+
---
6+
7+
# Discovering Node.js's test runner
8+
9+
In this series of resources, we will discover how to use Node.js's test runner to test our code.
10+
11+
## What is a test runner?
12+
13+
A test runner is a tool that allows you to run tests on your code. It will execute your tests and give you feedback on whether they pass or fail. It can also provide you with additional information such as code coverage.
14+
15+
There are many test runners available for Node.js, but we will focus on the built-in test runner that comes with Node.js. It's cool because you don't need to install any additional dependencies to use it.
16+
17+
## Why test your code?
18+
19+
Testing your code is important because it allows you to verify that your code works as expected. It helps you catch bugs early in the development process and ensures that your code is reliable and maintainable.
20+
21+
## Running tests with Node.js
22+
23+
To run tests with Node.js, we recommend you to read the [test runner documentation](https://nodejs.org/docs/latest/api/test.html#test-runner).

0 commit comments

Comments
 (0)