diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3fa50d..c22b31e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,18 +10,17 @@ jobs: run: npm install - name: Run tests and collect coverage run: yarn run test-all - - name: Upload coverage to Codecov + - name: Upload coverage to Codecov (demo) uses: ./ 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 - flags: unittest + flags: demo name: codecov-1 - - name: Upload coverage to Codecov (verbose) + - name: Upload coverage to Codecov (script) uses: ./ with: - files: ./coverage/calculator/coverage-final.json,./coverage/index/coverage-final.json - file: ./coverage/coverage-final.json - flags: unittest + files: ./coverage/script/coverage-final.json + flags: script name: codecov-1 verbose: true diff --git a/src/calculator/calculator.test.ts b/demo/calculator/calculator.test.ts similarity index 100% rename from src/calculator/calculator.test.ts rename to demo/calculator/calculator.test.ts diff --git a/src/calculator/calculator.ts b/demo/calculator/calculator.ts similarity index 100% rename from src/calculator/calculator.ts rename to demo/calculator/calculator.ts diff --git a/package.json b/package.json index e813557..dfd1077 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "main": "index.js", "scripts": { "test": "jest --coverage", - "test-calculator": "jest --testPathPattern=src/calculator/ --coverage --coverageDirectory=coverage/calculator", - "test-index": "jest --testPathPattern=src/index --coverage --coverageDirectory=coverage/index", + "test-calculator": "jest --testPathPattern=demo/calculator/ --coverage --coverageDirectory=coverage/calculator", + "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", "build": "ncc build src/index.ts" }, diff --git a/src/index/index.test.ts b/src/index/index.test.ts deleted file mode 100644 index 24196db..0000000 --- a/src/index/index.test.ts +++ /dev/null @@ -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); -}); diff --git a/src/index/index.ts b/src/index/index.ts deleted file mode 100644 index 24e5c24..0000000 --- a/src/index/index.ts +++ /dev/null @@ -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 - } -}