Skip to content
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

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

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion @commitlint/config-lerna-scopes/fixtures/basic/package.json
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
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.

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
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
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
@@ -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
@@ -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.