Skip to content

Commit

Permalink
fix(command): Build before integrate (#53)
Browse files Browse the repository at this point in the history
We need to `build` the library before calling `npm pack` to ensure it has the latest built assets, which will then be used by the integration tests project.

Didn't catch this case when running the integration tests for @benmvp/cli itself because we always `build` before running all of the scripts.
  • Loading branch information
benmvp authored Jun 28, 2019
1 parent e7a3095 commit c463d89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/api/integrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The integration tests generally are run in your continuous integration (CI) envi

The integration test process is as follows:

1. [`npm pack`](https://docs.npmjs.com/cli/pack.html) the library to create the _same_ `.tgz` tarball that would be published in the registry
1. [`npm pack`](https://docs.npmjs.com/cli/pack.html) the built library to create the _same_ `.tgz` tarball that would be published in the registry
1. Copy the integration tests "project" at `integration-tests/` over to a temporary directory
1. `npm install` the packed library (from Step 1), `@benmvp/cli`, and any other dependencies specified in the `package.json` of the project
1. Run `npx benmvp test` on the project to use `@benmvp/cli` to run the tests
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/integrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The integration tests generally are run in your continuous integration (CI) envi

The integration test process is as follows:

1. [`npm pack`](https://docs.npmjs.com/cli/pack.html) the library to create the _same_ `.tgz` tarball that would be published in the registry
1. [`npm pack`](https://docs.npmjs.com/cli/pack.html) the built library to create the _same_ `.tgz` tarball that would be published in the registry
1. Copy the integration tests "project" at `integration-tests/` over to a temporary directory
1. `npm install` the packed library (from Step 1), `@benmvp/cli`, and any other dependencies specified in the `package.json` of the project
1. Run `npx benmvp test` on the project to use `@benmvp/cli` to run the tests
Expand Down
8 changes: 7 additions & 1 deletion src/commands/integrate/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ echo -e "Created temp integration path: $TEMP_INTEGRATION_PATH\n"

TARBALL_FILE_PATH="$TEMP_INTEGRATION_PATH/test-package.tgz"

# build library before packing in order to be able to reference built files
# this step will fail within benmvp-cli repo since the `benmvp` bin doesn't
# exist yet, but that's ok because we always `build` before `integrate`
echo -e "npx benmvp build\n"
npx benmvp build

# npm pack to tarball library into integration directory
echo -e "npm pack && mv *.tgz $TARBALL_FILE_PATH\n"
npm pack && mv *.tgz $TARBALL_FILE_PATH
Expand Down Expand Up @@ -40,7 +46,7 @@ if [ ! -d "$TEMP_INTEGRATION_PATH/node_modules" ]; then
exit 1
fi

# Run `npx benmvp test` in $tempIntegration to use @benmvp/cli
# Run `npx benmvp test` in $TEMP_INTEGRATION_PATH to use @benmvp/cli
# to run the integration tests
# NOTE: For integration test *for* @benmvp/cli this will use the .tgz version
# that would've been added above
Expand Down

0 comments on commit c463d89

Please sign in to comment.