mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-08 16:16:24 +00:00
Update test files
This commit is contained in:
13
.github/workflows/main.yml
vendored
13
.github/workflows/main.yml
vendored
@@ -10,18 +10,17 @@ jobs:
|
|||||||
run: npm install
|
run: npm install
|
||||||
- name: Run tests and collect coverage
|
- name: Run tests and collect coverage
|
||||||
run: yarn run test-all
|
run: yarn run test-all
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov (demo)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/index/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
file: ./coverage/coverage-final.json
|
||||||
flags: unittest
|
flags: demo
|
||||||
name: codecov-1
|
name: codecov-1
|
||||||
- name: Upload coverage to Codecov (verbose)
|
- name: Upload coverage to Codecov (script)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/index/coverage-final.json
|
files: ./coverage/script/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
flags: script
|
||||||
flags: unittest
|
|
||||||
name: codecov-1
|
name: codecov-1
|
||||||
verbose: true
|
verbose: true
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --coverage",
|
"test": "jest --coverage",
|
||||||
"test-calculator": "jest --testPathPattern=src/calculator/ --coverage --coverageDirectory=coverage/calculator",
|
"test-calculator": "jest --testPathPattern=demo/calculator/ --coverage --coverageDirectory=coverage/calculator",
|
||||||
"test-index": "jest --testPathPattern=src/index --coverage --coverageDirectory=coverage/index",
|
"test-coverage": "jest --testPathPattern=demo/coverage --coverage --coverageDirectory=coverage/coverage",
|
||||||
|
"test-script": "jest --testPathPattern=src --coverage --coverageDirectory=coverage/script",
|
||||||
"test-all": "yarn run test && yarn run test-calculator && yarn run test-index && eslint",
|
"test-all": "yarn run test && yarn run test-calculator && yarn run test-index && eslint",
|
||||||
"build": "ncc build src/index.ts"
|
"build": "ncc build src/index.ts"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import Index from "./index";
|
|
||||||
|
|
||||||
test('test uncovered if', () => {
|
|
||||||
const indexObj = new Index();
|
|
||||||
expect(indexObj.uncovered_if()).toEqual(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('fully covered', () => {
|
|
||||||
const indexObj = new Index();
|
|
||||||
expect(indexObj.fully_covered()).toEqual(true);
|
|
||||||
});
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
export default class Index {
|
|
||||||
|
|
||||||
//This function is tested and part of it is uncovered
|
|
||||||
uncovered_if = (a = true) => {
|
|
||||||
if (a == true) {
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//This function will be fully covered
|
|
||||||
fully_covered = () => {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
//This function will not be tested by unit tests
|
|
||||||
uncovered = () => {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user