Skip to content

Commit

Permalink
Merge pull request #1507 from mightyiam/separate-resolved-config-tests
Browse files Browse the repository at this point in the history
chore: separate resolved config tests
  • Loading branch information
mightyiam committed Apr 8, 2024
2 parents eb35151 + a392a63 commit a2b1e5d
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions src/test/resolved-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@ import { ESLint } from 'eslint'
import exported from '..'
import { expectedExportedValue } from './_util'

test('resolved config', async (t): Promise<void> => {
const eslint = new ESLint({
useEslintrc: false,
overrideConfig: structuredClone(exported)
})
const eslint = new ESLint({
useEslintrc: false,
overrideConfig: structuredClone(exported)
})

const actual = eslint.calculateConfigForFile('foo.js')

const actual = await eslint.calculateConfigForFile('foo.js')
test('env', async (t) => {
t.deepEqual((await actual).env, expectedExportedValue.env)
})

test('plugins', async (t) => {
t.deepEqual((await actual).plugins, [...expectedExportedValue.plugins].reverse())
})

test('globals', async (t) => {
t.deepEqual((await actual).globals, expectedExportedValue.globals)
})

test('parser', async (t) => {
t.true((await actual).parser.includes(expectedExportedValue.parser))
})

t.deepEqual(actual.env, expectedExportedValue.env, 'env')
t.deepEqual(actual.plugins, [...expectedExportedValue.plugins].reverse(), 'plugins')
t.deepEqual(actual.globals, expectedExportedValue.globals, 'globals')
t.true(actual.parser.includes(expectedExportedValue.parser), 'parser')
t.deepEqual(actual.rules, expectedExportedValue.rules, 'rules')
test('rules', async (t) => {
t.deepEqual((await actual).rules, expectedExportedValue.rules)
})

0 comments on commit a2b1e5d

Please sign in to comment.