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 do I configure tests to run in babel stage=0 #165

Closed
yakirn opened this issue Nov 13, 2015 · 8 comments
Closed

How do I configure tests to run in babel stage=0 #165

yakirn opened this issue Nov 13, 2015 · 8 comments

Comments

@yakirn
Copy link

yakirn commented Nov 13, 2015

I've modified cfg/dev.js to support stage 0 features of babel:

config.module.loaders.push({
  test: /\.(js|jsx)$/,
  loader: 'react-hot!babel-loader?stage=0',
  include: path.join(__dirname, '/../src')
});

then I added a stage 0 feature such as class properties to src/components.Main.js

myProp=42;
render(){
...
}

https://github.com/jeffmo/es-class-static-properties-and-fields

hit npm start, and everything works fine.

I've noticed cfg/test.js has two babel loaders (the second is for test coverage?)
I tried to add stage=0 for the first one and for both as a query string, using the two options that are suggested here (query string and query property):
https://github.com/babel/babel-loader/tree/v5.3.2#options

either way, running npm test fails with syntax error where the stage 0 code is.
any idea how to solve this?
Thanks!

@sthzg
Copy link
Member

sthzg commented Nov 13, 2015

@yakirn fwiw,there is a related issue targeting the update from babel 5 to 6 in the repository that features the template used in this generator. not sure if they are related, but it might be interesting either way react-webpack-generators/react-webpack-template/issues/11.

@weblogixx
Copy link
Member

Hi @yakirn,

currently we are still using babel 5, so there may be some stuff that is currently not working.
I currently wait for https://github.com/deepsweet/isparta-loader to update the isparta dependency for coverage reports. If the update is done, it should work as intended.

@yakirn
Copy link
Author

yakirn commented Nov 16, 2015

@weblogixx @sthzg Thank you for your answers.
So, if I understand correctly, isparta-loader is just about code coverage?
if removing isparta or its loader will make my tests work without coverage, it is good enough for me, at least until a real fix/update will be available. can you instruct me on how to do this?
Thanks again

@weblogixx
Copy link
Member

@yakirn,

yes, it should work when you disable the isparta-loading and update to babel 6. I have all parts ready but unfortunately still have to wait for isparta-loader to be updated. If this is not happening in the nearer future, I will have to disable it (or fork the project, the change that needs to be done is just updating the package.json).

@weblogixx
Copy link
Member

@yakirn: The generator was just updated to use babel 6. It should work with the new version without problems. Note: Only newly created projects (after updating the generator) will be build with babel 6.

@yakirn
Copy link
Author

yakirn commented Nov 17, 2015

Ok, I managed to run the tests after I disabled isparta.
@weblogixx fyi, I updated the generator and installed in a new dir, and got this error while trying to run npm test:

ERROR in ./src/components/Main.js
Module build failed: ReferenceError: [BABEL] src/components/Main.js: Unknown option: babelrc.presets
    at Logger.error (node_modules/isparta/node_modules/babel-core/lib/transformation/file/logger.js:58:11)

this time I didn't change anything. it's the pure generator's code. npm start works.
but I guess thats a different issue. should I close this one?

@weblogixx
Copy link
Member

@yakin:
Yes, the new loaders author has choosen to "update" his isparta loader with the old isparta config for versions 0.2.x. So it ran when it was 0.2.2, but no more for 0.2.3 :(. A new version of the template will be available in a couple of minutes, the dependency is fixed then. Just update your generator in about half an hour to make it work correctly.

@weblogixx
Copy link
Member

Think that should be done with the update. Closing this. If there are any other errors, feel free to open a new ticket.

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

3 participants