Skip to content

Commit 8ee0e9e

Browse files
authored
test(load): use installModules instead of npm install (conventional-changelog#2431)
expose helper function installModules to ease test time and timeouts on windows machines npm/npm#21148
1 parent 5dc132f commit 8ee0e9e

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

@commitlint/load/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"@commitlint/test": "^12.0.0",
3838
"@commitlint/utils": "^12.0.0",
3939
"@types/lodash": "4.14.168",
40-
"execa": "^5.0.0"
40+
"execa": "^5.0.0",
41+
"conventional-changelog-atom": "^2.0.8"
4142
},
4243
"dependencies": {
4344
"@commitlint/execute-rule": "^12.0.0",

@commitlint/load/src/load.test.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ jest.mock('@scope/commitlint-plugin-example', () => scopedPlugin, {
77
});
88

99
import path from 'path';
10-
import execa from 'execa';
1110
import resolveFrom from 'resolve-from';
1211
import {fix, git, npm} from '@commitlint/test';
1312

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

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

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

428426
test('resolves parser preset from conventional commits without factory support', async () => {
429427
const cwd = await npmBootstrap(

@packages/test/src/npm.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import resolvePkg from 'resolve-pkg';
44

55
import * as git from './git';
66

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

@@ -36,7 +35,11 @@ export async function bootstrap(fixture: string, directory?: string) {
3635
})
3736
);
3837
}
38+
}
3939

40+
export async function bootstrap(fixture: string, directory?: string) {
41+
const cwd = await git.bootstrap(fixture, directory);
42+
await installModules(cwd);
4043
return cwd;
4144
}
4245

yarn.lock

+5-14
Original file line numberDiff line numberDiff line change
@@ -3439,28 +3439,19 @@ contains-path@^0.1.0:
34393439
resolved "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a"
34403440
integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=
34413441

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

3450-
conventional-changelog-angular@^5.0.11:
3451-
version "5.0.11"
3452-
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.11.tgz#99a3ca16e4a5305e0c2c2fae3ef74fd7631fc3fb"
3453-
integrity sha512-nSLypht/1yEflhuTogC03i7DX7sOrXGsRn14g131Potqi6cbGbGEE9PSDEHKldabB6N76HiSyw9Ph+kLmC04Qw==
3450+
conventional-changelog-atom@^2.0.8:
3451+
version "2.0.8"
3452+
resolved "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-2.0.8.tgz#a759ec61c22d1c1196925fca88fe3ae89fd7d8de"
3453+
integrity sha512-xo6v46icsFTK3bb7dY/8m2qvc8sZemRgdqLb/bjpBsH2UyOS8rKNTgcb5025Hri6IpANPApbXMg15QLb1LJpBw==
34543454
dependencies:
3455-
compare-func "^2.0.0"
3456-
q "^1.5.1"
3457-
3458-
conventional-changelog-angular@^5.0.3:
3459-
version "5.0.6"
3460-
resolved "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.6.tgz#269540c624553aded809c29a3508fdc2b544c059"
3461-
integrity sha512-QDEmLa+7qdhVIv8sFZfVxU1VSyVvnXPsxq8Vam49mKUcO1Z8VTLEJk9uI21uiJUsnmm0I4Hrsdc9TgkOQo9WSA==
3462-
dependencies:
3463-
compare-func "^1.3.1"
34643455
q "^1.5.1"
34653456

34663457
conventional-changelog-conventionalcommits@^4.3.1:

0 commit comments

Comments
 (0)