Skip to content

Commit 84f155b

Browse files
Remove mocha as a dependency (#1551)
* Remove mocha as a dependency * Restructure for node:test compat also, fix call to parseAll method * Update test commands in package.json
1 parent 9fe7f15 commit 84f155b

File tree

12 files changed

+43
-39
lines changed

12 files changed

+43
-39
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"scripts": {
4444
"create-patch": "node tools/create-patch.js",
4545
"curate": "node tools/prepare-curated.js ed curated && node tools/prepare-packages.js curated packages",
46-
"test": "mocha --recursive",
47-
"test-css": "mocha --recursive test/css",
48-
"test-elements": "mocha --recursive test/elements",
49-
"test-idl": "mocha --recursive test/idl"
46+
"test": "node --test",
47+
"test-css": "node --test \"test/css/*.js\"",
48+
"test-elements": "node --test \"test/elements/*.js\"",
49+
"test-idl": "node --test \"test/idl/*.js\""
5050
}
5151
}

test/cddl/all.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* The tests run against the curated view of the extracts.
55
*/
66

7+
import { describe, it } from 'node:test';
78
import { strict as assert } from 'node:assert';
89
import path from 'node:path';
910
import { fileURLToPath } from 'node:url';
@@ -19,9 +20,8 @@ function writeAnomalies(report) {
1920
report.map(anomaly => anomaly.content).join('\n');
2021
}
2122

22-
describe('The curated view of CDDL extracts', function () {
23-
// First run may download micropip and cddlparser packages from the net
24-
this.timeout(30000);
23+
describe('The curated view of CDDL extracts', {timeout: 30000}, function () {
24+
// Long timeout as first run may download micropip and cddlparser packages
2525

2626
it('passes Strudy\'s scrutiny', async function () {
2727
const crawlFile = path.join(curatedFolder, 'index.json');

test/css/all.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* data because that view is a strict subset of the curated view.
88
*/
99

10+
import { describe, it, before } from 'node:test';
1011
import { strict as assert } from 'node:assert';
1112
import path from 'node:path';
1213
import { fileURLToPath } from 'node:url';

test/css/package.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from 'node:test';
12
import { strict as assert } from 'node:assert';
23

34
import cssPackage from '../../packages/css/package.json' with { type: 'json' };

test/elements/all.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* the data because that view is a strict subset of the curated view.
88
*/
99

10+
import { describe, it } from 'node:test';
1011
import { strict as assert } from 'node:assert';
1112
import path from 'node:path';
1213
import { fileURLToPath } from 'node:url';
@@ -17,7 +18,6 @@ const curatedFolder = path.join(scriptPath, '..', '..', 'curated', 'elements');
1718

1819
describe('The curated view of elements extracts', function () {
1920
it('contains valid JSON and expected properties', async function () {
20-
this.slow(5000);
2121

2222
const all = await elements.listAll({ folder: curatedFolder });
2323
assert(Object.keys(all).length > 0);

test/elements/consistency.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* view because of some missing IDL definition in that view.
77
*/
88

9+
import { describe, it, before } from 'node:test';
910
import { strict as assert } from 'node:assert';
1011
import path from 'node:path';
1112
import { fileURLToPath } from 'node:url';

test/events/all.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* the data because that view is a strict subset of the curated view.
88
*/
99

10+
import { describe, it, before } from 'node:test';
1011
import { strict as assert } from 'node:assert';
1112
import path from 'node:path';
1213
import { fileURLToPath } from 'node:url';
@@ -146,4 +147,4 @@ describe('The curated view of events extracts', () => {
146147
// Dummy test to make sure that "before" function runs and has a place
147148
// to report runtime errors
148149
it('contains events', () => {});
149-
});
150+
});

test/idl/all.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* data because that view is a strict subset of the curated view.
88
*/
99

10+
import { describe, it } from 'node:test';
1011
import { strict as assert } from 'node:assert';
1112
import path from 'node:path';
1213
import { fileURLToPath } from 'node:url';
@@ -16,7 +17,6 @@ const scriptPath = path.dirname(fileURLToPath(import.meta.url));
1617
const curatedFolder = path.join(scriptPath, '..', '..', 'curated', 'idl');
1718

1819
describe('The curated view of Web IDL extracts', function () {
19-
this.slow(5000);
2020

2121
it('contains valid JSON and expected properties', async function () {
2222
const files = await idl.listAll({ folder: curatedFolder });

test/idl/consistency.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* view because of some missing IDL definition in that view.
1111
*/
1212

13+
import { describe, it } from 'node:test';
1314
import { strict as assert } from 'node:assert';
1415
import path from 'node:path';
1516
import { fileURLToPath } from 'node:url';
@@ -59,4 +60,4 @@ views.forEach(({ name, folder }) => {
5960
assert.equal(results.length, 0, writeAnomalies(results));
6061
});
6162
});
62-
});
63+
});

test/idl/package.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from 'node:test';
12
import { strict as assert } from 'node:assert';
23

34
import idlPackage from '../../packages/idl/package.json' with { type: 'json' };

0 commit comments

Comments
 (0)