Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing harness that replicates FastBoot environment. #19123

Closed
wants to merge 1 commit into from

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 2, 2020

Prior to this we were simulating FastBoot in a non-isolated VM context. That meant that the running Node context was available within rendering attempts. However, when ran with "real" FastBoot that is not the case. In the real FastBoot environment, we create an isolated vm context and evaluate both Ember and the application within that context. This ensures that the running context does not have access to arbitrary Node-land APIs (e.g. require).

This replicates the failure that is reported in glimmerjs/glimmer-vm#1141:

  message: "beforeEach failed on FastBoot: basic: Cannot read property 'require' of null"
  severity: failed
  actual: null
  expected: undefined
  stack: /Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:46731
    var nodeURL = _nodeModule.module.require('url');
                                     ^

TypeError: Cannot read property 'require' of null
    at /Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:46731:38
    at internalRequire (/Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:64:14)
    at internalRequire (/Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:60:22)
    at internalRequire (/Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:60:22)
    at internalRequire (/Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:60:22)
    at require (/Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:97:14)
    at /Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:64647:1
    at /Users/rjackson/src/emberjs/ember.js/dist/tests/ember.js:64648:2
    at Script.runInContext (vm.js:142:18)
    at buildSandboxContext (/Users/rjackson/src/emberjs/ember.js/tests/node/fastboot-sandbox-test.js:86:15)

Prior to this we were simulating FastBoot in a non-isolated VM context.
That meant that the running Node context was available within rendering
attempts. However, when ran with "real" FastBoot that is **not** the
case. In the real FastBoot environment, we create an isolated `vm`
context and evaluate both Ember and the application within that context.
This ensures that the running context does not have access to arbitrary
Node-land APIs (e.g. `require`).
@rwjblue rwjblue deleted the replicate-fastboot-failure branch February 10, 2021 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant