Skip to content

Commit

Permalink
chore(package): update ava to version 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeper[bot] authored and pvdlg committed Jan 27, 2020
1 parent 32494d1 commit eec56ca
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 50 deletions.
5 changes: 1 addition & 4 deletions package.json
Expand Up @@ -6,9 +6,6 @@
"ava": {
"files": [
"test/**/*.test.js"
],
"helpers": [
"test/helpers/**/*"
]
},
"bugs": {
Expand All @@ -28,7 +25,7 @@
"micromatch": "^3.1.10"
},
"devDependencies": {
"ava": "^2.0.0",
"ava": "^3.1.0",
"codecov": "^3.0.0",
"conventional-changelog-atom": "^2.0.0",
"conventional-changelog-conventionalcommits": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions test/analyze-commit.test.js
@@ -1,5 +1,5 @@
import test from 'ava';
import analyzeCommit from '../lib/analyze-commit';
const test = require('ava');
const analyzeCommit = require('../lib/analyze-commit');

test('Match breaking change', t => {
const commit = {
Expand Down
4 changes: 2 additions & 2 deletions test/compare-release-types.test.js
@@ -1,5 +1,5 @@
import test from 'ava';
import compareReleaseTypes from '../lib/compare-release-types';
const test = require('ava');
const compareReleaseTypes = require('../lib/compare-release-types');

test('Compares release types', t => {
t.true(compareReleaseTypes('patch', 'minor'));
Expand Down
31 changes: 14 additions & 17 deletions test/integration.test.js
@@ -1,6 +1,6 @@
import test from 'ava';
import {stub} from 'sinon';
import {analyzeCommits} from '..';
const test = require('ava');
const {stub} = require('sinon');
const {analyzeCommits} = require('..');

const cwd = process.cwd();

Expand Down Expand Up @@ -234,7 +234,7 @@ test('Process rules in order and apply highest match', async t => {
t.true(t.context.log.calledWith('Analysis of %s commits complete: %s release', 2, 'minor'));
});

test('Process rules in order and apply highest match from config even if default has an higher match', async t => {
test('Process rules in order and apply highest match = require(config even if default has an higher match', async t => {
const commits = [
{hash: '123', message: 'Chore: First chore (fixes #123)'},
{hash: '456', message: 'Docs: update README (fixes #456) \n\n BREAKING CHANGE: break something'},
Expand Down Expand Up @@ -351,17 +351,15 @@ test('Throw error if "preset" doesn`t exist', async t => {
});

test('Throw error if "releaseRules" is not an Array or a String', async t => {
await t.throwsAsync(
analyzeCommits({releaseRules: {}}, {cwd}),
/Error in commit-analyzer configuration: "releaseRules" must be an array of rules/
);
await t.throwsAsync(analyzeCommits({releaseRules: {}}, {cwd}), {
message: /Error in commit-analyzer configuration: "releaseRules" must be an array of rules/,
});
});

test('Throw error if "releaseRules" option reference a requierable module that is not an Array or a String', async t => {
await t.throwsAsync(
analyzeCommits({releaseRules: './test/fixtures/release-rules-invalid'}, {cwd}),
/Error in commit-analyzer configuration: "releaseRules" must be an array of rules/
);
await t.throwsAsync(analyzeCommits({releaseRules: './test/fixtures/release-rules-invalid'}, {cwd}), {
message: /Error in commit-analyzer configuration: "releaseRules" must be an array of rules/,
});
});

test('Throw error if "config" doesn`t exist', async t => {
Expand All @@ -372,13 +370,12 @@ test('Throw error if "config" doesn`t exist', async t => {
});

test('Throw error if "releaseRules" reference invalid commit type', async t => {
await t.throwsAsync(
analyzeCommits({preset: 'eslint', releaseRules: [{tag: 'Update', release: 'invalid'}]}, {cwd}),
/Error in commit-analyzer configuration: "invalid" is not a valid release type\. Valid values are:\[?.*\]/
);
await t.throwsAsync(analyzeCommits({preset: 'eslint', releaseRules: [{tag: 'Update', release: 'invalid'}]}, {cwd}), {
message: /Error in commit-analyzer configuration: "invalid" is not a valid release type\. Valid values are:\[?.*\]/,
});
});

test('Re-Throw error from "conventional-changelog-parser"', async t => {
test('Re-Throw error = require("conventional-changelog-parser"', async t => {
const commits = [{message: 'Fix: First fix (fixes #123)'}, {message: 'Update: Second feature (fixes #456)'}];
await t.throwsAsync(analyzeCommits({parserOpts: {headerPattern: '\\'}}, {cwd, commits, logger: t.context.logger}));
});
4 changes: 2 additions & 2 deletions test/load-parser-config.test.js
@@ -1,5 +1,5 @@
import test from 'ava';
import loadParserConfig from '../lib/load-parser-config';
const test = require('ava');
const loadParserConfig = require('../lib/load-parser-config');

const cwd = process.cwd();

Expand Down
41 changes: 18 additions & 23 deletions test/load-release-rules.test.js
@@ -1,6 +1,6 @@
import test from 'ava';
import loadReleaseRules from '../lib/load-release-rules';
import testReleaseRules from './fixtures/release-rules';
const test = require('ava');
const loadReleaseRules = require('../lib/load-release-rules');
const testReleaseRules = require('./fixtures/release-rules');

const cwd = process.cwd();

Expand Down Expand Up @@ -40,36 +40,31 @@ test('Preserve release rules set to "false" or "null"', t => {
});

test('Throw error if "releaseRules" reference invalid commit type', t => {
t.throws(
() => loadReleaseRules({releaseRules: [{tag: 'Update', release: 'invalid'}]}, {cwd}),
/Error in commit-analyzer configuration: "invalid" is not a valid release type\. Valid values are:\[?.*\]/
);
t.throws(() => loadReleaseRules({releaseRules: [{tag: 'Update', release: 'invalid'}]}, {cwd}), {
message: /Error in commit-analyzer configuration: "invalid" is not a valid release type\. Valid values are:\[?.*\]/,
});
});

test('Throw error if a rule in "releaseRules" does not have a release type', t => {
t.throws(
() => loadReleaseRules({releaseRules: [{tag: 'Update'}]}, {cwd}),
/Error in commit-analyzer configuration: rules must be an object with a "release" property/
);
t.throws(() => loadReleaseRules({releaseRules: [{tag: 'Update'}]}, {cwd}), {
message: /Error in commit-analyzer configuration: rules must be an object with a "release" property/,
});
});

test('Throw error if "releaseRules" is not an Array or a String', t => {
t.throws(
() => loadReleaseRules({releaseRules: {}}, {cwd}),
/Error in commit-analyzer configuration: "releaseRules" must be an array of rules/
);
t.throws(() => loadReleaseRules({releaseRules: {}}, {cwd}), {
message: /Error in commit-analyzer configuration: "releaseRules" must be an array of rules/,
});
});

test('Throw error if "releaseRules" option reference a requierable module that is not an Array or a String', t => {
t.throws(
() => loadReleaseRules({releaseRules: './test/fixtures/release-rules-invalid'}, {cwd}),
/Error in commit-analyzer configuration: "releaseRules" must be an array of rules/
);
t.throws(() => loadReleaseRules({releaseRules: './test/fixtures/release-rules-invalid'}, {cwd}), {
message: /Error in commit-analyzer configuration: "releaseRules" must be an array of rules/,
});
});

test('Throw error if "releaseRules" contains an undefined rule', t => {
t.throws(
() => loadReleaseRules({releaseRules: [{type: 'feat', release: 'minor'}, undefined]}, {cwd}),
/Error in commit-analyzer configuration: rules must be an object with a "release" property/
);
t.throws(() => loadReleaseRules({releaseRules: [{type: 'feat', release: 'minor'}, undefined]}, {cwd}), {
message: /Error in commit-analyzer configuration: rules must be an object with a "release" property/,
});
});

0 comments on commit eec56ca

Please sign in to comment.