Skip to content

Commit 555a184

Browse files
authored
fix(command): Install @benmvp/cli w/ integrate (#51)
Integration tests in `url-lib` were failing because a bunch of dependencies were missing. I assumed that I could just run `npx benmvp test` in the integration test to cover everything, but that was only working here because the tarball had those dependencies. Any other repo wouldn't. So now as part of the integrate process, `@benmvp/cli` gets added as a dev dependency to the integration tests project.
1 parent b433d52 commit 555a184

File tree

7 files changed

+12
-15
lines changed

7 files changed

+12
-15
lines changed

docs/api/integrate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ The integration test process is as follows:
1010

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

1616
Looking for CLI docs? View companion [`benmvp integrate` documentation](../cli/integrate.md).
1717

docs/cli/integrate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ The integration test process is as follows:
1010

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

1616
Looking for Node API docs? View companion [`integrate()` documentation](../api/integrate.md).
1717

integration-tests/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
22
"private": true,
3-
"scripts": {
4-
"start": "benmvp start",
5-
"test": "benmvp test",
6-
"build": "benmvp build"
7-
},
83
"devDependencies": {
94
"@types/fs-extra": "^7.0.0",
105
"fs-extra": "^8.0.1",

integration-tests/src/__tests__/build.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jest.setTimeout(30000)
1010

1111
describe('when no arguments are passed', () => {
1212
beforeAll(async () => {
13-
await execAsync('npm run build')
13+
await execAsync('npx benmvp build')
1414
})
1515
afterAll(async () => {
1616
// clean up
@@ -64,7 +64,7 @@ describe('when no arguments are passed', () => {
6464

6565
describe('when format & output directory are specified', () => {
6666
beforeAll(async () => {
67-
await execAsync('npm run build -- --formats esm type --out ./built')
67+
await execAsync('npx benmvp build --formats esm type --out ./built')
6868
})
6969
afterAll(async () => {
7070
// clean up

src/commands/integrate/run.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ cp -r ./integration-tests/* $TEMP_INTEGRATION_PATH
2525

2626
pushd $TEMP_INTEGRATION_PATH
2727

28-
# Add .tgz file as dependency
28+
# Add @benmvp/cli & tarball file as dependencies
2929
# This will also install all missing dependencies from `package-lock.json`
30-
echo -e "npm install && npm install --save-dev $TARBALL_FILE_PATH\n"
30+
# Note for integration tests for @benmvp/cli specifically this *should* overwrite
31+
# @benmvp/cli dependency from registry with the tarball
32+
echo -e "npm install && npm install --save-dev @benmvp/cli $TARBALL_FILE_PATH\n"
3133
npm install && npm install --save-dev $TARBALL_FILE_PATH
3234

3335
# Verify node modules were installed

src/commands/test/project-spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ const [ROOT_DIR] = BASE_CONFIG.roots
55

66
module.exports = {
77
...BASE_CONFIG,
8-
displayName: 'unit',
8+
displayName: 'spec',
99

1010
// test files end in *.spec.ts. The base `testMatch`
1111
// is just looking at *.ts
1212
testMatch: [resolve(ROOT_DIR, 'src/**/*.spec.ts')],
1313

14-
setupFilesAfterEnv: [resolve(__dirname, 'unit-setup.js')],
14+
setupFilesAfterEnv: [resolve(__dirname, 'spec-setup.js')],
1515
}
File renamed without changes.

0 commit comments

Comments
 (0)