-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sebastian Häni <[email protected]>
- Loading branch information
0 parents
commit 52f0fb8
Showing
45 changed files
with
21,090 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"presets": [ | ||
["@babel/preset-env", { | ||
"targets": { | ||
"node": 18 | ||
} | ||
}], | ||
"@babel/typescript" | ||
], | ||
"ignore": [ | ||
"**/*.d.ts" | ||
] | ||
} |
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,3 @@ | ||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:18 | ||
|
||
RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm alias 16 system" |
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,20 @@ | ||
{ | ||
"name": "skills17-stryker-helpers", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"workspaceFolder": "/workspaces/stryker-helpers", | ||
"remoteUser": "node", | ||
"extensions": [ | ||
"dbaeumer.vscode-eslint", | ||
"redhat.vscode-yaml" | ||
], | ||
"settings": { | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"editor.tabSize": 2, | ||
"editor.rulers": [100] | ||
}, | ||
"postCreateCommand": "npm install" | ||
} |
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,10 @@ | ||
version: '3' | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
volumes: | ||
- ..:/workspaces/stryker-helpers:cached | ||
command: sleep infinity |
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,34 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"airbnb-base", | ||
"plugin:prettier/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"ignorePatterns": [ | ||
"**/node_modules/**", | ||
"**/lib/**", | ||
"**/*.d.ts", | ||
"*.d.ts" | ||
], | ||
"settings": { | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js", ".ts"] | ||
} | ||
} | ||
}, | ||
"rules": { | ||
"import/extensions": ["error", { | ||
"d.ts": "always" | ||
}], | ||
"import/no-import-module-exports": ["off"], | ||
"no-useless-constructor": ["off"], | ||
"no-shadow": ["off"], | ||
"@typescript-eslint/no-shadow": ["error"] | ||
} | ||
} |
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,22 @@ | ||
name: CI - lint | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Lint | ||
run: npm run lint |
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,27 @@ | ||
name: CI - test | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: .devcontainer | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Start containers | ||
run: docker-compose up -d | ||
- name: Change permissions | ||
run: docker-compose exec -T app chown -R node:node /workspaces/stryker-helpers | ||
- name: Install dependencies | ||
run: docker-compose exec -T --workdir /workspaces/stryker-helpers --user node app npm ci | ||
- name: Build library | ||
run: docker-compose exec -T --workdir /workspaces/stryker-helpers --user node app npm run build | ||
- name: Test | ||
run: docker-compose exec -T --workdir /workspaces/stryker-helpers --user node app npm test |
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,16 @@ | ||
# os | ||
.DS_Store | ||
|
||
# editor | ||
.vscode | ||
.idea | ||
|
||
# node | ||
node_modules | ||
npm-debug.log* | ||
|
||
# project | ||
lib/ | ||
.history/ | ||
.stryker-tmp/ | ||
reports/ |
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 @@ | ||
18 |
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,5 @@ | ||
{ | ||
"printWidth": 100, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Sebastian Häni | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,81 @@ | ||
# skills17/stryker-helpers | ||
|
||
This package provides Stryker helpers for usage in a skills competition environment. It includes: | ||
|
||
- Custom output formatter | ||
|
||
## Table of contents | ||
|
||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [License](#license) | ||
|
||
## Installation | ||
|
||
**Requirements:** | ||
|
||
- Node `18` or greater | ||
|
||
To install this package, run the following command: | ||
|
||
```bash | ||
npm install @skills17/stryker-helpers | ||
``` | ||
|
||
It is suggested to add the following npm scripts: | ||
|
||
```json | ||
"scripts": { | ||
"test": "skills17-stryker run", | ||
"test:json": "skills17-stryker run --json" | ||
}, | ||
``` | ||
|
||
This will provide the following commands: | ||
|
||
- `npm test` - Run all tests once and show a nice output with the awarded points (useful for the competitors to see | ||
their points) | ||
- `npm run test:json` - Run all tests once and get a json output (useful for automated marking scripts) | ||
|
||
Points can be awarded for coverage of conditionals and deductions for number of mutants survived. If any test fails in | ||
normal execution, no points will be awarded. | ||
|
||
## Usage | ||
|
||
A `config.yaml` file needs to be created that contains some information about the task. It should be placed in the root | ||
folder of your task, next to the `package.json` file. | ||
|
||
See the [`@skills17/task-config`](https://github.com/skills17/task-config#configuration) package for a detailed | ||
description of all available properties in the `config.yaml` file. | ||
|
||
### CLI | ||
|
||
As seen in the installation instructions, the `skills17-stryker` command is available. | ||
|
||
It is a thin wrapper around the `stryker run` command. | ||
|
||
All arguments to the command will be forwarded to `stryker` so Stryker can be used exactly the same way if this package | ||
wouldn't be installed. | ||
|
||
Additionally, the following new arguments are available: | ||
|
||
- `--json` output the test result with scored points in json to standard out | ||
|
||
### Scoring | ||
|
||
The generated test names are in the following format: | ||
|
||
``` | ||
[file key]-[mutant name] | ||
``` | ||
|
||
The file key is the file name being tested with the extension and `src/` removed. Path separators are replace with `.`. | ||
If multiple mutants with the same name are generated, any surviving mutant will make the test fail. | ||
|
||
### Extra tests | ||
|
||
With `skills17/stryker-helpers` there are no extra tests needed. | ||
|
||
## License | ||
|
||
[MIT](https://github.com/skills17/stryker-helpers/blob/master/LICENSE) |
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,8 @@ | ||
#!/usr/bin/env node | ||
const CommandWrapper = require('../lib/CommandWrapper').default; // eslint-disable-line @typescript-eslint/no-var-requires | ||
|
||
const cmd = new CommandWrapper(process.argv.slice(2)); | ||
|
||
(async () => { | ||
await cmd.process(); | ||
})(); |
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,6 @@ | ||
module.exports = { | ||
maxWorkers: 1, | ||
testEnvironment: 'node', | ||
testRegex: '.+\\/tests\\/integration\\/.*\\.test.ts$', | ||
testPathIgnorePatterns: ['/node_modules/', '/\\.stryker-tmp/'], | ||
}; |
Oops, something went wrong.