Skip to content

Commit

Permalink
chore: fix windows CI (jestjs#9964)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 3, 2020
1 parent 2bac04f commit 5d1be03
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap
Expand Up @@ -36,7 +36,7 @@ FAIL __tests__/index.js
12 | module.exports = () => 'test';
13 |
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:541:17)
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:553:17)
at Object.require (index.js:10:1)
`;

Expand Down Expand Up @@ -65,6 +65,6 @@ FAIL __tests__/index.js
12 | module.exports = () => 'test';
13 |
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:541:17)
at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:553:17)
at Object.require (index.js:10:1)
`;
Expand Up @@ -37,6 +37,6 @@ FAIL __tests__/test.js
| ^
9 |
at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:296:11)
at Resolver.resolveModule (../../packages/jest-resolve/build/index.js:308:11)
at Object.require (index.js:8:18)
`;
4 changes: 3 additions & 1 deletion packages/jest-resolve/src/index.ts
Expand Up @@ -9,6 +9,7 @@ import * as path from 'path';
import type {Config} from '@jest/types';
import type {ModuleMap} from 'jest-haste-map';
import {tryRealpath} from 'jest-util';
import slash = require('slash');
import nodeModulesPaths from './nodeModulesPaths';
import isBuiltinModule from './isBuiltinModule';
import defaultResolver, {clearDefaultResolverCache} from './defaultResolver';
Expand Down Expand Up @@ -236,7 +237,8 @@ class Resolver {
// 5. Throw an error if the module could not be found. `resolve.sync` only
// produces an error based on the dirname but we have the actual current
// module name available.
const relativePath = path.relative(this._options.rootDir, from) || '.';
const relativePath =
slash(path.relative(this._options.rootDir, from)) || '.';

throw new ModuleNotFoundError(
`Cannot find module '${moduleName}' from '${relativePath}'`,
Expand Down

0 comments on commit 5d1be03

Please sign in to comment.