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

support aliases with serverless-bundle test #115

Merged
merged 5 commits into from Jul 19, 2020
Merged

support aliases with serverless-bundle test #115

merged 5 commits into from Jul 19, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jul 18, 2020

#104 Currently, aliases defined in the serverless.yml file are not taken into account when running 'serverless-bundle test'.

I mentionned two possible solutions.

I went for option 2 (as it was faster to add)

and added moduleNameMapper to the list of acceptedKeys in the createJestConfig.js file.

If this is something you are likely to consider, let me now and I will also update the README.md.

test

I didn't write any automated tests as it looks like npm run test-scripts has been removed from the .travis.yml file.

But I created a repo you can git clone to see serverless-bundle test run with aliases. (checkout the README.md)

PS

I also updated the README.md file to reflect the changes regarding "npm run test-scripts".

@ghost ghost mentioned this pull request Jul 18, 2020
@@ -45,7 +45,8 @@ module.exports = (resolve, rootDir) => {
"testResultsProcessor",
"transform",
"transformIgnorePatterns",
"watchPathIgnorePatterns"
"watchPathIgnorePatterns",
"moduleNameMapper"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will allow us to add our aliases to our package.json in a format jest understands (regex)

"jest": {
    "moduleNameMapper": {
      "libs(.*)$": "<rootDir>/libs/$1"
    }
  }

@jayair
Copy link
Member

jayair commented Jul 19, 2020

Thanks for this!

Yeah we changed the test command. It should be npm run test scripts instead of npm run test-scripts.

I added the test case and updated the docs. Merging.

@jayair jayair merged commit fd4945a into AnomalyInnovations:master Jul 19, 2020
@jayair
Copy link
Member

jayair commented Jul 19, 2020

Published a new release:

https://github.com/AnomalyInnovations/serverless-bundle/releases/tag/v1.9.1

Thanks again!

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

Successfully merging this pull request may close these issues.

1 participant