ember-cli: ember test crashes on run when fingerprinting is enabled in tests in ember-cli 3.4+

After updating to ember-cli 3.4 via ember-cli-update, ember tests crash on run. The only notable error that I see is: Uncaught TypeError: Cannot read property 'afterTests' of undefined. I’m able to install the other updated dependencies in package.json (ember-source, ember-data, etc.), but when I also update ember-cli I get this crash. I’m unsure how I would go about creating a minimal reproduction for this issue.

These are the dependencies in my package.json:

  "devDependencies": {
    "@ember/jquery": "^0.5.2",
    "@ember/optional-features": "^0.7.0",
    "@opentok/client": "^2.14.8",
    "autosize": "^4.0.0",
    "bootstrap-sass": "^3.3.7",
    "bowser": "^1.9.4",
    "broccoli-asset-rev": "^3.0.0",
    "dotenv-flow": "^0.1.0-beta.1",
    "ember-ajax": "^3.1.1",
    "ember-auto-import": "^1.2.13",
    "ember-awesome-macros": "^3.0.0",
    "ember-bootstrap": "^2.0.0",
    "ember-chrome-devtools": "^0.2.0",
    "ember-cli": "~3.4.3",
    "ember-cli-app-version": "^3.2.0",
    "ember-cli-autoprefixer": "^0.8.1",
    "ember-cli-babel": "^7.1.2",
    "ember-cli-code-coverage": "1.0.0-beta.3",
    "ember-cli-dependency-checker": "^3.0.0",
    "ember-cli-deprecation-workflow": "^1.0.0",
    "ember-cli-eslint": "^4.2.3",
    "ember-cli-htmlbars": "^3.0.0",
    "ember-cli-htmlbars-inline-precompile": "^1.0.3",
    "ember-cli-inject-live-reload": "^1.8.2",
    "ember-cli-moment-shim": "^3.7.1",
    "ember-cli-qunit": "^4.3.2",
    "ember-cli-rails-addon": "^0.10.0",
    "ember-cli-sass": "^8.0.1",
    "ember-cli-sentry": "^3.0.0",
    "ember-cli-shims": "^1.2.0",
    "ember-cli-sri": "^2.1.1",
    "ember-cli-string-helpers": "^1.9.0",
    "ember-cli-stylelint": "^2.2.0",
    "ember-cli-template-lint": "^1.0.0-beta.1",
    "ember-cli-uglify": "^2.1.0",
    "ember-cli-update": "^0.27.0",
    "ember-component-css": "^0.6.5",
    "ember-composable-helpers": "^2.0.3",
    "ember-concurrency": "^0.8.21",
    "ember-data": "^3.4.2",
    "ember-data-factory-guy": "^3.4.0",
    "ember-export-application-global": "^2.0.0",
    "ember-faker": "^1.3.0",
    "ember-feature-flags": "^5.0.0",
    "ember-font-awesome": "^4.0.0-rc.4",
    "ember-freestyle": "^0.9.0",
    "ember-infinity": "1.0.0-beta.2",
    "ember-inflector": "^3.0.0",
    "ember-intercom-api": "^0.3.2",
    "ember-linkify": "^4.0.0",
    "ember-load-initializers": "^1.1.0",
    "ember-math-helpers": "^2.7.0",
    "ember-maybe-import-regenerator": "^0.1.6",
    "ember-metrics": "^0.12.1",
    "ember-moment": "^7.8.0",
    "ember-notify": "^5.1.0",
    "ember-percy": "1.5.0",
    "ember-prop-types": "^8.0.0",
    "ember-qunit-nice-errors": "^1.1.2",
    "ember-radio-button": "^1.2.4",
    "ember-resolver": "^5.0.1",
    "ember-responsive": "^3.0.0-beta.3",
    "ember-route-action-helper": "^2.0.6",
    "ember-simple-auth": "^1.7.0",
    "ember-source": "~3.4.0",
    "ember-svg-jar": "^1.2.2",
    "ember-test-selectors": "^1.0.0",
    "ember-truth-helpers": "^2.1.0",
    "ember-uploader": "^2.0.0",
    "ember-watson": "^0.9.1",
    "ember-web-app": "^2.1.0",
    "ember-web-app-rename": "^1.0.0",
    "emberx-file-input": "^1.1.2",
    "eslint-plugin-ember": "^5.2.0",
    "eslint-plugin-ember-best-practices": "^1.1.1",
    "fullcalendar": "^3.9.0",
    "glob": "^7.1.3",
    "liquid-fire": "^0.29.5",
    "loader.js": "^4.7.0",
    "lottie-web": "^5.3.3",
    "morgan": "^1.9.1",
    "pubnub": "^4.21.5",
    "qunit-dom": "^0.8.0",
    "rails-timezone": "^1.0.0",
    "sass": "^1.14.1",
    "uuid": "^3.3.2"
  },

Output from ember version --verbose && npm --version && yarn --version:

ember-cli: 3.4.3
http_parser: 2.8.0
node: 8.11.1
v8: 6.2.414.50
uv: 1.19.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.25.0
openssl: 1.0.2o
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c
os: darwin x64
6.0.1
1.10.1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Holy 🐄. I would haver never figured out that fingerprinting was to blame. 😂

In case you need fingerprinting to happen in dev / test mode, you can exclude testem.js. Here’s our config:

    fingerprint: {
      enabled: true,
      generateAssetMap: true,
      prepend,
      exclude: ['testem.js'],
      replaceExtensions: ['html', 'css', 'js', 'ts', 'scss'],
      extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg', 'ico', 'ttf', 'woff'],
      // there is a bug in broccoli-asset-rewrite forcing us to append a hash
      customHash: isProductionLike ? undefined : () => 'dev'
    },

I’ve been seeing similar timeouts when running ember test in Ember CLI 3.5.0.

All tests in localhost:4200/tests are passing though…

I can confirm that when this project was still on Ember CLI 3.1.3 the timeouts did not occur.

For minimal reproduction I did:

ember new foo --yarn
cd foo/
ember test
[passes]

All tests pass in fresh install. 💪

That implies it must be something specific to my project. I’ve then started adding my packages and configs one by one to the fresh install until tests would start timing out. I found this:

// ember-cli-build.js

fingerprint: {
  enabled: true,
  extensions: ['js', 'css']
}

This times out ember test. 🔥

ember test
Visit https://ember-cli.com/user-guide/#watchman for more info.
Environment: test
cleaning up...
Built project successfully. Stored in "/Users/jw/Code/foo/tmp/class-tests_dist-F8nepXHD.tmp".
not ok 1 Chrome - [undefined ms] - error
    ---
        message: >
            Error: Browser failed to connect within 30s. testem.js not loaded?
            Stderr:
             [1020/175120.476382:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/__/r9ghy9cn0j95ny3q_f604dsr0000gn/T/: Operation not permitted (1)
            [1020/175120.477585:ERROR:file_io.cc(89)] ReadExactly: expected 8, observed 0
            [1020/175120.478440:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/__/r9ghy9cn0j95ny3q_f604dsr0000gn/T/: Operation not permitted (1)
            [1020/175120.511147:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.

            DevTools listening on ws://127.0.0.1:53980/devtools/browser/b98846a1-64ea-4fa7-9414-c570455ea6fa
            [1020/175120.834934:INFO:CONSOLE(12521)] "DEBUG: -------------------------------", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)
            [1020/175120.835000:INFO:CONSOLE(12521)] "DEBUG: Ember      : 3.5.0", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)
            [1020/175120.835036:INFO:CONSOLE(12521)] "DEBUG: Ember Data : 3.5.0", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)
            [1020/175120.835069:INFO:CONSOLE(12521)] "DEBUG: jQuery     : 3.3.1", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)
            [1020/175120.835102:INFO:CONSOLE(12521)] "DEBUG: -------------------------------", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)


        Log: |
            { type: 'error',
              text: 'Error: Browser failed to connect within 30s. testem.js not loaded?' }
            { type: 'error',
              text: '[1020/175120.476382:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/__/r9ghy9cn0j95ny3q_f604dsr0000gn/T/: Operation not permitted (1)\n[1020/175120.477585:ERROR:file_io.cc(89)] ReadExactly: expected 8, observed 0\n[1020/175120.478440:ERROR:xattr.cc(64)] setxattr org.chromium.crashpad.database.initialized on file /var/folders/__/r9ghy9cn0j95ny3q_f604dsr0000gn/T/: Operation not permitted (1)\n[1020/175120.511147:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.\n\nDevTools listening on ws://127.0.0.1:53980/devtools/browser/b98846a1-64ea-4fa7-9414-c570455ea6fa\n[1020/175120.834934:INFO:CONSOLE(12521)] "DEBUG: -------------------------------", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)\n[1020/175120.835000:INFO:CONSOLE(12521)] "DEBUG: Ember      : 3.5.0", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)\n[1020/175120.835036:INFO:CONSOLE(12521)] "DEBUG: Ember Data : 3.5.0", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)\n[1020/175120.835069:INFO:CONSOLE(12521)] "DEBUG: jQuery     : 3.3.1", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)\n[1020/175120.835102:INFO:CONSOLE(12521)] "DEBUG: -------------------------------", source: http://localhost:7357/assets/vendor-055193532090a78f333a5245953abf2b.js (12521)\n' }
    ...

1..1
# tests 1
# pass  0
# skip  0
# fail  1

So what I’ve done is:

const isProduction = EmberApp.env() === 'production';

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    fingerprint: {
      enabled: isProduction,
      extensions: ['js', 'css']
    },
    ...

And now ember test works again. :godmode:

I hope this is helpful for your project.

I set it to env != test, so we’d still have fingerprinting in dev.

@janwerkhoven That workaround totally solves the issue for me. I would have never guessed it was the finger printing, thanks for sharing!