Skip to content

Commit

Permalink
Merge pull request #77 from yiminghe/code-coverage
Browse files Browse the repository at this point in the history
feat: support code coverage
  • Loading branch information
yiminghe authored Sep 1, 2023
2 parents 5fe697b + 1665057 commit 517b302
Show file tree
Hide file tree
Showing 12 changed files with 2,262 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- run: cp test-coverage-babelrc .babelrc
- run: pnpm test:ci
env:
CYPRESS_RECORD_KEY: ${{vars.CYPRESS_RECORD_KEY}}
CYPRESS_RECORD_KEY: ${{vars.CYPRESS_RECORD_KEY}}
- name: Coveralls
uses: coverallsapp/github-action@v2
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ yarn.lock
.vscode/
/dom-align/
*.tsbuildinfo
.nyc_output/
.next/
2 changes: 2 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

export const metadata = {
title: 'dom-align',
description: 'dom-align demo',
Expand Down
2 changes: 1 addition & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'next/link';
import { useMemo } from 'react';

import React from 'react';
import MarkdownIt from 'markdown-it';
import 'github-markdown-css/github-markdown-light.css';
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletions app/point/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useRef, useState } from 'react';
import { alignPoint } from '../../src';
import React from 'react';
export default function Point() {
const [sx, setSx] = useState('l');
const [sy, setSy] = useState('t');
Expand Down
5 changes: 5 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { defineConfig } from 'cypress';
export default defineConfig({
projectId: '22j6d7',
component: {
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config);

return config;
},
devServer: {
framework: 'next',
bundler: 'webpack',
Expand Down
1 change: 1 addition & 0 deletions cypress/component/basic.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="cypress" />

import domAlign from '../../src';
import React from 'react';

const { $ } = Cypress;

Expand Down
1 change: 1 addition & 0 deletions cypress/component/point.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="cypress" />

import { alignPoint } from '../../src';
import React from 'react';

const { $ } = Cypress;

Expand Down
2 changes: 1 addition & 1 deletion cypress/support/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Import commands.js using ES2015 syntax:
import './commands';

import '@cypress/code-coverage/support';
import 'normalize.css';

// Alternatively you can use CommonJS syntax:
Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,19 @@
"test": "cypress run --component",
"test:ci": "cypress run --component --record --key $CYPRESS_RECORD_KEY"
},
"nyc": {
"all": true,
"include": "src/**/*.js"
},
"devDependencies": {
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.11",
"@cypress/code-coverage": "^3.11.0",
"@swc/cli": "0.1.x",
"@swc/core": "1.3.x",
"@types/react": "18.2.21",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"cypress": "^13.1.0",
"eslint": "^8.48.0",
"eslint-config-next": "13.4.19",
Expand Down
Loading

0 comments on commit 517b302

Please sign in to comment.