Skip to content

Commit

Permalink
test(config-lerna-scopes): reuse npm bootstrap to simplify tests (#2479)
Browse files Browse the repository at this point in the history
* chore: update dependency @lerna/project to v4 (#2447)

* chore: update dependency @lerna/project to v4

* feat!: update to lerna v4

BREAKING CHANGE: upgrade to lerna v4

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: escapedcat <github@htmlcss.de>

* test(config-lerna-scopes): reuse npm bootstrap to simplify tests

* test(config-lerna-scopes): reuse npm bootstrap to simplify tests

* test: fix issue after merge

* test: one more fix after merge

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: escapedcat <github@htmlcss.de>
  • Loading branch information
4 people authored Nov 14, 2021
1 parent b0776ad commit 9a7a43a
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 53 deletions.
3 changes: 2 additions & 1 deletion @commitlint/config-lerna-scopes/fixtures/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "basic",
"version": "1.0.0",
"devDependencies": {
"lerna": "^4.0.0"
"lerna": "^4.0.0",
"@lerna/project": "^4.0.0"
}
}
3 changes: 2 additions & 1 deletion @commitlint/config-lerna-scopes/fixtures/empty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "empty",
"version": "1.0.0",
"devDependencies": {
"lerna": "^4.0.0"
"lerna": "^4.0.0",
"@lerna/project": "^4.0.0"
}
}
5 changes: 0 additions & 5 deletions @commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "basic",
"version": "1.0.0",
"devDependencies": {
"lerna": "^4.0.0"
"lerna": "^4.0.0",
"@lerna/project": "^4.0.0"
}
}
3 changes: 2 additions & 1 deletion @commitlint/config-lerna-scopes/fixtures/scoped/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "scoped",
"version": "1.0.0",
"devDependencies": {
"lerna": "^4.0.0"
"lerna": "^4.0.0",
"@lerna/project": "^4.0.0"
}
}
3 changes: 2 additions & 1 deletion @commitlint/config-lerna-scopes/fixtures/yarn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "yarn",
"version": "1.0.0",
"devDependencies": {
"lerna": "^4.0.0"
"lerna": "^4.0.0",
"@lerna/project": "^4.0.0"
},
"workspaces": [
"@packages/*"
Expand Down
10 changes: 5 additions & 5 deletions @commitlint/config-lerna-scopes/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Path from 'path';
import {lerna} from '@commitlint/test';
import {npm} from '@commitlint/test';
import config from '.';

test('exports rules key', () => {
Expand Down Expand Up @@ -47,30 +47,30 @@ test('scope-enum has expected modifier', async () => {

test('returns empty value for empty lerna repository', async () => {
const {'scope-enum': fn} = config.rules;
const cwd = await lerna.bootstrap('empty', __dirname);
const cwd = await npm.bootstrap('fixtures/empty', __dirname);
const [, , value] = await fn({cwd});
expect(value).toEqual([]);
});

test('returns expected value for basic lerna repository', async () => {
const {'scope-enum': fn} = config.rules;
const cwd = await lerna.bootstrap('basic', __dirname);
const cwd = await npm.bootstrap('fixtures/basic', __dirname);

const [, , value] = await fn({cwd});
expect(value).toEqual(['a', 'b']);
});

test('returns expected value for lerna repository containing modules', async () => {
const {'scope-enum': fn} = config.rules;
const cwd = await lerna.bootstrap('modules', __dirname);
const cwd = await npm.bootstrap('fixtures/modules', __dirname);

const [, , value] = await fn({cwd});
expect(value).toEqual(['a']);
});

test('returns expected value for scoped lerna repository', async () => {
const {'scope-enum': fn} = config.rules;
const cwd = await lerna.bootstrap('scoped', __dirname);
const cwd = await npm.bootstrap('fixtures/scoped', __dirname);

const [, , value] = await fn({cwd});
expect(value).toEqual(['a', 'b']);
Expand Down
3 changes: 1 addition & 2 deletions @packages/test/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fix from './fix';
import * as git from './git';
import * as lerna from './lerna';
import * as npm from './npm';

export {fix, git, lerna, npm};
export {fix, git, npm};
21 changes: 0 additions & 21 deletions @packages/test/src/lerna.ts

This file was deleted.

0 comments on commit 9a7a43a

Please sign in to comment.