generated from usnistgov/opensource-repo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from nikitawootten-nist/nikitawootten-nist/iss…
…ue31 Create a `TESTING.md` document
- Loading branch information
Showing
11 changed files
with
129 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Testing | ||
|
||
## Local Testing | ||
|
||
### Lint | ||
|
||
To ensure that your changes are consistent with the project coding style, run `npm run lint`. | ||
This checks the repository against a variety of [ESLint](https://eslint.org/) rules, including (but not limited to): | ||
|
||
- Consistent spacing and indentation | ||
- The presence of the NIST license/distribution notice in all source files | ||
- Anti-patterns such as unused symbols | ||
|
||
Some issues can be fixed automatically by running `npm run lint-fix`. | ||
|
||
The linter is invoked by GitHub Actions when a pull request is run via the [Lint and Test workflow](./.github/workflows/test.yaml). | ||
Lint checks must pass before a pull request can be merged. | ||
|
||
### Test | ||
|
||
Tests can be found along source code in files with the `.spec.` infix. | ||
To run all unit tests, run `npm run test`. | ||
A test coverage report can be generated by running `npm run coverage`. | ||
This project uses [Jest](https://jestjs.io/) to generate coverage reports. | ||
|
||
These tests are run by GitHub Actions when a pull request is run via the [Lint and Test workflow](./.github/workflows/test.yaml). | ||
Tests must pass before a pull request can be merged. | ||
|
||
This project is broken up into packages using [NPM Workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces). | ||
Packages can be tested independently using the syntax `npm run test -- packages/<package>`, where `<package>` is the name of the target package. | ||
This syntax can also be used to test explicit subsets or sub-folders of a package. | ||
|
||
## CI/CD | ||
|
||
### Testing and Evaluation | ||
|
||
**SA-11: Developer Security Testing And Evaluation**: | ||
The NIST ITL CSD developers that maintain the `metaschema-node` application system at all post-design stages of the system development life cycle: | ||
|
||
- Perform unit and integration testing/evaluation for every commit in a development branch submitted for code review in the form of a pull request sent to the development team before merging it to the main release branch at the development team's recommended level of depth and coverage as described in the code coverage tool's configuration file [`jest.config.base.ts`](./jest.config.base.ts); | ||
- Produce evidence of the execution of the assessment plan and the results of the testing and evaluation; | ||
- Implement a verifiable flaw remediation process; | ||
- Correct flaws identified during testing and evaluation | ||
The required coverage is defined in this repository by the config file [`jest.config.base.ts`](./jest.config.base.ts). | ||
|
||
This check is performed by GitHub Actions via the [Lint and Test workflow](./.github/workflows/test.yaml) for all pull requests. | ||
|
||
#### Static Code Analysis | ||
|
||
**SA-11(02): Threat Modeling and Vulnerability Analysis**: | ||
The NIST ITL CSD developers that maintain `metaschema-node` are required to employ static code analysis tools to identify common flaws and document the results of the analysis. | ||
|
||
This check is performed by GitHub Actions via the [CodeQL Analysis workflow](./.github/workflows/codeql-analysis.yaml) as well as the linting portion of the [Lint and Test workflow](./.github/workflows/test.yaml). | ||
|
||
#### Vulnerability Analysis | ||
|
||
**SA-11(02): Threat and Vulnerability Analyses**: | ||
The NIST ITL CSD developers that maintain `metaschema-node` are required to perform vulnerability analyses during development and the subsequent testing and evaluation of the system that: | ||
|
||
- Uses the following contextual information: | ||
- The library dependencies as defined in this project's lock file [`package-lock.json`](./package-lock.json); | ||
- Employs the following tools and methods: | ||
- [Dependabot](https://github.com/dependabot); | ||
- Produces evidence that meets the following acceptance criteria: | ||
- All project dependencies on the main branch, as well as dependencies on incoming pull requests, have no known applicable reported vulnerabilities; | ||
|
||
Vulnerability alerts are published to [this dashboard](https://github.com/usnistgov/metaschema-node/security/dependabot) and via email. | ||
|
||
#### Manual Code Reviews | ||
|
||
**SA-11(04): Manual Code Reviews**: | ||
The NIST ITL CSD developers that maintain `metaschema-node` are required to perform a manual code review of all incoming pull requests using the following processes, procedures, and/or techniques: | ||
|
||
- Organization-defined members are required to provide a review before a pull request can be merged, as defined in the [`CODEOWNERS`](./.github/CODEOWNERS) file; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { Config } from 'jest'; | ||
|
||
import base from './jest.config.base'; | ||
|
||
export default { | ||
...base, | ||
coverageDirectory: '<rootDir>/coverage', | ||
projects: ['<rootDir>/packages/*/jest.config.ts'], | ||
}; | ||
} as Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { Config } from 'jest'; | ||
|
||
import base from '../../jest.config.base'; | ||
|
||
export default { | ||
...base, | ||
displayName: 'metaschema-model', | ||
}; | ||
} as Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { Config } from 'jest'; | ||
|
||
import base from '../../jest.config.base'; | ||
|
||
export default { | ||
...base, | ||
displayName: 'metaschema-model-common', | ||
}; | ||
} as Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { Config } from 'jest'; | ||
|
||
import base from '../../jest.config.base'; | ||
|
||
export default { | ||
...base, | ||
displayName: 'metaschema-model', | ||
}; | ||
} as Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters