Build test with Jest fails with `Could not locate module @/something`

I’m building an app with vuejs and testing with jest and running the tests locally works, but on circleci fails with the error

FAIL  test/unit/specs/components/ui/MessageUI.spec.js
   Test suite failed to run
    Configuration error:
    Could not locate module @/components/ui/MessageUi (mapped as /home/circleci/repo/src/components/ui/MessageUi)
    Please check:
    "moduleNameMapper": {
      "/^@\/(.*)$/": "/home/circleci/repo/src/$1"
    },
    "resolver": undefined

is not finding the component with the alias @. :angry:

the failing component require:

import Component from '@/components/ui/MessageUi'

in the same folder I have another test, working, with:

import Component from '@/components/ui/TabsUi'

build: https://circleci.com/gh/letanure/poc-cms/39
repo: https://github.com/letanure/poc-cms ( I cant post more than 2 links)
test: /blob/dev/test/unit/specs/components/ui/MessageUI.spec.js#L3
component /blob/dev/src/components/ui/MessageUI.vue
jest config for the @ alias : /blob/dev/test/unit/jest.conf.js#L11

Which versions of node, npm, etc are you using locally?

the same v7.10.1

➜  poc-cms git:(circleci-2) ✗ nvm use v7.10.1
Now using node v7.10.1 (npm v4.2.0)
➜  poc-cms git:(circleci-2) ✗ yarn run unit
yarn run v0.27.5
$ jest --config test/unit/jest.conf.js --coverage
 PASS  test/unit/specs/AppCms.spec.js
 PASS  test/unit/specs/components/HelloWorld.spec.js
 PASS  test/unit/specs/components/ui/TabsUi.spec.js
 PASS  test/unit/specs/components/ui/MessageUI.spec.js
 PASS  test/unit/specs/store/modules/counter.spec.js

Test Suites: 5 passed, 5 total
Tests:       35 passed, 35 total
Snapshots:   0 total
Time:        2.972s
Ran all test suites.
--------------------|----------|----------|----------|----------|----------------|
File                |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
--------------------|----------|----------|----------|----------|----------------|
All files           |    30.61 |     6.06 |    40.38 |    42.45 |                |
 components         |       50 |      100 |       20 |       50 |                |
  HelloWorld.vue    |       50 |      100 |       20 |       50 |106,110,114,118 |
 components/ui      |       31 |     4.17 |    42.86 |    38.75 |                |
  BreadcrumbUi.vue  |        0 |        0 |        0 |        0 |... 74,75,76,77 |
  MessageUI.vue     |        0 |        0 |        0 |        0 |... 122,123,124 |
  MessageUi.vue     |    76.92 |      100 |    77.78 |    76.92 |    108,114,115 |
  TabsUi.vue        |      100 |      100 |      100 |      100 |                |
  index.js          |        0 |        0 |        0 |        0 |              1 |
 store              |     7.69 |        0 |        0 |    22.22 |                |
  actions.js        |      100 |      100 |      100 |      100 |                |
  getters.js        |      100 |      100 |      100 |      100 |                |
  index.js          |        0 |        0 |        0 |        0 |  1,2,3,4,5,7,9 |
  mutation-types.js |      100 |      100 |      100 |      100 |                |
 store/modules      |    61.54 |    33.33 |    66.67 |    88.89 |                |
  counter.js        |      100 |      100 |      100 |      100 |                |
  index.js          |        0 |        0 |        0 |        0 |              1 |
--------------------|----------|----------|----------|----------|----------------|
Done in 5.90s.
➜  poc-cms git:(circleci-2) ✗ nvm ls
         v4.5.0
         v6.6.0
         v6.9.4
->      v7.10.1
         v8.1.4
         system
default -> v6.6.0
node -> stable (-> v8.1.4) (default)
stable -> 8.1 (-> v8.1.4) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.8.7 (-> N/A)
lts/boron -> v6.12.2 (-> N/A)
lts/carbon -> v8.9.3 (-> N/A)
➜  poc-cms git:(circleci-2) ✗

Any solution for this issue? Breaking on all jest aliases. Does not seem dependent on variations of moduleNameMapper value, runs well locally.

Also have tried with multiple node versions. Does not seem to affect.

I’m specifying jest moduleNameMapper in my package.json, but from what I understand it should not make a difference where I define this.

In my case I think is related to the building SO and the file names case.

On MAC I can include a file named MyModule.vue even if the file name is myModule.vue, but on UNIX is not possible to find this file.

Another trick is that is not possible just rename the file from myModule.vue to MyModule.vue, because github will just ignore the change. Locally I see the right name, but on the repository the name still wrong, so to really change the name on github I was forced to rename to something completelly different (___MyModule.vue), commit and push, and after thjis aplly the proper name (MyModule.vue)

after this, my builds on unix system worked, Im using DroneCI now.

about the aliases, I didnt have this problem