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

How it should work with unit-tests? #424

Open
ArtemEkzarho opened this issue Jul 6, 2018 · 2 comments
Open

How it should work with unit-tests? #424

ArtemEkzarho opened this issue Jul 6, 2018 · 2 comments

Comments

@ArtemEkzarho
Copy link

https://github.com/ArtemEkzarho/setup_angular_lazyload_karma

Tests isn't running with lazy loaded module.

Can you help me?) Or all of this is no longer relevant?

@dulcetti
Copy link

dulcetti commented Oct 3, 2018

@ArtemEkzarho Hi.

I put the follow code inside require.ensure:

if (process.env.NODE_ENV == 'test') {
    import('./foo.module');
} else {
    require('./foo.module');
}

And inside webpack.config.karma.js I put:

plugins: [
    new webpack.DefinePlugin({
        'process.env': { NODE_ENV: JSON.stringify('test') }
    })
]

It's not good, but it was the way I got it =P

@ArtemEkzarho
Copy link
Author

Problem in two different .configs).
All want to build the application in one bundle, for tests and for production. This bundle will first be tested, and then deployed to env.

My solution does not solve the problem

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

No branches or pull requests

2 participants