-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from smashtestio/feat/start-server
Add --start-server arg
- Loading branch information
Showing
7 changed files
with
148 additions
and
2 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 |
---|---|---|
|
@@ -5,3 +5,4 @@ smashtest | |
dist | ||
.DS_Store | ||
package-lock.json | ||
start-server-and-test/bundle.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
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 @@ | ||
Patched and bundled version of `[email protected]`. |
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,27 @@ | ||
{ | ||
"name": "start-server-and-test_patched", | ||
"version": "1.0.0", | ||
"description": "", | ||
"keywords": [], | ||
"license": "ISC", | ||
"author": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"postinstall": "patch-package", | ||
"build": "rollup -c" | ||
}, | ||
"dependencies": { | ||
"patch-package": "^8.0.0", | ||
"start-server-and-test": "2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.22.11", | ||
"@babel/preset-env": "^7.22.10", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-commonjs": "^25.0.4", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.2.1", | ||
"@rollup/plugin-strip": "^3.0.2", | ||
"rollup": "^3.28.1" | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
start-server-and-test/patches/start-server-and-test+2.0.0.patch
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,34 @@ | ||
# Npm library 'patch-package' uses this file. | ||
# This patch fixes a compatibility problem between start-server-and-test and | ||
# smashtest. Track the issue here: | ||
# https://github.com/bahmutov/start-server-and-test/issues/368 | ||
# Once it's fixed, this patch can be deleted. (But keep the next one.) | ||
diff --git a/node_modules/start-server-and-test/src/index.js b/node_modules/start-server-and-test/src/index.js | ||
index cca10d0..c84db6e 100644 | ||
--- a/node_modules/start-server-and-test/src/index.js | ||
+++ b/node_modules/start-server-and-test/src/index.js | ||
@@ -44,7 +44,7 @@ function waitAndRun ({ start, url, runFn, namedArguments }) { | ||
|
||
debug('starting server with command "%s", verbose mode?', start, isDebug()) | ||
|
||
- const server = execa(start, { shell: true, stdio: 'inherit' }) | ||
+ const server = execa(start, { shell: true, stdio: ['ignore', 'inherit', 'inherit'] }) | ||
let serverStopped | ||
|
||
function stopServer () { | ||
# This is not a bug in the library per se, but it's a dynamic require() call which | ||
# Rollup can't compile into an import statement. And we're ESM. | ||
diff --git a/node_modules/start-server-and-test/src/utils.js b/node_modules/start-server-and-test/src/utils.js | ||
index abd1a69..c5dad2c 100644 | ||
--- a/node_modules/start-server-and-test/src/utils.js | ||
+++ b/node_modules/start-server-and-test/src/utils.js | ||
@@ -153,7 +153,8 @@ const isPackageScriptName = command => { | ||
if (!existsSync(packageFilename)) { | ||
return false | ||
} | ||
- const packageJson = require(packageFilename) | ||
+ const fs = require('fs') | ||
+ const packageJson = JSON.parse(fs.readFileSync(packageFilename, 'utf8')) | ||
if (!packageJson.scripts) { | ||
return false | ||
} |
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,41 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import babel from '@rollup/plugin-babel'; | ||
import json from '@rollup/plugin-json'; | ||
import strip from '@rollup/plugin-strip'; | ||
|
||
const removeShebang = { | ||
name: 'remove-shebang', | ||
transform(code, id) { | ||
if (/node_modules/.test(id)) { | ||
const newCode = code.replace(/^#!.*/, ''); | ||
return { | ||
code: newCode, | ||
map: null | ||
}; | ||
} | ||
} | ||
}; | ||
|
||
export default { | ||
input: './node_modules/start-server-and-test/src/bin/start.js', | ||
output: { | ||
file: './bundle.js', | ||
format: 'es' | ||
}, | ||
plugins: [ | ||
removeShebang, | ||
json(), | ||
resolve({ preferBuiltins: true }), | ||
commonjs(), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
babelHelpers: 'bundled', | ||
presets: ['@babel/preset-env'] | ||
}), | ||
strip({ | ||
include: ['./node_modules/start-server-and-test/**/*.(js|mjs)'] | ||
}) | ||
], | ||
external: [] | ||
}; |