diff --git a/package-lock.json b/package-lock.json index 88c75b046509..a7da6f41362d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,36 @@ "node": ">=10" } }, + "../reffy": { + "version": "10.0.4", + "extraneous": true, + "license": "MIT", + "dependencies": { + "abortcontroller-polyfill": "1.7.3", + "ajv": "8.11.0", + "ajv-formats": "2.1.1", + "commander": "9.4.0", + "fetch-filecache-for-crawling": "4.1.0", + "puppeteer": "18.0.5", + "semver": "^7.3.5", + "web-specs": "2.25.0", + "webidl2": "24.2.2" + }, + "bin": { + "reffy": "reffy.js" + }, + "devDependencies": { + "chai": "4.3.6", + "mocha": "10.0.0", + "nock": "13.2.9", + "respec": "32.2.4", + "respec-hljs": "2.1.1", + "rollup": "2.79.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@actions/core": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz", @@ -910,7 +940,7 @@ "node_modules/filename-reserved-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", "dev": true, "engines": { "node": ">=4" @@ -1803,7 +1833,7 @@ "node_modules/strip-outer/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "engines": { "node": ">=0.8.0" @@ -1879,7 +1909,7 @@ "node_modules/trim-repeated": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", "dev": true, "dependencies": { "escape-string-regexp": "^1.0.2" @@ -1891,7 +1921,7 @@ "node_modules/trim-repeated/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "engines": { "node": ">=0.8.0" @@ -2964,7 +2994,7 @@ "filename-reserved-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", "dev": true }, "filenamify": { @@ -3594,7 +3624,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true } } @@ -3657,7 +3687,7 @@ "trim-repeated": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", "dev": true, "requires": { "escape-string-regexp": "^1.0.2" @@ -3666,7 +3696,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true } } diff --git a/test/schemas.js b/test/schemas.js new file mode 100644 index 000000000000..57a0f92dfe12 --- /dev/null +++ b/test/schemas.js @@ -0,0 +1,41 @@ +/** + * Test individual elements extracts. + * + * The tests run against the curated view of the extracts. + */ + +const fs = require('fs'); +const path = require('path'); +const assert = require('assert').strict; +const { getSchemaValidationFunction } = require('reffy'); + +const curatedFolder = path.join(__dirname, '..', 'curated'); +const files = fs.readdirSync(curatedFolder); +for (const file of files) { + const validate = getSchemaValidationFunction(file); + if (file.endsWith('.json')) { + describe(`The ${file} file`, function () { + it('contains valid data', function () { + const data = require(path.join(curatedFolder, file)); + const errors = validate(data); + assert.strictEqual(errors, null, JSON.stringify(errors, null, 2)); + }); + }); + } + else { + describe(`The ${file} folder`, function () { + const extractType = file; + const folder = path.join(curatedFolder, extractType); + const files = fs.readdirSync(folder); + for (const file of files) { + if (file.endsWith('.json')) { + it(`contains valid ${extractType} data in ${file}`, () => { + const data = require(path.join(folder, file)); + const errors = validate(data); + assert.strictEqual(errors, null, JSON.stringify(errors, null, 2)); + }); + } + } + }); + } +}