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

[WIP] add jest transform #555

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@therealparmesh
Copy link

@therealparmesh therealparmesh commented Jan 30, 2020

This addresses #554.

NOTE: This needs feedback as it contains structural changes to the project.

Add something like this to your package.json (or wherever your Jest configuration is):

"jest": {
  "transform": {
    ".js": "microbundle/dist/microbundle-jest"
  }
}
"build:babel": "babel-node src/cli.js --target=node --format cjs src/{cli,index}.js",
"build:self": "node dist/cli.js --target=node --format cjs src/{cli,index}.js",
"build:babel": "babel-node src/cli.js --target=node --format cjs src/{cli,index,babel-custom,microbundle-jest}.js",
"build:self": "node dist/cli.js --target=node --format cjs src/{cli,index,babel-custom,microbundle-jest}.js",

This comment has been minimized.

@therealparmesh

therealparmesh Jan 30, 2020
Author

I had to move babel-custom.js up a level from lib because lib is not created in dist. This works, but I could use some advice as to what is proper here. I’m think this may be related: #260 (comment)

@@ -66,6 +66,7 @@
"@rollup/plugin-node-resolve": "^6.1.0",
"asyncro": "^3.0.0",
"autoprefixer": "^9.7.3",
"babel-jest": "^24.8.0",

This comment has been minimized.

@therealparmesh

therealparmesh Jan 30, 2020
Author

I moved this to dependencies because it is a dependency of code that the package exports (microbundle-jest.js).

});
};

export const config = (config, { customOptions }) => {

This comment has been minimized.

@therealparmesh

therealparmesh Jan 30, 2020
Author

I moved this file and touched a large number of lines, so GitHub will not diff this correctly. Most of the lines touched have to do this this change, where I lifted config and made it exportable.

},
preset.options,
{
modules: customOptions.jest ? 'auto' : false,

This comment has been minimized.

@therealparmesh

therealparmesh Jan 30, 2020
Author

I added the jest flag here. I was not sure if I should reuse the modern flag here.

targets: customOptions.modern
? ESMODULES_TARGET
: customOptions.targets,
modules: customOptions.jest ? 'auto' : false,

This comment has been minimized.

@therealparmesh

therealparmesh Jan 30, 2020
Author

See my above comment.

@dakshshah96
Copy link

@dakshshah96 dakshshah96 commented Apr 2, 2020

@developit / @ForsakenHarmony: would love to see this land!

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.