Skip to content
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
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# https://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: test

on:
push:
branches: [master]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- run: npm test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
4 changes: 2 additions & 2 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const isNotThrowingErrors = function (testFuncs) {
const isNotImplementedError = (err) => err instanceof NotImplementedError;

class NotImplementedError extends Error {
constructor() {
super('Not implemented');
constructor(message = 'Not implemented') {
super(message);
}
}

Expand Down
8 changes: 3 additions & 5 deletions lib/optional-test-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ const { isNotImplementedError } = require('./errors.js');
function optionalTestExtension(title, cb, isAsyncTest) {
test(title, (t) => {
if (isAsyncTest) {
runAsyncTestCb(cb, t, title);
} else {
runSyncTestCb(cb, t, title);
return runAsyncTestCb(cb, t, title);
}
return runSyncTestCb(cb, t, title);
});
}

const runAsyncTestCb = (cb, t, title) => {
const runAsyncTestCb = (cb, t, title) =>
cb.call(t).catch((err) => {
handleTestError(t, title, err);
});
};

const runSyncTestCb = (cb, t, title) => {
try {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "basic-js",
"version": "1.0.0",
"description": "Tasks for mastering basics of JavaScript",
"main": "index.js",
"engines": {
"node": ">=22",
"npm": ">=10"
Expand Down
1 change: 0 additions & 1 deletion src/simple-chain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { decorateObject } = require('../lib');
const { NotImplementedError } = require('../lib');

/**
Expand Down
Loading