test files for ES5 compatibility
- JavaScript 100%
| test-fixtures | Stop running test fixtures as tests | |
| .gitignore | Initial commit | |
| .prettierrc.json | Update Prettier | |
| check-ecmascript-version-compatibility.js | Minor: remove a newline | |
| eslint.config.mjs | Update ESLint | |
| LICENSE | Update license year for 2026 | |
| package-lock.json |
Switch to detect-es-version
|
|
| package.json | Switch to Codeberg | |
| README.md | Use ESLint + Prettier instead of Standard | |
| test.js | Tweak variable name of test fixture | |
Check ECMAScript Version Compatibility
A small lib that helps check and make sure that your JavaScript will run in chosen ES version environment (defaults to ES5).
Install
npm install --save-dev check-ecmascript-version-compatibility
Usage
Here's an example that uses Mocha:
var checkFile = require("check-ecmascript-version-compatibility");
describe("my file", function () {
it("is ES2016-compliant", function (done) {
// It can take awhile to parse large files, so you may need to
// increase your timeouts.
this.slow(8000);
this.timeout(10000);
checkFile("path/to/file.js", 2016, done);
});
});
If you do not pass in a version number, it will default to ES5.
describe("my file", function () {
it("is ES5-compliant", function (done) {
// It can take awhile to parse large files, so you may need to
// increase your timeouts.
this.slow(8000);
this.timeout(10000);
checkFile("path/to/file.js", done);
});
});