Skip to content

Commit

Permalink
Edit: Switching out mocha/chai for jest
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlelek committed Apr 30, 2024
1 parent 88b9829 commit 8d42769
Show file tree
Hide file tree
Showing 8 changed files with 5,388 additions and 2,406 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"root": true,
"env": {
"browser": false,
"mocha": true,
"node": true,
"es6": true
"es6": true,
"jest": true
},
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": "2022",
"sourceType": "module"
},
"plugins": ["promise", "unused-imports"],
"plugins": ["promise", "unused-imports", "jest"],
"rules": {
"camelcase": 0,
"curly": 2,
Expand Down
18 changes: 7 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ install:
npm install;

.PHONY: test
test: delint mocha
test: delint unit

.PHONY: delint
delint:
npm run lint;

# ESLint
./node_modules/.bin/eslint \
./app/**/*.js \
./test/*.js;

.PHONY: mocha
mocha:
npm test;
.PHONY: unit
unit:
npm run unit;

.PHONY: build
build:
Expand All @@ -39,13 +35,13 @@ build:
start:

# Start HTTP Server
node ./server.js;
node server.js;

.PHONY: deploy
deploy:

# Install Node.js Modules (Production)
npm install --production; true;
npm install --omit=dev;

.PHONY: d_build
d_build:
Expand Down
2 changes: 2 additions & 0 deletions app/core/contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import yaml from 'js-yaml';
import utils from './utils.js';
import content_processors from '../functions/contentProcessors.js';

// TODO: Scan on start/change, not on every request
async function handler(activePageSlug, config) {
activePageSlug = activePageSlug || '';
const baseSlug = activePageSlug.split(/[\\/]/).slice(0, -1).join('/');
const contentDir = utils.normalizeDir(path.normalize(config.content_dir));

// TODO: Fix extra trailing /
const files = await glob(`${contentDir}**/*`);
const filesProcessed = [];

Expand Down
4 changes: 3 additions & 1 deletion app/functions/build_nested_pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ function build_nested_pages(pages) {
while (i--) {
if (pages[i].slug.split('/').length > 1) {
const parent = find_by_slug(pages, pages[i]);
parent.files.unshift(pages[i]);
if (parent) {
parent.files.unshift(pages[i]);
}
} else {
result.unshift(pages[i]);
}
Expand Down
Loading

0 comments on commit 8d42769

Please sign in to comment.