-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New test setup #640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New test setup #640
Changes from all commits
d03e7cb
1e745d0
3a54b1d
a876c08
30093ca
d7d7e5f
06cb294
f0ad0d0
14527a7
72f7a2e
b86bc1b
ae2587c
aa35a8d
ee15d3f
e96000b
c327e44
c7e3c3e
5b3c8e6
4f0760a
67b9133
1fad929
284e255
43677cd
790d5ca
b382917
7efe717
b3dafb5
594f26d
0c12c6d
874df60
160be44
b40388c
de9b539
6fc3d5e
b8ffc95
7ed86f6
8b94ac9
14421c6
b5a8db6
3e38906
814ef71
3a5c248
6dc9805
8a4d5e5
189d3ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,23 @@ | ||
| sudo: required | ||
| dist: trusty | ||
| addons: | ||
| apt: | ||
| sources: | ||
| - google-chrome | ||
| packages: | ||
| - google-chrome-stable | ||
| language: node_js | ||
| node_js: | ||
| - "node" | ||
| - "6" | ||
| - "4" | ||
| - "6" | ||
| cache: | ||
| yarn: true | ||
| directories: | ||
| - node_modules | ||
| install: | ||
| - curl -o- -L https://yarnpkg.com/install.sh | bash | ||
| - export PATH=$HOME/.yarn/bin:$PATH | ||
| - yarn --ignore-engines | ||
| before_install: | ||
| - rm yarn.lock | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we install chromedriver with NPM. Anyway, moving to NPM back didn't add any considerable amount of time to the build. |
||
| - export DISPLAY=:99.0 | ||
| - sh -e /etc/init.d/xvfb start | ||
| - sleep 3 | ||
| script: | ||
| - echo "No need to use npm test since it's done in the install section via 'npm prepublish'" | ||
| after_script: npm run coveralls | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,13 +23,15 @@ | |
| }, | ||
| "scripts": { | ||
| "build": "gulp", | ||
| "pretest": "npm run lint", | ||
| "test": "gulp test", | ||
| "html-report": "nyc report --temp-directory=./coverage --reporter=html", | ||
| "jest": "jest --coverage", | ||
| "coveralls": "nyc report --temp-directory=./coverage --reporter=text-lcov | coveralls", | ||
| "release": "gulp release", | ||
| "pretestonly": "gulp start-chromedriver", | ||
| "testonly": "cross-env NODE_PATH=test/lib jest \\.test.js", | ||
| "posttestonly": "gulp stop-chromedriver", | ||
| "pretest": "npm run lint && cross-env NODE_ENV=test npm run release", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does coveralls works. Do we need this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @arunoda coveralls needs to be piped the https://github.com/zeit/next.js/blob/master/.travis.yml#L14 so this logic is necessary.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! Thanks. |
||
| "test": "npm run testonly -- --coverage --forceExit", | ||
| "coveralls": "nyc --instrument=false --source-map=false report --temp-directory=./coverage --reporter=text-lcov | coveralls", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. |
||
| "lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'test/**/*.js'", | ||
| "prepublish": "gulp release", | ||
| "prepublish": "npm run test && npm run release", | ||
| "precommit": "npm run lint" | ||
| }, | ||
| "standard": { | ||
|
|
@@ -84,24 +86,34 @@ | |
| }, | ||
| "devDependencies": { | ||
| "babel-eslint": "7.1.1", | ||
| "babel-jest": "^18.0.0", | ||
| "babel-plugin-istanbul": "^3.0.0", | ||
| "babel-plugin-transform-remove-strict-mode": "0.0.2", | ||
| "babel-preset-env": "1.1.8", | ||
| "benchmark": "2.1.3", | ||
| "cheerio": "^0.22.0", | ||
| "chromedriver": "^2.26.1", | ||
| "coveralls": "2.11.15", | ||
| "gulp": "3.9.1", | ||
| "gulp-babel": "6.1.2", | ||
| "gulp-benchmark": "1.1.1", | ||
| "gulp-cached": "1.1.1", | ||
| "gulp-jest": "^1.0.0", | ||
| "gulp-notify": "2.2.0", | ||
| "husky": "0.12.0", | ||
| "jest": "^18.0.0", | ||
| "jest-cli": "^18.0.0", | ||
| "node-fetch": "^1.6.3", | ||
| "nyc": "^10.0.0", | ||
| "portfinder": "^1.0.10", | ||
| "run-sequence": "1.2.2", | ||
| "standard": "8.6.0", | ||
| "webpack-stream": "3.2.0" | ||
| "wd": "^1.1.1", | ||
| "webpack-stream": "3.2.0", | ||
| "cross-env": "^3.1.4" | ||
| }, | ||
| "jest": { | ||
| "testEnvironment": "node" | ||
| "testEnvironment": "node", | ||
| "testPathDirs": [ | ||
| "test/" | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,15 @@ export default class Server { | |
| if (this.hotReloader) { | ||
| await this.hotReloader.stop() | ||
| } | ||
|
|
||
| if (this.http) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need this because, we need to close the HTTP server after completing each test suite. |
||
| await new Promise((resolve, reject) => { | ||
| this.http.close((err) => { | ||
| if (err) return reject(err) | ||
| return resolve() | ||
| }) | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| defineRoutes () { | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import React from 'react' | ||
|
|
||
| export default class AsyncProps extends React.Component { | ||
| static async getInitialProps () { | ||
| return await fetchData() | ||
| } | ||
|
|
||
| render () { | ||
| return <p>{this.props.name}</p> | ||
| } | ||
| } | ||
|
|
||
| function fetchData () { | ||
| const p = new Promise(resolve => { | ||
| setTimeout(() => resolve({ name: 'Diego Milito' }), 10) | ||
| }) | ||
| return p | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import React from 'react' | ||
| import style from 'next/css' | ||
|
|
||
| export default () => <div className={styles}>This is red</div> | ||
| export default () => <div id='red-box' className={styles}>This is red</div> | ||
|
|
||
| const styles = style({ color: 'red' }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export default () => { | ||
| throw new Error('This is an expected error') | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reasons to remove this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not particular reason. We already testing for node 4 and 6.
nodeis the same as6.That's why I removed that.