1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-19 21:01:57 +02:00

Add coverage test with mocha and codecov (#2037)

* Run mocha test with module alias

* Running test with babel module alias

* Fix model alias

* Fix model alias

* Resolve module alias

* Running test with babel module alias

* Connect to codecov

* add codecov to travis

* stop if yarn test has errors

* Still cannot collect data from slate modules

* Try to check whether it works with codecov

* Move config to nycrc

* Remove nyc require

* Update nyc to use src

* better before_script
This commit is contained in:
Jinxuan Zhu 2018-08-06 13:31:42 -04:00 committed by Ian Storm Taylor
parent 07d7f51bbc
commit 58c644323f
88 changed files with 703 additions and 126 deletions

View File

@ -29,7 +29,15 @@
"react",
"stage-0"
],
"plugins": ["transform-runtime"]
"plugins": [
"transform-runtime",
["module-resolver", {
"alias" : {
"^(slate.*)": "./packages/\\1/src"
}
}],
"istanbul"
]
},
"benchmark": {
"presets": [

2
.gitignore vendored
View File

@ -16,6 +16,8 @@ node_modules/
npm-debug.log
yarn-error.log
packages/*/yarn.lock
coverage/
.nyc_output/
# OS files.
.DS_Store

16
.nycrc Normal file
View File

@ -0,0 +1,16 @@
{
"sourceMap": false,
"instrument": false,
"all": true,
"extension" : ["js"],
"cache": false,
"include": ["**/src/**"],
"reporter": [
"html",
"lcov",
"text",
"text-summary"
],
"report-dir": "coverage"
}

View File

@ -1,4 +1,3 @@
language: node_js
node_js: [node]
@ -6,18 +5,28 @@ before_install:
# Export the C++11 compiler.
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CXX=g++-4.8; fi
cache:
# Cache yarn packages.
yarn: true
cache: yarn
env:
# Do two runs, one for testing and one for linting.
matrix:
- TEST_TYPE=test
- TEST_TYPE=lint
- TEST_TYPE=test:coverage
- TEST_TYPE=lint:eslint
- TEST_TYPE=lint:prettier
before_script:
- |
set -e
if [[ $TEST_TYPE == 'lint:eslint' ]]; then
lerna bootstrap
yarn build
fi
set +e
script:
# Build all of the packages so they are resolvable by each other.
- yarn build
# Run testing or linting depending on the environment.
- yarn $TEST_TYPE
- |
set -e
yarn $TEST_TYPE
if [[ $TEST_TYPE == 'test:coverage' ]]; then yarn codecov; fi
set +e

View File

@ -10,12 +10,16 @@
"babel-eslint": "^8.2.1",
"babel-loader": "^7.1.2",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-runtime": "^6.26.0",
"blanket": "^1.2.3",
"chalk": "^1.1.3",
"codecov": "^3.0.4",
"commander": "^2.15.1",
"copy-webpack-plugin": "^4.4.1",
"cross-env": "^5.1.3",
@ -43,7 +47,9 @@
"lodash": "^4.17.4",
"matcha": "^0.7.0",
"mocha": "^2.5.3",
"mocha-lcov-reporter": "^1.3.0",
"npm-run-all": "^4.1.2",
"nyc": "^12.0.2",
"prettier": "^1.10.2",
"prismjs": "^1.5.1",
"react": "^16.4.1",
@ -93,13 +99,15 @@
"build:production": "cross-env NODE_ENV=production rollup --config ./support/rollup/config.js && cross-env NODE_ENV=production webpack --config support/webpack/config.js",
"clean": "lerna run clean && rm -rf ./node_modules ./dist ./build",
"gh-pages": "gh-pages --dist ./build",
"lint": "eslint benchmark packages/*/src packages/*/test examples/*/*.js examples/dev/*/*.js && prettier --list-different '**/*.{js,jsx,md,json,css}'",
"lint:eslint": "eslint benchmark packages/*/src packages/*/test examples/*/*.js examples/dev/*/*.js",
"lint:prettier": "prettier --list-different '**/*.{md,json,css}'",
"open": "open http://localhost:8080",
"prettier": "prettier --write '**/*.{js,jsx,md,json,css}'",
"release": "yarn build:production && yarn test && yarn lint && lerna publish && yarn gh-pages",
"server": "webpack-dev-server --config ./support/webpack/config.js",
"start": "npm-run-all --parallel --print-label watch server",
"test": "cross-env BABEL_ENV=test FORBID_DEPRECATIONS=true mocha --require babel-core/register ./packages/*/test/index.js",
"test:coverage": "cross-env NODE_ENV=test nyc yarn test",
"watch": "rollup --config ./support/rollup/config.js --watch"
}
}

View File

@ -1,4 +1,4 @@
import Html from '..'
import Html from 'slate-html-serializer'
import assert from 'assert'
import { JSDOM } from 'jsdom'
import { Value } from 'slate'

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<document>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { createHyperscript } from '../..'
import { createHyperscript } from 'slate-hyperscript'
const h = createHyperscript({
blocks: {

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<document>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value normalize={false}>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<document>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import h from '../..'
import h from 'slate-hyperscript'
export const input = (
<value>

View File

@ -1,4 +1,4 @@
import Plain from '..'
import Plain from 'slate-plain-serializer'
import assert from 'assert'
import { Value } from 'slate'
import { fixtures } from 'slate-dev-test-utils'

View File

@ -5,7 +5,7 @@ import clean from './helpers/clean'
import React from 'react'
import ReactDOM from 'react-dom/server'
import Simulator from 'slate-simulator'
import { Editor } from '..'
import { Editor } from 'slate-react'
import { fixtures } from 'slate-dev-test-utils'
import { JSDOM } from 'jsdom'

View File

@ -2,7 +2,7 @@
import h from '../../../helpers/h'
import { Mark } from '../../../..'
import { Mark } from 'slate'
export default function(change) {
change.addMark(

View File

@ -2,7 +2,7 @@
import h from '../../../helpers/h'
import { Mark } from '../../../..'
import { Mark } from 'slate'
export default function(change) {
const marks = []

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Block } from '../../../..'
import { Block } from 'slate'
export default function(change) {
change.insertBlock(Block.create({ type: 'quote' }))

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Inline } from '../../../..'
import { Inline } from 'slate'
export default function(change) {
change.insertInline(

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Mark } from '../../../..'
import { Mark } from 'slate'
export default function(change) {
const marks = Mark.createSet([{ type: 'bold' }])

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Mark } from '../../../..'
import { Mark } from 'slate'
export default function(change) {
change.removeMark(

View File

@ -2,7 +2,7 @@
import h from '../../../helpers/h'
import { Mark } from '../../../..'
import { Mark } from 'slate'
export default function(change) {
change.replaceMark(

View File

@ -2,7 +2,7 @@
import h from '../../../helpers/h'
import { Data } from '../../../..'
import { Data } from 'slate'
export default function(change) {
change.setBlocks({ data: Data.create({ thing: 'value' }) })

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Data } from '../../../..'
import { Data } from 'slate'
export default function(change) {
change.setBlocks({

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Data } from '../../../..'
import { Data } from 'slate'
export default function(change) {
change.setInlines({ data: Data.create({ thing: 'value' }) })

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Data } from '../../../..'
import { Data } from 'slate'
export default function(change) {
change.setInlines({

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Mark } from '../../../..'
import { Mark } from 'slate'
export default function(change) {
change.toggleMark(

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Mark } from '../../../..'
import { Mark } from 'slate'
export default function(change) {
change.toggleMark(

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Block } from '../../../..'
import { Block } from 'slate'
export default function(change) {
change.insertNodeByKey('a', 0, Block.create('paragraph'))

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../helpers/h'
import { Inline } from '../../../..'
import { Inline } from 'slate'
export default function(change) {
change.insertNodeByKey(

View File

@ -1,6 +1,6 @@
import assert from 'assert'
import { fixtures } from 'slate-dev-test-utils'
import { Node, Schema, Value } from '..'
import { Node, Schema, Value } from 'slate'
describe('slate', () => {
fixtures(__dirname, 'models/leaf', ({ module }) => {

View File

@ -1,7 +1,7 @@
/** @jsx h */
import { List } from 'immutable'
import { Leaf } from '../../../..'
import { Leaf } from 'slate'
export const input = List([
Leaf.create({

View File

@ -1,7 +1,7 @@
/** @jsx h */
import { List } from 'immutable'
import { Leaf } from '../../../..'
import { Leaf } from 'slate'
export const input = List([
Leaf.create({

View File

@ -1,7 +1,7 @@
/** @jsx h */
import { List } from 'immutable'
import { Leaf } from '../../../..'
import { Leaf } from 'slate'
export const input = List([
Leaf.create({

View File

@ -1,7 +1,7 @@
/** @jsx h */
import { List } from 'immutable'
import { Leaf } from '../../../..'
import { Leaf } from 'slate'
export const input = List([
Leaf.create({

View File

@ -1,7 +1,7 @@
/** @jsx h */
import { List } from 'immutable'
import { Leaf } from '../../../..'
import { Leaf } from 'slate'
export const input = List([
Leaf.create({

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = <b>CatCute</b>[0]

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = <text>CatCute</text>[0]

View File

@ -1,7 +1,7 @@
/** @jsx h */
import { List } from 'immutable'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
import h from '../../../../helpers/h'
export const input = <i />[0]

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = <text>Cat is Cute</text>[0]

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -1,7 +1,7 @@
/** @jsx h */
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = <b />[0]

View File

@ -2,7 +2,7 @@
import h from '../../../../helpers/h'
import { Set } from 'immutable'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -2,7 +2,7 @@
import h from '../../../../helpers/h'
import { Set } from 'immutable'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = <b />[0]

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = <b />[0]

View File

@ -2,7 +2,7 @@
import h from '../../../../helpers/h'
import { Set } from 'immutable'
import { Mark } from '../../../../../'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../../'
import { Mark } from 'slate'
export const input = <b />[0]

View File

@ -2,7 +2,7 @@
import { Set } from 'immutable'
import h from '../../../../helpers/h'
import { Mark } from '../../../../..'
import { Mark } from 'slate'
export const input = (
<text>

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { Mark } from '../../../../..'
import { Mark } from 'slate'
import h from '../../../../helpers/h'
export const input = (

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { Mark } from '../../../../..'
import { Mark } from 'slate'
import h from '../../../../helpers/h'
export const input = (

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { Mark } from '../../../../..'
import { Mark } from 'slate'
import h from '../../../../helpers/h'
export const input = <b>Cat is Cute</b>[0]

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { Mark } from '../../../../..'
import { Mark } from 'slate'
import h from '../../../../helpers/h'
export const input = <b />[0]

View File

@ -1,6 +1,6 @@
/** @jsx h */
import { Mark } from '../../../../..'
import { Mark } from 'slate'
import h from '../../../../helpers/h'
export const input = <b />[0]

600
yarn.lock

File diff suppressed because it is too large Load Diff