【发布时间】:2019-02-21 22:00:47
【问题描述】:
我们所有的测试都在多台 macOS 机器和 semaphore-ci 上通过,但是当我们尝试在新的 debian 机器上构建和运行测试时,我们在 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' }
我们找不到任何信息或猜测可能导致此错误的原因。
ember-cli: 3.1.4
node: 8.5.0
os: linux x64
我看到的模式是任何使用setupTest、setupApplicationTest 或setupRenderingTest 的测试都失败了。没有任何设置挂钩的常规 qunit 测试可以通过。
【问题讨论】:
-
你确定你的依赖是一样的吗?对我来说,这听起来像是不同版本的依赖项或子依赖项。
-
我们使用相同的 package.json 运行
yarn install。我不确定有什么不同。 -
您需要拥有相同的
yarn.lock才能获得相同版本的依赖项和子依赖项。仅共享相同的package.json并不能保证确定性构建。 -
在不同环境中进行不同测试时,我首先看到的是
config/targets.js。默认开关基于环境变量CI构建目标。最近几次我们在一个地方看到了奇怪的测试,这是因为这个变量被设置在那里(或者其他东西在构建时影响了环境)。您可能还想在这两个位置运行ember build,然后检查输出是否存在差异。 -
锁定文件在 git 中,我们已经使用了目标并设置了 CI。不同的构建输出是一个绝妙的主意。我会跟进reaults
标签: linux testing ember.js qunit acceptance-testing