diff --git a/test/ecmascript/README.md b/test/ecmascript/README.md index 42e99f5e..6be488fc 100644 --- a/test/ecmascript/README.md +++ b/test/ecmascript/README.md @@ -9,10 +9,5 @@ In our case, we only need to test parsing and not actually execute the tests. You can run the following script from this directory to update this test suite. ```sh -curl -L -o data-common.json https://raw.githubusercontent.com/kangax/compat-table/gh-pages/data-common.json -curl -L -o data-es5.js https://raw.githubusercontent.com/kangax/compat-table/gh-pages/data-es5.js -curl -L -o data-es6.js https://raw.githubusercontent.com/kangax/compat-table/gh-pages/data-es6.js -curl -L -o data-es2016plus.js https://raw.githubusercontent.com/kangax/compat-table/gh-pages/data-es2016plus.js -curl -L -o data-esintl.js https://raw.githubusercontent.com/kangax/compat-table/gh-pages/data-esintl.js -curl -L -o data-esnext.js https://raw.githubusercontent.com/kangax/compat-table/gh-pages/data-esnext.js +node update-all-data.mjs ``` \ No newline at end of file diff --git a/test/ecmascript/update-all-data.mjs b/test/ecmascript/update-all-data.mjs new file mode 100644 index 00000000..77dcc643 --- /dev/null +++ b/test/ecmascript/update-all-data.mjs @@ -0,0 +1,13 @@ +import { readdir, writeFile } from 'fs/promises'; + +const dir = new URL('./', import.meta.url); +const files = await readdir(dir); + +for (const file of files.filter(f => f.startsWith('data-'))) { + const url = `https://raw.githubusercontent.com/kangax/compat-table/gh-pages/${file}`; + const res = await fetch(url); + const text = await res.text(); + await writeFile(new URL(file, dir), text); +} + +console.log('Update complete!')