Skip to content

Commit d66a101

Browse files
authored
add tests and fix workflows (#8)
* add mocha.opts,update package.json,add project_directory_structure.md,update webserver.js,update yarn.lock, add webserver.test.js * update the file extension of project_directory_structure.md to .txt * fix workflow * add branch rule for tests branch * disable SSH-key auth in favour of HTTPS clone * optimize the workflow file * add exisiting yarn.lock to root path of repo * migrate from .json eslint config to new spec, update webserver logic and test cases. * add eslint.config.mjs to root of monorepo structure. * update node-version variable to use 22 instead of 16(?) * update project workflow structure dependencies for monorepo structure * restructure entire project for easier management. * update path for tests and linting * update the workflow to verify the lock file exists in the expected subdirectory. * commit and push yarn.lock to root of repo. * update workflow spec again * update workflow path * update workflow * remove yarn lockfile verification step * update working-dir path * update linting workflow, add badge for Mocha tests * update README with badges and update linting workflow * update root readme.md before merge to main
1 parent 953073a commit d66a101

File tree

18 files changed

+2426
-555
lines changed

18 files changed

+2426
-555
lines changed

.github/workflows/eslint.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Lint with JSHint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
- tests
9+
pull_request:
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
cache: 'yarn'
24+
25+
- name: Install dependencies
26+
working-directory: node-express-server
27+
run: yarn install
28+
29+
- name: Run JSHint lint
30+
working-directory: node-express-server
31+
run: npx jshint webserver.js
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Mocha Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
- tests
9+
pull_request:
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
cache: 'yarn'
24+
25+
- name: Install dependencies
26+
working-directory: node-express-server
27+
run: yarn install
28+
29+
- name: Run Mocha tests
30+
working-directory: node-express-server
31+
run: npx mocha test/webserver.test.js

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# javascript
2-
[![eslint](https://github.com/Defirence/javascript/actions/workflows/eslint.yml/badge.svg?branch=main)](https://github.com/Defirence/javascript/actions/workflows/eslint.yml)
32

4-
A collection of JavaScript boilerplate templates, some basic configurations and hello-world projects as a portfolio.
3+
Random JavaScript stuff for fun. :)
4+
5+
[![Mocha Tests](https://github.com/Defirence/javascript/actions/workflows/run-mocha-tests.yml/badge.svg)](https://github.com/Defirence/javascript/actions/workflows/run-mocha-tests.yml) [![Lint JSHint](https://github.com/Defirence/javascript/actions/workflows/lint-with-jshint.yml/badge.svg)](https://github.com/Defirence/javascript/actions/workflows/lint-with-jshint.yml)
56

67
<p xmlns:dct="http://purl.org/dc/terms/" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#">
78
<a rel="license"

boiler-plate/node-express-server/.eslintrc.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

boiler-plate/node-express-server/README.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

boiler-plate/node-express-server/webserver.js

Lines changed: 0 additions & 41 deletions
This file was deleted.
File renamed without changes.

node-express-server/.jshintrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"esversion": 6,
3+
"node": true,
4+
"browser": true,
5+
"globals": {
6+
"describe": true,
7+
"it": true,
8+
"before": true,
9+
"after": true
10+
},
11+
"undef": true,
12+
"unused": true
13+
}
File renamed without changes.

0 commit comments

Comments
 (0)