From aeb21ae72926061604b7c780d5ea83a5a447b7d4 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 17 Sep 2021 10:13:37 +0200 Subject: [PATCH] chore: detect version of eslint, not its engine (#127) --- integrationTests/custom-parser.test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/integrationTests/custom-parser.test.js b/integrationTests/custom-parser.test.js index a813aa2..b5f5aca 100644 --- a/integrationTests/custom-parser.test.js +++ b/integrationTests/custom-parser.test.js @@ -1,14 +1,14 @@ -const eslint = require('eslint'); +const { version } = require('eslint/package.json'); +const semver = require('semver'); const runJest = require('./runJest'); +const isBelow6 = semver.satisfies(version, '<6'); + // Note: ESLint versions <6 have a different error message for this test. The // snapshot file contains both messages so we can test across both versions. // Without the skipped tests for the "other" version, the tests will always fail // with `1 snapshot obsolete`. -if ( - eslint.CLIEngine.version.startsWith('4') || - eslint.CLIEngine.version.startsWith('5') -) { +if (isBelow6) { it.skip("Doesn't override parser when not set", () => {}); it("Doesn't override parser when not set [ESLint<6]", async () => { expect(await runJest('custom-parser')).toMatchSnapshot();