Skip to content

Commit c463d89

Browse files
authored
fix(command): Build before integrate (#53)
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.
1 parent e7a3095 commit c463d89

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

docs/api/integrate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The integration tests generally are run in your continuous integration (CI) envi
88

99
The integration test process is as follows:
1010

11-
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
11+
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
1212
1. Copy the integration tests "project" at `integration-tests/` over to a temporary directory
1313
1. `npm install` the packed library (from Step 1), `@benmvp/cli`, and any other dependencies specified in the `package.json` of the project
1414
1. Run `npx benmvp test` on the project to use `@benmvp/cli` to run the tests

docs/cli/integrate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The integration tests generally are run in your continuous integration (CI) envi
88

99
The integration test process is as follows:
1010

11-
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
11+
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
1212
1. Copy the integration tests "project" at `integration-tests/` over to a temporary directory
1313
1. `npm install` the packed library (from Step 1), `@benmvp/cli`, and any other dependencies specified in the `package.json` of the project
1414
1. Run `npx benmvp test` on the project to use `@benmvp/cli` to run the tests

src/commands/integrate/run.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ echo -e "Created temp integration path: $TEMP_INTEGRATION_PATH\n"
99

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

12+
# build library before packing in order to be able to reference built files
13+
# this step will fail within benmvp-cli repo since the `benmvp` bin doesn't
14+
# exist yet, but that's ok because we always `build` before `integrate`
15+
echo -e "npx benmvp build\n"
16+
npx benmvp build
17+
1218
# npm pack to tarball library into integration directory
1319
echo -e "npm pack && mv *.tgz $TARBALL_FILE_PATH\n"
1420
npm pack && mv *.tgz $TARBALL_FILE_PATH
@@ -40,7 +46,7 @@ if [ ! -d "$TEMP_INTEGRATION_PATH/node_modules" ]; then
4046
exit 1
4147
fi
4248

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

0 commit comments

Comments
 (0)