-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Preinstall for either npm or yarn.
Closes #15
- Loading branch information
1 parent
68bc9c4
commit afaf196
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { execSync } from "child_process"; | ||
import TestUtils from "./test/util"; | ||
import preinstall from "./preinstall"; | ||
|
||
const packageName = '@joberstein12/commitlint-config'; | ||
|
||
describe("src/preinstall", () => { | ||
const { | ||
createTempDirectory, | ||
teardownTestDirectory, | ||
options, | ||
} = new TestUtils(); | ||
|
||
beforeEach(() => { | ||
options.cwd = createTempDirectory(); | ||
process.chdir(options.cwd); | ||
}); | ||
|
||
afterEach(() => { | ||
teardownTestDirectory(options.cwd as string); | ||
}); | ||
|
||
it("Installs for an npm app", () => { | ||
execSync('npm init -y && npm install', options); | ||
|
||
preinstall(packageName, options); | ||
|
||
const isInstalled = execSync(`npm list ${packageName} | grep ${packageName}`) | ||
.toString() | ||
.trim(); | ||
|
||
expect(isInstalled).toBeTruthy(); | ||
}); | ||
|
||
it("Installs for a yarn app", () => { | ||
execSync('yarn init -y && yarn install', options); | ||
|
||
preinstall(packageName, options); | ||
|
||
const isInstalled = execSync(`yarn list --pattern ${packageName} | grep ${packageName}`) | ||
.toString() | ||
.trim(); | ||
|
||
expect(isInstalled).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters