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 ff7fc68
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/assert.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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/assert-failure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import assert from 'node:assert';

import test from 'ava';
import assert from 'node:assert';

test('test', () => {
assert(false);
Expand Down
3 changes: 1 addition & 2 deletions test/external-assertions/fixtures/expect-failure.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'expect';

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

test('test', () => {
expect(false).toBeTruthy();
Expand Down
1 change: 0 additions & 1 deletion test/external-assertions/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import test from '@ava/test';

import {fixture} from '../helpers/exec.js';

test('node assertion ', async t => {
Expand Down

0 comments on commit ff7fc68

Please sign in to comment.