Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop dependency on chai for tests #1505

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 0 additions & 154 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"webidl2": "24.4.1"
},
"devDependencies": {
"chai": "4.3.10",
"mocha": "10.3.0",
"respec": "34.4.0",
"respec-hljs": "2.1.1",
Expand Down
12 changes: 6 additions & 6 deletions tests/crawl.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function runWithAnnotatedCrawlData(path, fn) {
}

if (global.describe && describe instanceof Function) {
const { assert } = require('chai');
const assert = require('assert');

describe("The crawler", function () {
this.slow(20000);
Expand Down Expand Up @@ -109,7 +109,7 @@ if (global.describe && describe instanceof Function) {
fallback
}));
assert.equal(results[0].title, "Change is the only constant");
assert.isUndefined(results[0].error);
assert.ifError(results[0].error);
assert.equal(results[0].refs, "A useful list of refs");
})

Expand All @@ -119,7 +119,7 @@ if (global.describe && describe instanceof Function) {
[{ url, nightly: { url } }],
{ forceLocalFetch: true });
assert.equal(results[0].title, "[Could not be determined, see error]");
assert.include(results[0].error, "Loading https://www.w3.org/TR/idontexist/ triggered HTTP status 404");
assert(results[0].error.includes("Loading https://www.w3.org/TR/idontexist/ triggered HTTP status 404"));
});

it("reports errors and returns fallback data when possible", async () => {
Expand All @@ -132,7 +132,7 @@ if (global.describe && describe instanceof Function) {
fallback
});
assert.equal(results[0].title, "On the Internet, nobody knows you don't exist");
assert.include(results[0].error, "Loading https://www.w3.org/TR/idontexist/ triggered HTTP status 404");
assert(results[0].error.includes("Loading https://www.w3.org/TR/idontexist/ triggered HTTP status 404"));
assert.equal(results[0].refs, "A useful list of refs");
});

Expand All @@ -147,7 +147,7 @@ if (global.describe && describe instanceof Function) {
});
const results = require(path.resolve(output, "index.json"));
assert.equal(results.results[0].url, "https://www.w3.org/TR/idontexist/");
assert.include(results.results[0].error, "Loading https://www.w3.org/TR/idontexist/ triggered HTTP status 404");
assert(results.results[0].error.includes("Loading https://www.w3.org/TR/idontexist/ triggered HTTP status 404"));
assert.equal(results.results[0].refs, "refs/idontexist.json");
const refs = require(path.resolve(output, "refs", "idontexist.json"));
assert.equal(refs.refs, "A useful list of refs");
Expand All @@ -159,7 +159,7 @@ if (global.describe && describe instanceof Function) {
[{ url, nightly: { url } }],
{ forceLocalFetch: true });
assert.equal(results[0].title, "[Could not be determined, see error]");
assert.include(results[0].error, "CSS server issue detected");
assert(results[0].error.includes("CSS server issue detected"));
});

it("crawls the published spec when `--release` is set", async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/create-outline.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { assert } = require('chai');
const assert = require('assert');
const puppeteer = require('puppeteer');
const path = require('path');
const rollup = require('rollup');
Expand Down
4 changes: 2 additions & 2 deletions tests/css-grammar-parser/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const css = require("../../src/lib/css-grammar-parser");
const fs = require("fs");
const expect = require('chai').expect;
const assert = require("assert");

const propDefs = fs.readFileSync("tests/css-grammar-parser/in", "utf-8").split("\n").map(def => def.trim());
const propDefsOut = JSON.parse(fs.readFileSync("tests/css-grammar-parser/out.json", "utf-8"));
Expand All @@ -9,7 +9,7 @@ const results = propDefs.map(css.parsePropDefValue);
describe('Parser correctly parses grammar instances', () => {
for(let i in results) {
it(`parses property definition ${propDefs[i]} as expected`, () => {
expect(results[i]).to.deep.equal(propDefsOut[i], `Parsing ${propDefs[i]} got ${JSON.stringify(results[i], null, 2)} instead of ${JSON.stringify(propDefsOut[i], null, 2)}`);
assert.deepStrictEqual(results[i], propDefsOut[i], `Parsing ${propDefs[i]} got ${JSON.stringify(results[i], null, 2)} instead of ${JSON.stringify(propDefsOut[i], null, 2)}`);
});
}
});
2 changes: 1 addition & 1 deletion tests/extract-dfns.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { assert } = require('chai');
const assert = require('assert');
const puppeteer = require('puppeteer');
const path = require('path');
const rollup = require('rollup');
Expand Down
2 changes: 1 addition & 1 deletion tests/extract-elements.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/extract-events.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { assert } = require('chai');
const assert = require('assert');
const puppeteer = require('puppeteer');
const path = require('path');
const rollup = require('rollup');
Expand Down
2 changes: 1 addition & 1 deletion tests/extract-headings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { assert } = require('chai');
const assert = require('assert');
const puppeteer = require('puppeteer');
const path = require('path');
const rollup = require('rollup');
Expand Down
2 changes: 1 addition & 1 deletion tests/extract-ids.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { assert } = require('chai');
const assert = require('assert');
const puppeteer = require('puppeteer');
const path = require('path');
const rollup = require('rollup');
Expand Down
2 changes: 1 addition & 1 deletion tests/extract-references.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { assert } = require('chai');
const assert = require('assert');
const puppeteer = require('puppeteer');
const path = require('path');
const rollup = require('rollup');
Expand Down
2 changes: 1 addition & 1 deletion tests/extract-webidl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { assert } = require('chai');
const assert = require('assert');
const puppeteer = require('puppeteer');
const path = require('path');
const rollup = require('rollup');
Expand Down
Loading
Loading