Skip to content

Commit 18e4607

Browse files
committed
Remove mocha as a dependency
1 parent 9fe7f15 commit 18e4607

File tree

11 files changed

+26
-21
lines changed

11 files changed

+26
-21
lines changed

test/cddl/all.js

Lines changed: 1 addition & 0 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';

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' };

test/idl/validate.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* the package view, e.g. due to missing base interfaces.
1010
*/
1111

12+
import { describe, it, before } from 'node:test';
1213
import { strict as assert } from 'node:assert';
1314
import path from 'node:path';
1415
import { fileURLToPath } from 'node:url';
@@ -41,28 +42,25 @@ function validate(ast) {
4142
}
4243

4344
describe(`The ${curatedView.name} view of Web IDL extracts`, function () {
45+
let all;
4446
before(async () => {
45-
const all = await idl.parseAll(curatedView.folder);
46-
47-
describe(`The ${curatedView.name} view of Web IDL extracts`, function () {
48-
for (const [spec, ast] of Object.entries(all)) {
49-
it(`contains valid Web IDL for ${spec}`, function () {
50-
validate(ast);
51-
});
52-
}
53-
});
47+
all = await idl.parseAll(curatedView.folder);
48+
});
5449

55-
describe(`The combined Web IDL in the ${curatedView.name} view`, function () {
56-
it('is valid Web IDL', function () {
57-
this.slow(1000);
58-
validate(Object.values(all).flat());
50+
it(`The ${curatedView.name} view of Web IDL extracts`, function () {
51+
for (const [spec, ast] of Object.entries(all)) {
52+
it(`contains valid Web IDL for ${spec}`, function () {
53+
validate(ast);
5954
});
55+
}
56+
});
57+
58+
it(`The combined Web IDL in the ${curatedView.name} view`, function () {
59+
it('is valid Web IDL', function () {
60+
validate(Object.values(all).flat());
6061
});
6162
});
6263

63-
// Dummy test needed for "before" to run and register late tests
64-
// (test will fail if before function throws, e.g. because data is invalid)
65-
it('contains data that can be parsed with webidl2.js', () => {});
6664
});
6765

6866

@@ -72,7 +70,6 @@ describe(`The ${packageView.name} view of Web IDL extracts`, async () => {
7270

7371
describe(`The combined Web IDL in the ${packageView.name} view`, function () {
7472
it('is valid Web IDL', function () {
75-
this.slow(1000);
7673
validate(Object.values(all).flat());
7774
});
7875
});

0 commit comments

Comments
 (0)