Skip to content

test(parse): remove import-from package from tests #967

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
Feb 7, 2020
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
6 changes: 1 addition & 5 deletions @commitlint/lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@
},
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@commitlint/test": "8.2.0",
"@commitlint/utils": "^8.3.4",
"babel-preset-commitlint": "^8.2.0",
"cross-env": "7.0.0"
"@commitlint/utils": "^8.3.4"
},
"dependencies": {
"@commitlint/is-ignored": "^8.3.5",
Expand Down
5 changes: 0 additions & 5 deletions @commitlint/parse/fixtures/parser-preset/commitlint.config.js

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions @commitlint/parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"devDependencies": {
"@commitlint/test": "8.2.0",
"@commitlint/utils": "^8.3.4",
"@types/lodash": "4.14.149",
"import-from": "3.0.0"
"@types/lodash": "4.14.149"
},
"dependencies": {
"conventional-changelog-angular": "^5.0.0",
Expand Down
37 changes: 15 additions & 22 deletions @commitlint/parse/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import importFrom from 'import-from';
import parse from '.';

test('throws when called without params', () => {
Expand Down Expand Up @@ -81,10 +80,11 @@ test('uses angular grammar', async () => {

test('uses custom opts parser', async () => {
const message = 'type(scope)-subject';
const changelogOpts: any = await importFrom(
__dirname,
'../fixtures/parser-preset/conventional-changelog-custom.js'
);
const changelogOpts = {
parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?-(.*)$/
}
};
const actual = await parse(message, undefined, changelogOpts.parserOpts);
const expected = {
body: null,
Expand Down Expand Up @@ -145,13 +145,11 @@ test('supports scopes with / and empty parserOpts', async () => {

test('ignores comments', async () => {
const message = 'type(some/scope): subject\n# some comment';
const changelogOpts: any = await importFrom(
process.cwd(),
'conventional-changelog-angular'
);
const opts = Object.assign({}, changelogOpts.parserOpts, {
const changelogOpts = await require('conventional-changelog-angular');
const opts = {
...changelogOpts.parserOpts,
commentChar: '#'
});
};
const actual = await parse(message, undefined, opts);

expect(actual.body).toBe(null);
Expand All @@ -162,13 +160,11 @@ test('ignores comments', async () => {
test('registers inline #', async () => {
const message =
'type(some/scope): subject #reference\n# some comment\nthings #reference';
const changelogOpts: any = await importFrom(
process.cwd(),
'conventional-changelog-angular'
);
const opts = Object.assign({}, changelogOpts.parserOpts, {
const changelogOpts = await require('conventional-changelog-angular');
const opts = {
...changelogOpts.parserOpts,
commentChar: '#'
});
};
const actual = await parse(message, undefined, opts);

expect(actual.subject).toBe('subject #reference');
Expand All @@ -177,13 +173,10 @@ test('registers inline #', async () => {

test('parses references leading subject', async () => {
const message = '#1 some subject';
const opts = await importFrom(
process.cwd(),
'conventional-changelog-angular'
);
const opts = await require('conventional-changelog-angular');
const {
references: [actual]
} = await parse(message, undefined, opts as any);
} = await parse(message, undefined, opts);

expect(actual.issue).toBe('1');
});
Expand Down