Skip to content
New issue

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

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

Already on GitHub? # to your account

Enable embroider-optimized scenario #92

Open
fsmanuel opened this issue Sep 21, 2022 · 1 comment
Open

Enable embroider-optimized scenario #92

fsmanuel opened this issue Sep 21, 2022 · 1 comment

Comments

@fsmanuel
Copy link
Collaborator

The embroider-optimized scenario tests fail with the following errors:

 not ok 6 Chrome 105.0 - [15 ms] - Unit | Validators | messages: it exists
    ---
        expected: >
            true
        stack: >
                at Object.eval (webpack://dummy/./tests/unit/validators/messages-test.js?:14:12)
        message: >
            failed, expected argument to be truthy, was: undefined
        negative: >
            false
        browser log: |
    ...
not ok 7 Chrome 105.0 - [35 ms] - Unit | Validators | messages: suppressWarnings set to true
    ---
        actual: >
            null
        stack: >
            TypeError: Cannot read properties of undefined (reading 'getMessageFor')
                at Object.eval (webpack://dummy/./tests/unit/validators/messages-test.js?:25:14)
        message: >
            Died on test #1: Cannot read properties of undefined (reading 'getMessageFor')
                at Object.eval (webpack://dummy/./tests/unit/validators/messages-test.js?:16:46)
        negative: >
            false
        browser log: |
    ...
not ok 8 Chrome 105.0 - [18 ms] - Unit | Validators | messages: suppressWarnings unset
    ---
        actual: >
            null
        stack: >
            TypeError: Cannot read properties of undefined (reading 'getMessageFor')
                at Object.eval (webpack://dummy/./tests/unit/validators/messages-test.js?:32:14)
        message: >
            Died on test #1: Cannot read properties of undefined (reading 'getMessageFor')
                at Object.eval (webpack://dummy/./tests/unit/validators/messages-test.js?:28:46)
        negative: >
            false
        browser log: |
    ...

Seems like instance is undefined inembroider-optimized scenario.

const specifier = '@ember-intl/cp-validations@validator:messages';
const instance = this.owner.lookup(specifier);
instance.getMessageFor('foobarbaz');
@fsmanuel
Copy link
Collaborator Author

From the discussion #90 (comment)

function embroiderOptimized(extension) {
    return extendScenario({
        name: 'embroider-optimized',
        npm: {
            devDependencies: {
                '@embroider/core': currentEmbroiderVersion,
                '@embroider/webpack': currentEmbroiderVersion,
                '@embroider/compat': currentEmbroiderVersion,
                // Webpack is a peer dependency of `@embroider/webpack`
                webpack: '^5.0.0',
            },
        },
        env: {
            EMBROIDER_TEST_SETUP_OPTIONS: 'optimized',
        },
    }, extension);
}

I think ember-auto-import v2 is present via @embroider/util which has "ember-auto-import": "^2.2.0", as a dependency. Also the embroider-safe scenario works which has the same devDependencies as embroiderOptimized from above.

$ npm ls @embroider/util
@ember-intl/cp-validations@5.0.0 /Users/manuel/Code/opensource/cp-validations
└─┬ @ember/test-helpers@2.8.1
  └── @embroider/util@1.8.3

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant