Skip to content

Commit

Permalink
tests: fix ES2022 tests (mysticatea#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Nov 28, 2022
1 parent f58fef6 commit 078c406
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions test/get-function-head-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("The 'getFunctionHeadLocation' function", () => {
"class A { static async foo() {} }": [10, 26],
"class A { static get foo() {} }": [10, 24],
"class A { static set foo(a) {} }": [10, 24],
...(semver.gte(eslint.Linter.version, "7.0.0")
...(semver.gte(eslint.Linter.version, "8.0.0")
? {
"class A { #foo() {} }": [10, 14],
"class A { *#foo() {} }": [10, 15],
Expand Down Expand Up @@ -119,7 +119,7 @@ describe("The 'getFunctionHeadLocation' function", () => {
{
rules: { test: "error" },
parserOptions: {
ecmaVersion: semver.gte(eslint.Linter.version, "7.0.0")
ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0")
? 2022
: 2018,
},
Expand Down
6 changes: 3 additions & 3 deletions test/get-function-name-with-kind.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("The 'getFunctionNameWithKind' function", () => {
"class A { static get foo() {} }": "static getter 'foo'",
"class A { static set foo(a) {} }": "static setter 'foo'",

...(semver.gte(eslint.Linter.version, "7.0.0")
...(semver.gte(eslint.Linter.version, "8.0.0")
? {
"class A { #foo() {} }": "private method #foo",
"class A { '#foo'() {} }": "method '#foo'",
Expand Down Expand Up @@ -139,7 +139,7 @@ describe("The 'getFunctionNameWithKind' function", () => {
const messages = linter.verify(key, {
rules: { test: "error" },
parserOptions: {
ecmaVersion: semver.gte(eslint.Linter.version, "7.0.0")
ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0")
? 2022
: 2018,
},
Expand Down Expand Up @@ -168,7 +168,7 @@ describe("The 'getFunctionNameWithKind' function", () => {
const messages = linter.verify(key, {
rules: { test: "error" },
parserOptions: {
ecmaVersion: semver.gte(eslint.Linter.version, "7.0.0")
ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0")
? 2022
: 2018,
},
Expand Down
4 changes: 2 additions & 2 deletions test/get-property-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("The 'getPropertyName' function", () => {
{ code: "(class {['a' + 'b']() {}})", expected: "ab" },
{ code: "(class {[tag`b`]() {}})", expected: null },
{ code: "(class {[`${b}`]() {}})", expected: null }, //eslint-disable-line no-template-curly-in-string
...(semver.gte(eslint.Linter.version, "7.0.0")
...(semver.gte(eslint.Linter.version, "8.0.0")
? [
{ code: "(class { x })", expected: "x" },
{ code: "(class { static x })", expected: "x" },
Expand Down Expand Up @@ -68,7 +68,7 @@ describe("The 'getPropertyName' function", () => {
}))
const messages = linter.verify(code, {
parserOptions: {
ecmaVersion: semver.gte(eslint.Linter.version, "7.0.0")
ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0")
? 2022
: 2018,
},
Expand Down
4 changes: 2 additions & 2 deletions test/get-static-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const aMap = Object.freeze({
code: "({'a': 1, 1e+1: 2, 2n: 3})",
expected: { value: { a: 1, 10: 2, 2: 3 } },
},
...(semver.gte(eslint.Linter.version, "7.0.0")
...(semver.gte(eslint.Linter.version, "8.0.0")
? [
{
code: `class A {
Expand Down Expand Up @@ -299,7 +299,7 @@ const aMap = Object.freeze({
const messages = linter.verify(code, {
env: { es6: true },
parserOptions: {
ecmaVersion: semver.gte(eslint.Linter.version, "7.0.0")
ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0")
? 2022
: 2020,
},
Expand Down
4 changes: 2 additions & 2 deletions test/has-side-effect.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe("The 'hasSideEffect' function", () => {
options: { considerImplicitTypeConversion: true },
expected: false,
},
...(semver.gte(eslint.Linter.version, "7.0.0")
...(semver.gte(eslint.Linter.version, "8.0.0")
? [
{
code: "(class { x })",
Expand Down Expand Up @@ -318,7 +318,7 @@ describe("The 'hasSideEffect' function", () => {
const messages = linter.verify(code, {
env: { es6: true },
parserOptions: {
ecmaVersion: semver.gte(eslint.Linter.version, "7.0.0")
ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0")
? 2022
: 2020,
},
Expand Down
4 changes: 2 additions & 2 deletions test/reference-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CALL, CONSTRUCT, ESM, READ, ReferenceTracker } from "../src/"

const config = {
parserOptions: {
ecmaVersion: semver.gte(eslint.Linter.version, "7.0.0") ? 2022 : 2020,
ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0") ? 2022 : 2020,
sourceType: "module",
},
globals: { Reflect: false },
Expand Down Expand Up @@ -497,7 +497,7 @@ describe("The 'ReferenceTracker' class:", () => {
},
expected: [],
},
...(semver.gte(eslint.Linter.version, "7.0.0")
...(semver.gte(eslint.Linter.version, "8.0.0")
? [
{
description:
Expand Down

0 comments on commit 078c406

Please sign in to comment.