forked from redfin/react-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start setup of react-server-cli integration tests
- Loading branch information
Showing
22 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
target | ||
test/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import child_process from 'child_process'; | ||
import test from 'ava'; | ||
import rimraf from 'rimraf'; | ||
|
||
const tmpPath = path.join(__dirname, 'tmp'); | ||
|
||
// function clear(){ | ||
// process.chdir(__dirname); | ||
// if (fs.existsSync(tmpPath)) rimraf.sync(tmpPath); | ||
// fs.mkdirSync(tmpPath); | ||
// process.chdir(tmpPath); | ||
// } | ||
|
||
test('test', async t => { | ||
process.chdir(`${__dirname}/fixtures/commands/start-basic/in-files`); | ||
const server = child_process.spawn(process.execPath, [path.join(__dirname, '..', 'bin', 'react-server-cli'), 'start']); | ||
|
||
server.stderr.on('data', stderr => process.stderr.write(stderr)); | ||
server.stdout.on('data', stdout => process.stdout.write(stdout)); | ||
|
||
await new Promise(resolve => { | ||
setTimeout(() => { | ||
resolve(); | ||
server.kill(); | ||
}, 3000); | ||
}); | ||
}); |
4 changes: 4 additions & 0 deletions
4
packages/react-server-cli/test/fixtures/commands/start-basic/in-files/routes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"middleware": [], | ||
"routes": {} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/react-server-cli/test/fixtures/commands/start-basic/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"args": ["start"] | ||
} |
Empty file.
5 changes: 5 additions & 0 deletions
5
packages/react-server-cli/test/fixtures/commands/start-basic/test/.babelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"presets": [ | ||
"react-server" | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/react-server-cli/test/fixtures/commands/start-basic/test/.reactserverrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"routesFile": "routes.json", | ||
"port": 3000, | ||
"env": { | ||
"production": { | ||
"port": 80 | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...react-server-cli/test/fixtures/commands/start-basic/test/__clientTemp/build/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"jsChunksByName":{"common":"common.bundle.js"},"jsChunksById":{"0":"common.bundle.js"},"cssChunksByName":{},"hash":"d8bf2572a3f704ae8f83"} |
18 changes: 18 additions & 0 deletions
18
packages/react-server-cli/test/fixtures/commands/start-basic/test/__clientTemp/entry.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
if (typeof window !== "undefined") { | ||
window.__setReactServerBase = function(path) { | ||
// according to http://webpack.github.io/docs/configuration.html#output-publicpath | ||
// we should never set __webpack_public_path__ when hot module replacement is on. | ||
if (!module.hot) { | ||
__webpack_public_path__ = path; | ||
} | ||
window.__reactServerBase = path; | ||
} | ||
} | ||
var reactServer = require("react-server"); | ||
window.rfBootstrap = function() { | ||
reactServer.logging.setLevel('main', "debug"); | ||
reactServer.logging.setLevel('time', "fast"); | ||
reactServer.logging.setLevel('gauge', "ok"); | ||
new reactServer.ClientController({routes: require("./routes_client")}).init(); | ||
} |
14 changes: 14 additions & 0 deletions
14
...es/react-server-cli/test/fixtures/commands/start-basic/test/__clientTemp/routes_client.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
var manifest = undefined; | ||
function unwrapEs6Module(module) { return module.__esModule ? module.default : module } | ||
var coreJsMiddleware = require('/Users/karlhorky/projects/kaytcat-react-server/packages/react-server-cli/node_modules/react-server-core-middleware/index.js').coreJsMiddleware; | ||
var coreCssMiddleware = require('/Users/karlhorky/projects/kaytcat-react-server/packages/react-server-cli/node_modules/react-server-core-middleware/index.js').coreCssMiddleware; | ||
module.exports = { | ||
middleware:[ | ||
coreJsMiddleware(null, manifest), | ||
coreCssMiddleware(null, manifest), | ||
|
||
], | ||
routes:{ | ||
} | ||
}; |
14 changes: 14 additions & 0 deletions
14
.../commands/start-basic/test/__clientTemp/routes_server_6d801a5f358c784222af96dab4833c21.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
var manifest = {"jsChunksByName":{"common":"common.bundle.js"},"jsChunksById":{"0":"common.bundle.js"},"cssChunksByName":{},"hash":"d8bf2572a3f704ae8f83"}; | ||
function unwrapEs6Module(module) { return module.__esModule ? module.default : module } | ||
var coreJsMiddleware = require('/Users/karlhorky/projects/kaytcat-react-server/packages/react-server-cli/node_modules/react-server-core-middleware/index.js').coreJsMiddleware; | ||
var coreCssMiddleware = require('/Users/karlhorky/projects/kaytcat-react-server/packages/react-server-cli/node_modules/react-server-core-middleware/index.js').coreCssMiddleware; | ||
module.exports = { | ||
middleware:[ | ||
coreJsMiddleware("http://localhost:3001/", manifest), | ||
coreCssMiddleware("http://localhost:3001/", manifest), | ||
|
||
], | ||
routes:{ | ||
} | ||
}; |
19 changes: 19 additions & 0 deletions
19
packages/react-server-cli/test/fixtures/commands/start-basic/test/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "test", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"babel-preset-react-server": "^0.4.10", | ||
"react": "^15.4.2", | ||
"react-dom": "^15.4.2", | ||
"react-server": "^0.5.1", | ||
"superagent": "^1.8.4" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/react-server-cli/test/fixtures/commands/start-basic/test/routes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"middleware": [], | ||
"routes": {} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/react-server-cli/test/fixtures/commands/start-missing-routes/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"args": ["start"] | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
packages/react-server-cli/test/fixtures/commands/start-reactserverrc/in-files/.reactserverrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"routesFile": "routes.js" | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/react-server-cli/test/fixtures/commands/start-reactserverrc/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"args": ["start"] | ||
} |
Empty file.
1 change: 1 addition & 0 deletions
1
packages/react-server-cli/test/fixtures/commands/start-routes-with-error/in-files/routes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
undeclaredVariable(); |
3 changes: 3 additions & 0 deletions
3
packages/react-server-cli/test/fixtures/commands/start-routes-with-error/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"args": ["start", "--routes-file", "routes.js"] | ||
} |
Empty file.