From 0409d42915df54b2bea0634495f57c312eede3ab Mon Sep 17 00:00:00 2001 From: Joy Dey Date: Tue, 23 Jul 2024 00:03:55 -0400 Subject: [PATCH 1/5] docs: indicate 'exports' interface does not work in browsers --- docs/API.md | 4 ++++ docs/index.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/API.md b/docs/API.md index a6e17bf284..c3c0dbb7de 100644 --- a/docs/API.md +++ b/docs/API.md @@ -10,6 +10,10 @@ Congratulations! You've found Mocha's API documentation. These docs are for deve Otherwise, **you probably want the [main documentation](https://mochajs.org)**. +## Exports Interface + +The "exports" interface is useful for organizing tests in a modular fashion. However, please note that the "exports" interface is **not supported in browser environments**. This is due to the way browsers handle module exports, which differs from Node.js. If you need to organize your tests for a large OOP project, consider using the BDD or TDD interfaces instead. + ## Other Links - **[Main Documentation](https://mochajs.org)** diff --git a/docs/index.md b/docs/index.md index d63d3d0cfe..2bad74ee55 100644 --- a/docs/index.md +++ b/docs/index.md @@ -46,6 +46,10 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in - [TextMate bundle](#textmate) {:.two-column} +## Running Mocha + +Mocha can be run in various environments, including Node.js and browsers. While most interfaces such as BDD and TDD are fully supported, please note that the "exports" interface does not work in browser environments due to how browsers handle module exports. Refer to the [Interfaces](./API.md#exports-interface) and [Browser Support](./browser-support.md) documentation for more details. + ## Table of Contents {{ toc }} From 64d647dc4dc6261014734db356ca19623edcd341 Mon Sep 17 00:00:00 2001 From: Joy Dey Date: Sun, 18 Aug 2024 16:25:08 -0400 Subject: [PATCH 2/5] docs: move 'exports' interface browser compatibility note to the exports section --- docs/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index 2bad74ee55..46b898e03e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -46,10 +46,6 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js][] and in - [TextMate bundle](#textmate) {:.two-column} -## Running Mocha - -Mocha can be run in various environments, including Node.js and browsers. While most interfaces such as BDD and TDD are fully supported, please note that the "exports" interface does not work in browser environments due to how browsers handle module exports. Refer to the [Interfaces](./API.md#exports-interface) and [Browser Support](./browser-support.md) documentation for more details. - ## Table of Contents {{ toc }} @@ -1831,6 +1827,10 @@ suite('Array', function () { ### Exports +The `exports` interface allows for organizing tests in a modular fashion. It is particularly useful in larger projects where test suites can be segmented into different files. + +**Note**: The `exports` interface is not supported in browser environments. This limitation arises because browsers handle module exports differently from Node.js. If you intend to run tests in a browser, consider using the BDD or TDD interfaces, which are fully supported. + The **Exports** interface is much like Mocha's predecessor [expresso][]. The keys `before`, `after`, `beforeEach`, and `afterEach` are special-cased, object values are suites, and function values are test-cases: ```js From ac82f47347343c4a7ceef6b29f79ce74c41a8efe Mon Sep 17 00:00:00 2001 From: Joy Dey Date: Sun, 18 Aug 2024 16:26:01 -0400 Subject: [PATCH 3/5] docs: remove redundant 'exports' interface note from API.md --- docs/API.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/API.md b/docs/API.md index c3c0dbb7de..a6e17bf284 100644 --- a/docs/API.md +++ b/docs/API.md @@ -10,10 +10,6 @@ Congratulations! You've found Mocha's API documentation. These docs are for deve Otherwise, **you probably want the [main documentation](https://mochajs.org)**. -## Exports Interface - -The "exports" interface is useful for organizing tests in a modular fashion. However, please note that the "exports" interface is **not supported in browser environments**. This is due to the way browsers handle module exports, which differs from Node.js. If you need to organize your tests for a large OOP project, consider using the BDD or TDD interfaces instead. - ## Other Links - **[Main Documentation](https://mochajs.org)** From 7300af33257fc3b73e54318f4d22f2ce8077104c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 30 Oct 2024 11:48:38 -0400 Subject: [PATCH 4/5] Apply suggestions from code review --- docs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 46b898e03e..3f6af98cd3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1827,11 +1827,11 @@ suite('Array', function () { ### Exports -The `exports` interface allows for organizing tests in a modular fashion. It is particularly useful in larger projects where test suites can be segmented into different files. +The **Exports** interface allows for organizing tests in a modular fashion. It is particularly useful in larger projects where test suites can be segmented into different files. **Note**: The `exports` interface is not supported in browser environments. This limitation arises because browsers handle module exports differently from Node.js. If you intend to run tests in a browser, consider using the BDD or TDD interfaces, which are fully supported. -The **Exports** interface is much like Mocha's predecessor [expresso][]. The keys `before`, `after`, `beforeEach`, and `afterEach` are special-cased, object values are suites, and function values are test-cases: +The Exports interface is much like Mocha's predecessor [expresso][]. The keys `before`, `after`, `beforeEach`, and `afterEach` are special-cased, object values are suites, and function values are test-cases: ```js module.exports = { From de198cd61f57df2686b116b366342be91cd41be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 30 Oct 2024 11:48:54 -0400 Subject: [PATCH 5/5] Update docs/index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 3f6af98cd3..b6d1b4e63f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1829,7 +1829,7 @@ suite('Array', function () { The **Exports** interface allows for organizing tests in a modular fashion. It is particularly useful in larger projects where test suites can be segmented into different files. -**Note**: The `exports` interface is not supported in browser environments. This limitation arises because browsers handle module exports differently from Node.js. If you intend to run tests in a browser, consider using the BDD or TDD interfaces, which are fully supported. +**Note**: The Exports interface is not supported in browser environments. This limitation arises because browsers handle module exports differently from Node.js. If you intend to run tests in a browser, consider using the BDD or TDD interfaces, which are fully supported. The Exports interface is much like Mocha's predecessor [expresso][]. The keys `before`, `after`, `beforeEach`, and `afterEach` are special-cased, object values are suites, and function values are test-cases: