diff --git a/test/ecmascript/README.md b/test/ecmascript/README.md index 42e99f5e..785a090a 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.js ``` \ No newline at end of file diff --git a/test/ecmascript/update-all-data.js b/test/ecmascript/update-all-data.js new file mode 100644 index 00000000..5fa0ffcb --- /dev/null +++ b/test/ecmascript/update-all-data.js @@ -0,0 +1,14 @@ +const { readdir, writeFile } = require('fs/promises'); +const { join } = require('path'); + +async function main() { + const files = await readdir(__dirname); + 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(join(__dirname, file), text); + } +} + +main().then(() => console.log('Done.')).catch(e => console.error(e));