mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
parent
9a09de2feb
commit
18488f47b0
|
@ -15,8 +15,8 @@ app.prepare().then(() => {
|
|||
|
||||
server.get('*', (req, res) => handle(req, res))
|
||||
|
||||
server.listen(PORT, err => {
|
||||
if (err) throw err;
|
||||
console.log(`> Ready on http://localhost:${PORT}`)
|
||||
server.listen(port, err => {
|
||||
if (err) throw err
|
||||
console.log(`> Ready on http://localhost:${port}`)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"pretest": "npm run lint",
|
||||
"test": "npm run testall || npm run testall",
|
||||
"coveralls": "cat ./test/coverage/lcov.info | coveralls",
|
||||
"lint": "lerna run lint",
|
||||
"lint": "standard",
|
||||
"prepublish": "lerna run prepublish",
|
||||
"lint-staged": "lint-staged"
|
||||
},
|
||||
|
@ -26,9 +26,9 @@
|
|||
"parser": "babel-eslint",
|
||||
"ignore": [
|
||||
"**/node_modules/**",
|
||||
"**/examples/with-ioc/**",
|
||||
"**/examples/with-kea/**",
|
||||
"**/examples/with-mobx/**"
|
||||
"examples/with-ioc/**",
|
||||
"examples/with-kea/**",
|
||||
"examples/with-mobx/**"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import {join} from 'path'
|
||||
export const PHASE_EXPORT = 'phase-export'
|
||||
export const PHASE_PRODUCTION_BUILD = 'phase-production-build'
|
||||
export const PHASE_PRODUCTION_SERVER = 'phase-production-server'
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
"build": "taskr",
|
||||
"release": "taskr release",
|
||||
"flow": "flow check",
|
||||
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'build/**/*.js' 'test/**/*.js'",
|
||||
"prepublish": "npm run release"
|
||||
},
|
||||
"taskr": {
|
||||
|
@ -37,15 +36,6 @@
|
|||
"./taskfile-babel.js"
|
||||
]
|
||||
},
|
||||
"standard": {
|
||||
"parser": "babel-eslint",
|
||||
"ignore": [
|
||||
"**/node_modules/**",
|
||||
"**/examples/with-ioc/**",
|
||||
"**/examples/with-kea/**",
|
||||
"**/examples/with-mobx/**"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "7.1.2",
|
||||
"@babel/plugin-proposal-class-properties": "7.1.0",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, it, expect, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import webdriver from 'next-webdriver'
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import webdriver from 'next-webdriver'
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import webdriver from 'next-webdriver'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import {
|
||||
renderViaHTTP,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, test, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import cheerio from 'cheerio'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import {
|
||||
renderViaHTTP,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import cheerio from 'cheerio'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import cheerio from 'cheerio'
|
||||
import {
|
||||
renderViaHTTP
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import webdriver from 'next-webdriver'
|
||||
import {waitFor, getReactErrorOverlayContent} from 'next-test-utils'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import cheerio from 'cheerio'
|
||||
import { waitFor, check } from 'next-test-utils'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import { join } from 'path'
|
||||
import { check, File, waitFor, getReactErrorOverlayContent, getBrowserBodyText } from 'next-test-utils'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import { readFileSync, writeFileSync, renameSync, existsSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import {
|
||||
renderViaHTTP,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
|
||||
export default (context, render) => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, test, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import cheerio from 'cheerio'
|
||||
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import webdriver from 'next-webdriver'
|
||||
import { waitFor, check, File } from 'next-test-utils'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import {
|
||||
renderViaHTTP,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, test, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import cheerio from 'cheerio'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, it, expect, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import getPort from 'get-port'
|
||||
import clone from 'clone'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, it, expect, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import { existsSync } from 'fs'
|
||||
import {BUILD_ID_FILE} from 'next-server/constants'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import { check, getBrowserBodyText } from 'next-test-utils'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import { renderViaHTTP, getBrowserBodyText, check } from 'next-test-utils'
|
||||
import cheerio from 'cheerio'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import {
|
||||
nextBuild,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import { renderViaHTTP } from 'next-test-utils'
|
||||
import cheerio from 'cheerio'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, it, expect, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import getPort from 'get-port'
|
||||
import {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* global jasmine, describe, beforeAll, afterAll, it, expect */
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join, resolve } from 'path'
|
||||
import { existsSync } from 'fs'
|
||||
import webdriver from 'next-webdriver'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import {
|
||||
renderViaHTTP,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
|
||||
import { join } from 'path'
|
||||
import {
|
||||
nextServer,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import cheerio from 'cheerio'
|
||||
import { waitFor, check } from 'next-test-utils'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, it, expect, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { readFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import webdriver from 'next-webdriver'
|
||||
import { readFile } from 'fs'
|
||||
import { promisify } from 'util'
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
/* global describe, it, expect
|
||||
*/
|
||||
|
||||
/* eslint-env jest */
|
||||
import { readFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { renderViaHTTP, getBrowserBodyText, waitFor } from 'next-test-utils'
|
||||
import webdriver from 'next-webdriver'
|
||||
|
||||
// Does the same evaluation checking for INJECTED for 15 seconds, triggering every 500ms
|
||||
async function checkInjected(browser) {
|
||||
async function checkInjected (browser) {
|
||||
const start = Date.now()
|
||||
while(Date.now() - start < 15000) {
|
||||
while (Date.now() - start < 15000) {
|
||||
const bodyText = await getBrowserBodyText(browser)
|
||||
if(/INJECTED/.test(bodyText)) {
|
||||
if (/INJECTED/.test(bodyText)) {
|
||||
throw new Error('Vulnerable to XSS attacks')
|
||||
}
|
||||
await waitFor(500)
|
||||
|
@ -69,7 +67,6 @@ module.exports = (context) => {
|
|||
const browser = await webdriver(context.appPort, `/;'-(document.body.innerHTML='INJECTED')-'`)
|
||||
await checkInjected(browser)
|
||||
|
||||
|
||||
browser.close()
|
||||
})
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* global jasmine, describe, it, expect, beforeAll, afterAll */
|
||||
|
||||
/* eslint-env jest */
|
||||
/* global jasmine */
|
||||
import { join } from 'path'
|
||||
import {
|
||||
nextServer,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import {join} from 'path'
|
||||
import loadConfig from 'next-server/next-config'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import { join } from 'path'
|
||||
import {SERVER_DIRECTORY, CLIENT_STATIC_FILES_PATH} from 'next-server/constants'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import {normalize, join} from 'path'
|
||||
import {getPageEntries, createEntry} from 'next/dist/build/webpack/utils'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import EventEmitter from 'next-server/dist/lib/EventEmitter'
|
||||
|
||||
describe('EventEmitter', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import { Component } from 'react'
|
||||
import { getDisplayName } from 'next-server/dist/lib/utils'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import { loadGetInitialProps } from 'next-server/dist/lib/utils'
|
||||
|
||||
describe('loadGetInitialProps', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
import Router from 'next-server/dist/lib/router/router'
|
||||
|
||||
class PageLoader {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global describe, it, expect */
|
||||
/* eslint-env jest */
|
||||
|
||||
import shallowEquals from 'next-server/dist/lib/shallow-equals'
|
||||
|
||||
|
|
Loading…
Reference in a new issue