Skip to content
Snippets Groups Projects
Commit 9d2c8276 authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Initial commit.

parents
Branches main
No related tags found
No related merge requests found
# Disable line-ending conversions for this repository.
* -text
# dependencies
/node_modules
# testing
/coverage
# production
/build
# environments
.env.local
.env.development.local
.env.test.local
.env.production.local
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# misc
*~
.DS_Store
[submodule "eslint-config"]
path = eslint-config
url = git@git.unl.edu:csce-310/eslint-config.git
# Tests-Only Starter Code
A minimal project to be used as starter code for homework assignments in the 250
section of the CSCE 310 course at UNL.
# Quick Start
Recursively clone this repository and `cd` into the root folder:
```
$ git clone --recursive git@git.unl.edu:csce-310/tests-only-starter-code.git
$ cd tests-only-starter-code
```
(If you forget `--recursive` when cloning, you can `cd` into your clone and run
`git submodule update --init --recursive` instead.)
Install dependencies:
```
$ npm install
```
Optionally run the linter and the test suite:
```
$ npm run lint
$ npm run test
```
# Folders and Files
The folders and files in the starter code are briefly described below.
## Submodules
* The Git submodule `eslint-config` contains the ESLint configuration for the
coding style used in the `tests-only` project.
## General Configuration
* The file `tests-only/.gitignore` prevents non-source-code files from being
accidentally committed to the repository.
* The file `tests-only/package.json` describes the project and its
dependencies. It can be edited to customize the inputs and processes used
in various software lifecyle tasks like linting, testing, or deploying.
* The file `tests-only/package-lock.json` records the exact set of
dependencies used to satisfy the requirements in `tests-only/package.json`.
It should not be hand-edited; use commands like `npm install` or `npm
uninstall` from the `tests-only` directory to make changes.
* The folder `tests-only/node_modules` contains the dependencies installed by
`npm`.
## Code Under Test
* The file `tests-only/src/helloWorld.js` is an example of a simple
implementation that can be unit tested.
## Test Code
* The file `tests-only/src/helloWorld.test.js` demonstrates a Jest unit test.
# Adaptation Checklist
When adapting this code for a new project, make sure to do at least the
following:
* Change the project name, version number, and description in
`tests-only/package.json`.
* Rename the folder from `tests-only` to something descriptive and change the
corresponding entries in the outer `package.json`.
* Rerun `npm install` to update `package-lock.json` based on the above changes.
Subproject commit 24df42fb655d234b83c93b0fb24d012e4d9ecb58
This diff is collapsed.
{
"name": "@unlsoft/tests-only",
"version": "1.0.0",
"description": "A project skeleton to be used as starter code for labs and homework.",
"private": true,
"license": "UNLICENSED",
"scripts": {
"postinstall:eslint-config": "cd eslint-config && npm install",
"postinstall:app": "cd tests-only && npm install",
"postinstall": "run-s postinstall:**",
"lint:app": "cd tests-only && npm run lint",
"lint": "run-s --continue-on-error lint:**",
"test-once:app": "cd tests-only && npm run test-once",
"test-once": "run-s --continue-on-error test-once:**",
"test": "run-s test-once",
"start": "cd tests-only && npm run start",
"build:app": "cd tests-only && npm run build",
"build": "run-s build:**"
},
"devDependencies": {
"ghooks": "^2.0.4",
"npm-run-all": "^4.1.5"
},
"config": {
"ghooks": {
"pre-commit": "npm run lint"
}
}
}
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.eol": "LF",
"files.exclude": {
"**/node_modules": true
},
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true
}
}
# dependencies
/node_modules
# testing
/coverage
# production
/build
# environments
.env.local
.env.development.local
.env.test.local
.env.production.local
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# misc
*~
.DS_Store
This diff is collapsed.
{
"name": "@unlsoft/tests-only-implementation",
"version": "1.0.0",
"description": "A minimal project to be used as starter code for labs and homework.",
"type": "module",
"private": true,
"license": "UNLICENSED",
"scripts": {
"lint:js": "eslint --max-warnings 0 ./src",
"lint": "run-s --continue-on-error lint:**",
"test-once": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watchAll --coverage"
},
"dependencies": {
"npm-run-all": "^4.1.5"
},
"devDependencies": {
"@unlsoft/eslint-config": "file:../eslint-config",
"eslint": "^7.30.0",
"jest": "^27.0.6",
"jest-environment-node": "^27.0.6"
},
"eslintConfig": {
"extends": "@unlsoft"
},
"jest": {
"clearMocks": true,
"collectCoverageFrom": [
"src/**/*.js"
],
"resetMocks": false,
"restoreMocks": false,
"testEnvironment": "jest-environment-node",
"transform": {}
},
"//": [
"See https://github.com/facebook/jest/issues/9430 for information on Jest+ES6."
]
}
export function helloWorld() {
return 'Hello, World!';
}
import { helloWorld } from './helloWorld.js';
describe('the hello-world function', () => {
test('returns the correct string', () => {
expect(helloWorld()).toBe('Hello, World!');
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment