atomkirk
atomkirk

Reputation: 3801

Strange error trying to run ember tests on debian linux

All our tests pass on multiple macOS machines, and on semaphore-ci, but when we try to build and run tests on a new debian box, we get this error in loader.js:143

not ok 1320 Chrome 72.0 - TestLoader Failures: zipbooks/tests/unit/utils/request-log-test: could not be loaded
    ---
        actual: >
            null
        stack: >
            TypeError: Cannot read property 'exports' of undefined
                at Module._reify (http://localhost:45371/assets/vendor.js:148:59)
                at Module.reify (http://localhost:45371/assets/vendor.js:135:27)
                at Module.exports (http://localhost:45371/assets/vendor.js:109:10)
                at Module._reify (http://localhost:45371/assets/vendor.js:148:59)
                at Module.reify (http://localhost:45371/assets/vendor.js:135:27)
                at Module.exports (http://localhost:45371/assets/vendor.js:109:10)
                at Module._reify (http://localhost:45371/assets/vendor.js:148:59)
                at Module.reify (http://localhost:45371/assets/vendor.js:135:27)
                at Module.exports (http://localhost:45371/assets/vendor.js:109:10)
                at requireModule (http://localhost:45371/assets/vendor.js:32:18)
        message: >
            Died on test #1     at TestLoader.moduleLoadFailure (http://localhost:45371/assets/test-support.js:11150:24)
                at TestLoader.<anonymous> (http://localhost:45371/assets/test-support.js:10463:16)
                at TestLoader.require (http://localhost:45371/assets/test-support.js:10451:27)
                at TestLoader.loadModules (http://localhost:45371/assets/test-support.js:10443:16)
                at loadTests (http://localhost:45371/assets/test-support.js:11174:22)
                at start (http://localhost:45371/assets/test-support.js:10857:33)
                at Module.callback (http://localhost:45371/assets/tests.js:20710:25): Cannot read property 'exports' of undefined
        Log: |
            { type: 'info',
              text: '\'Unit assertion failed and test has been paused for inspection.\'\n' }
            { type: 'error',
              text: '{ module: \'TestLoader Failures\',\n  name: \'zipbooks/tests/unit/utils/request-log-test: could not be loaded\',\n  result: false,\n  message: \'Died on test #1     at TestLoader.moduleLoadFailure (http://localhost:45371/assets/test-support.js:11150:24)\\n    at TestLoader.<anonymous> (http://localhost:45371/assets/test-support.js:10463:16)\\n    at TestLoader.require (http://localhost:45371/assets/test-support.js:10451:27)\\n    at TestLoader.loadModules (http://localhost:45371/assets/test-support.js:10443:16)\\n    at loadTests (http://localhost:45371/assets/test-support.js:11174:22)\\n    at start (http://localhost:45371/assets/test-support.js:10857:33)\\n    at Module.callback (http://localhost:45371/assets/tests.js:20710:25): Cannot read property \\\'exports\\\' of undefined\',\n  actual: null,\n  testId: \'8629d10a\',\n  negative: false,\n  runtime: 1,\n  todo: false,\n  source: \'TypeError: Cannot read property \\\'exports\\\' of undefined\\n    at Module._reify (http://localhost:45371/assets/vendor.js:148:59)\\n    at Module.reify (http://localhost:45371/assets/vendor.js:135:27)\\n    at Module.exports (http://localhost:45371/assets/vendor.js:109:10)\\n    at Module._reify (http://localhost:45371/assets/vendor.js:148:59)\\n    at Module.reify (http://localhost:45371/assets/vendor.js:135:27)\\n    at Module.exports (http://localhost:45371/assets/vendor.js:109:10)\\n    at Module._reify (http://localhost:45371/assets/vendor.js:148:59)\\n    at Module.reify (http://localhost:45371/assets/vendor.js:135:27)\\n    at Module.exports (http://localhost:45371/assets/vendor.js:109:10)\\n    at requireModule (http://localhost:45371/assets/vendor.js:32:18)\' }\n' }

We cannot find any information or have any guesses what might be causing this error.

ember-cli: 3.1.4
node: 8.5.0
os: linux x64

The pattern I'm seeing is that any test that uses setupTest, setupApplicationTest or setupRenderingTest is failing. Regular qunit tests that dont have any setup hooks pass fine.

Upvotes: 0

Views: 306

Answers (2)

atomkirk
atomkirk

Reputation: 3801

The problem was not installing the yarn dependencies in our in-repo addon 😑

Upvotes: 1

Chris de Almeida
Chris de Almeida

Reputation: 458

The most likely cause is binary dependencies that are platform-specific. Have you tried running npm rebuild first? Certain dependencies (such as node-sass) use binaries that are platform-specific, and need to be rebuilt. If that's your issue, if you ever need to do this in an automated fashion, you'll want to limit the scope of the rebuild to only the necessary dependencies, e.g. npm rebuild some-package some-other-package rather than the all inclusive npm rebuild

Unfortunately, yarn has yet to implement the rebuild feature, so we've moved back to npm, for that and other reasons. -- link to issue in GitHub

Upvotes: 0

Related Questions