Skip to content

Commit 6f23519

Browse files
Add mocha-root-hooks.js for preloading Chalk in tests for contentstack-auth and contentstack-config. Updated .mocharc.json files to include the new hooks.
1 parent ecb97f3 commit 6f23519

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

packages/contentstack-auth/.mocharc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"require": [
33
"test/helpers/init.js",
44
"ts-node/register",
5-
"source-map-support/register"
5+
"source-map-support/register",
6+
"test/helpers/mocha-root-hooks.js"
67
],
78
"watch-extensions": [
89
"ts"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @contentstack/cli-utilities uses lazy-loaded Chalk 5; preload before tests that hit cliux.
3+
*/
4+
const { loadChalk } = require('@contentstack/cli-utilities');
5+
6+
exports.mochaHooks = {
7+
beforeAll() {
8+
this.timeout(30_000);
9+
return loadChalk();
10+
},
11+
};

packages/contentstack-config/.mocharc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"require": [
33
"ts-node/register",
4-
"source-map-support/register"
4+
"source-map-support/register",
5+
"test/helpers/mocha-root-hooks.js"
56
],
67
"watch-extensions": [
78
"ts"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @contentstack/cli-utilities uses lazy-loaded Chalk 5; preload before tests that hit cliux.success etc.
3+
*/
4+
const { loadChalk } = require('@contentstack/cli-utilities');
5+
6+
exports.mochaHooks = {
7+
beforeAll() {
8+
this.timeout(30_000);
9+
return loadChalk();
10+
},
11+
};

0 commit comments

Comments
 (0)