Skip to content

test(load): use installModules instead of npm install #2431

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

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion @commitlint/load/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"@commitlint/test": "^12.0.0",
"@commitlint/utils": "^12.0.0",
"@types/lodash": "4.14.168",
"execa": "^5.0.0"
"execa": "^5.0.0",
"conventional-changelog-atom": "^2.0.8"
},
"dependencies": {
"@commitlint/execute-rule": "^12.0.0",
Expand Down
10 changes: 4 additions & 6 deletions @commitlint/load/src/load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ jest.mock('@scope/commitlint-plugin-example', () => scopedPlugin, {
});

import path from 'path';
import execa from 'execa';
import resolveFrom from 'resolve-from';
import {fix, git, npm} from '@commitlint/test';

Expand Down Expand Up @@ -411,10 +410,9 @@ test('recursive resolves parser preset from conventional atom', async () => {
const cwd = await gitBootstrap(
'fixtures/recursive-parser-preset-conventional-atom'
);
// the package file is nested in 2 folders, `npm.bootstrap` cant do that
await execa('npm', ['install'], {
cwd: path.resolve(cwd, 'first-extended', 'second-extended'),
});
await npm.installModules(
path.resolve(cwd, 'first-extended', 'second-extended')
);

const actual = await load({}, {cwd});

Expand All @@ -423,7 +421,7 @@ test('recursive resolves parser preset from conventional atom', async () => {
expect((actual.parserPreset.parserOpts as any).headerPattern).toEqual(
/^(:.*?:) (.*)$/
);
}, 10000);
});

test('resolves parser preset from conventional commits without factory support', async () => {
const cwd = await npmBootstrap(
Expand Down
7 changes: 5 additions & 2 deletions @packages/test/src/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import resolvePkg from 'resolve-pkg';

import * as git from './git';

export async function bootstrap(fixture: string, directory?: string) {
const cwd = await git.bootstrap(fixture, directory);
export async function installModules(cwd: string) {
const manifestPath = path.join(cwd, 'package.json');
const targetModulesPath = path.join(cwd, 'node_modules');

Expand Down Expand Up @@ -36,7 +35,11 @@ export async function bootstrap(fixture: string, directory?: string) {
})
);
}
}

export async function bootstrap(fixture: string, directory?: string) {
const cwd = await git.bootstrap(fixture, directory);
await installModules(cwd);
return cwd;
}

Expand Down
19 changes: 5 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3439,28 +3439,19 @@ contains-path@^0.1.0:
resolved "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a"
integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=

[email protected]:
[email protected], conventional-changelog-angular@^5.0.11, conventional-changelog-angular@^5.0.3:
version "5.0.12"
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.12.tgz#c979b8b921cbfe26402eb3da5bbfda02d865a2b9"
integrity sha512-5GLsbnkR/7A89RyHLvvoExbiGbd9xKdKqDTrArnPbOqBqG/2wIosu0fHwpeIRI8Tl94MhVNBXcLJZl92ZQ5USw==
dependencies:
compare-func "^2.0.0"
q "^1.5.1"

conventional-changelog-angular@^5.0.11:
version "5.0.11"
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.11.tgz#99a3ca16e4a5305e0c2c2fae3ef74fd7631fc3fb"
integrity sha512-nSLypht/1yEflhuTogC03i7DX7sOrXGsRn14g131Potqi6cbGbGEE9PSDEHKldabB6N76HiSyw9Ph+kLmC04Qw==
conventional-changelog-atom@^2.0.8:
version "2.0.8"
resolved "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-2.0.8.tgz#a759ec61c22d1c1196925fca88fe3ae89fd7d8de"
integrity sha512-xo6v46icsFTK3bb7dY/8m2qvc8sZemRgdqLb/bjpBsH2UyOS8rKNTgcb5025Hri6IpANPApbXMg15QLb1LJpBw==
dependencies:
compare-func "^2.0.0"
q "^1.5.1"

conventional-changelog-angular@^5.0.3:
version "5.0.6"
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.6.tgz#269540c624553aded809c29a3508fdc2b544c059"
integrity sha512-QDEmLa+7qdhVIv8sFZfVxU1VSyVvnXPsxq8Vam49mKUcO1Z8VTLEJk9uI21uiJUsnmm0I4Hrsdc9TgkOQo9WSA==
dependencies:
compare-func "^1.3.1"
q "^1.5.1"

conventional-changelog-conventionalcommits@^4.3.1:
Expand Down