Skip to content

Commit

Permalink
eslint-module-utils: Fix resolver tests for Windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
sompylasar committed Jun 5, 2017
1 parent 314ead8 commit 117717f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 3 additions & 4 deletions tests/files/foo-bar-resolver-no-version.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
var path = require('path')

exports.resolveImport = function (modulePath, sourceFile, config) {
var fooPathSuffix = '/files/foo.js'
var exceptionPathSuffix = '/files/exception.js'
if (sourceFile.indexOf(fooPathSuffix) === sourceFile.length - fooPathSuffix.length) {
var sourceFileName = path.basename(sourceFile)
if (sourceFileName === 'foo.js') {
return path.join(__dirname, 'bar.jsx')
}
else if (sourceFile.indexOf(exceptionPathSuffix) === sourceFile.length - exceptionPathSuffix.length) {
else if (sourceFileName === 'exception.js') {
throw new Error('foo-bar-resolver-v1 resolveImport test exception')
}
else {
Expand Down
7 changes: 3 additions & 4 deletions tests/files/foo-bar-resolver-v1.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
var path = require('path')

exports.resolveImport = function (modulePath, sourceFile, config) {
var fooPathSuffix = '/files/foo.js'
var exceptionPathSuffix = '/files/exception.js'
if (sourceFile.indexOf(fooPathSuffix) === sourceFile.length - fooPathSuffix.length) {
var sourceFileName = path.basename(sourceFile)
if (sourceFileName === 'foo.js') {
return path.join(__dirname, 'bar.jsx')
}
else if (sourceFile.indexOf(exceptionPathSuffix) === sourceFile.length - exceptionPathSuffix.length) {
else if (sourceFileName === 'exception.js') {
throw new Error('foo-bar-resolver-v1 resolveImport test exception')
}
else {
Expand Down
7 changes: 3 additions & 4 deletions tests/files/foo-bar-resolver-v2.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
var path = require('path')

exports.resolve = function (modulePath, sourceFile, config) {
var fooPathSuffix = '/files/foo.js'
var exceptionPathSuffix = '/files/exception.js'
if (sourceFile.indexOf(fooPathSuffix) === sourceFile.length - fooPathSuffix.length) {
var sourceFileName = path.basename(sourceFile)
if (sourceFileName === 'foo.js') {
return { found: true, path: path.join(__dirname, 'bar.jsx') }
}
else if (sourceFile.indexOf(exceptionPathSuffix) === sourceFile.length - exceptionPathSuffix.length) {
else if (sourceFileName === 'exception.js') {
throw new Error('foo-bar-resolver-v2 resolve test exception')
}
else {
Expand Down

0 comments on commit 117717f

Please sign in to comment.