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 thetests-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 intests-only/package.json
. It should not be hand-edited; use commands likenpm install
ornpm uninstall
from thetests-only
directory to make changes. -
The folder
tests-only/node_modules
contains the dependencies installed bynpm
.
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 outerpackage.json
. -
Rerun
npm install
to updatepackage-lock.json
based on the above changes.