Skip to content

Commit

Permalink
馃巰 lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Irvenae committed Apr 12, 2023
1 parent 8225c6b commit e14aa0a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/assert.js
Expand Up @@ -27,7 +27,7 @@ function formatWithLabel(label, value) {
return formatDescriptorWithLabel(label, concordance.describe(value, concordanceOptions));
}

const hasOwnProperty = (object, prop) => Object.prototype.hasOwnProperty.call(object, prop);
export const hasOwnProperty = (object, prop) => Object.prototype.hasOwnProperty.call(object, prop);
const noop = () => {};
const notImplemented = () => {
throw new Error('not implemented');
Expand Down
12 changes: 6 additions & 6 deletions lib/test.js
Expand Up @@ -2,7 +2,7 @@ import concordance from 'concordance';
import isPromise from 'is-promise';
import plur from 'plur';

import {AssertionError, Assertions, checkAssertionMessage} from './assert.js';
import {AssertionError, Assertions, checkAssertionMessage, hasOwnProperty} from './assert.js';
import concordanceOptions from './concordance-options.js';
import nowAndTimers from './now-and-timers.cjs';
import parseTestArgs from './parse-test-args.js';
Expand All @@ -14,7 +14,7 @@ function isExternalAssertError(error) {
}

// Match errors thrown by <https://www.npmjs.com/package/chai> and <https://nodejs.org/api/assert.html>.
return error.hasOwnProperty('actual') && error.hasOwnProperty('expected');
return hasOwnProperty(error, 'actual') && hasOwnProperty(error, 'expected');
}

function formatErrorValue(label, error) {
Expand Down Expand Up @@ -533,13 +533,13 @@ export default class Test {
this.saveFirstError(new AssertionError({
message: 'Assertion failed',
savedError: result.error instanceof Error && result.error,
values: [{label: 'Assertion failed: ', formatted: result.error.message}]
values: [{label: 'Assertion failed: ', formatted: result.error.message}],
}));
} else {
this.saveFirstError(new AssertionError({
message: 'Error thrown in test',
savedError: result.error instanceof Error && result.error,
values: [formatErrorValue('Error thrown in test:', result.error)]
values: [formatErrorValue('Error thrown in test:', result.error)],
}));
}

Expand Down Expand Up @@ -586,13 +586,13 @@ export default class Test {
this.saveFirstError(new AssertionError({
message: 'Assertion failed',
savedError: error instanceof Error && error,
values: [{label: 'Assertion failed: ', formatted: error.message}]
values: [{label: 'Assertion failed: ', formatted: error.message}],
}));
} else {
this.saveFirstError(new AssertionError({
message: 'Rejected promise returned by test',
savedError: error instanceof Error && error,
values: [formatErrorValue('Rejected promise returned by test. Reason:', error)]
values: [formatErrorValue('Rejected promise returned by test. Reason:', error)],
}));
}
})
Expand Down
3 changes: 1 addition & 2 deletions test/external-assertions/fixtures/expect-failure.js
@@ -1,6 +1,5 @@
import { expect } from 'expect';

import test from 'ava';
import {expect} from 'expect';

test('test', () => {
expect(false).toBeTruthy();
Expand Down

0 comments on commit e14aa0a

Please sign in to comment.