Skip to content

Commit

Permalink
Make testVersion take a function to delay running require.resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepsteak committed Jun 23, 2019
1 parent d7023f6 commit 7e41d29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tests/src/rules/order.js
Expand Up @@ -1373,7 +1373,7 @@ ruleTester.run('order', rule, {
}],
})),
// fix incorrect order with typescript-eslint-parser
testVersion('<6.0.0', {
testVersion('<6.0.0', () => ({
code: `
var async = require('async');
var fs = require('fs');
Expand All @@ -1387,9 +1387,9 @@ ruleTester.run('order', rule, {
ruleId: 'order',
message: '`fs` import should occur before import of `async`',
}],
}),
})),
// fix incorrect order with @typescript-eslint/parser
testVersion('>5.0.0', {
testVersion('>5.0.0', () => ({
code: `
var async = require('async');
var fs = require('fs');
Expand All @@ -1403,6 +1403,6 @@ ruleTester.run('order', rule, {
ruleId: 'order',
message: '`fs` import should occur before import of `async`',
}],
}),
})),
].filter((t) => !!t),
})
2 changes: 1 addition & 1 deletion tests/src/utils.js
Expand Up @@ -12,7 +12,7 @@ export function testFilePath(relativePath) {
export const FILENAME = testFilePath('foo.js')

export function testVersion(specifier, t) {
return semver.satisfies(eslintPkg.version, specifier) && test(t)
return semver.satisfies(eslintPkg.version, specifier) && test(t())
}

export function test(t) {
Expand Down

0 comments on commit 7e41d29

Please sign in to comment.