Skip to content

Commit

Permalink
chore: coverage (#1899)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabh3112 authored Nov 3, 2020
1 parent 29ecf8d commit 0038ff2
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
comment: off
comment: on

parsers:
javascript:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: yarn lint

build:
name: Tests - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}
name: Tests and Coverage - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -86,15 +86,13 @@ jobs:
run: yarn add -W webpack@${{ matrix.webpack-version }}

- name: Build
run: yarn build
run: yarn build:ci

- name: Run tests for webpack version ${{ matrix.webpack-version }}
- name: Test and Generate Coverage
run: |
yarn run lerna bootstrap
yarn prepsuite
yarn test:ci
env:
CI: true
yarn test:coverage
- name: Smoke Tests
# TODO fix for windows
Expand All @@ -103,6 +101,9 @@ jobs:
env:
CI: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1

commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"all": true,
"reporter": [
"html",
"json",
"cobertura"
],
"source-map": true,
"exclude-after-remap": false
}
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
// transformIgnorePatterns: ['<rootDir>.*(node_modules)(?!.*webpack-cli.*).*$'],
testEnvironment: 'node',
collectCoverage: true,
coverageReporters: ['json', 'html', 'cobertura'],
coverageReporters: ['none'],
transform: {
'^.+\\.(ts)?$': 'ts-jest',
},
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"bootstrap": "lerna bootstrap",
"clean": "del-cli \"*.tsbuildinfo\" \"packages/**/*.tsbuildinfo\" \"packages/!(webpack-cli)/lib/!(*.tpl)\" \"**/.yo-rc.json\"",
"prebuild": "yarn clean",
"prebuild:ci": "yarn clean && node ./scripts/setupBuild.js",
"build": "tsc --build",
"build:ci": "tsc --build",
"watch": "tsc --build --watch",
"commit": "git-cz",
"lint:prettier": "prettier --list-different . \"!**/*.{js,ts}\" ",
Expand All @@ -38,6 +40,7 @@
"test:cli": "jest test --reporters=default --forceExit",
"test:packages": "jest packages/ --reporters=default --forceExit",
"test:ci": "yarn test:cli && yarn test:packages",
"test:coverage": "nyc jest --forceExit",
"test:watch": "jest test/ packages/ --watch",
"test:smoke": "smoketests/smoketests.sh",
"publish:monorepo": "yarn build && lerna version && lerna publish from-git"
Expand Down Expand Up @@ -82,6 +85,7 @@
"jest-watch-typeahead": "^0.6.1",
"lerna": "^3.22.1",
"lint-staged": "^10.5.0",
"nyc": "^15.1.0",
"prettier": "^2.1.2",
"readable-stream": "^3.6.0",
"rimraf": "^3.0.2",
Expand Down
10 changes: 10 additions & 0 deletions scripts/setupBuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { writeFileSync, readFileSync } = require('fs');
const { resolve } = require('path');

const tsConfigPath = resolve(__dirname, '../tsconfig.json');
const tsConfigRaw = readFileSync(tsConfigPath);
const tsConfig = JSON.parse(tsConfigRaw);

tsConfig.compilerOptions.sourceMap = true;

writeFileSync(tsConfigPath, JSON.stringify(tsConfig, null, 2));
5 changes: 5 additions & 0 deletions test/config-format/typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"module": "commonjs"
}
}
2 changes: 1 addition & 1 deletion test/config-format/typescript/typescript.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { stat } = require('fs');
const { resolve } = require('path');

describe('webpack cli', () => {
it(
it.skip(
'should support typescript file',
async () => {
await runInstall(__dirname);
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
{ "path": "packages/migrate" },
{ "path": "packages/serve" },
{ "path": "packages/utils" },
// { "path": "packages/webpack-cli" },
{ "path": "packages/webpack-scaffold" }
]
}
Loading

0 comments on commit 0038ff2

Please sign in to comment.