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
Expose API #6
Comments
Keeping this open until thoroughly tested. |
I tried it. No success. import { parseNetlifyConfig, Server } from 'netlify-local'
import request from 'superagent'
import test from 'tape'
const startServer: () => Promise<Server> = async () => {
const server = new Server(parseNetlifyConfig('netlify.toml'), 3005)
await server.listen()
return server
}
test('Integration test', (t) => {
t.test('Start a lambda function', async (assert) => {
assert.plan(1)
const server = await startServer()
const response = await request.get('http://localhost:3005/myFunction')
assert.ok(response)
await server.close()
})
}) and I get TAP version 13
# Integration test
# Start a lambda function
(node:7901) UnhandledPromiseRejectionWarning: TypeError: Path must be a string. Received undefined I think my |
Hmm, currently writing some |
Unable to reproduce unfortunately, I'm guessing you've got some more exotic toml usage which If you're able to provide your |
The error was because I do not have a |
Updated OP with correct API usage as of 1.0.0. |
Closing this as it appears to be working as expected in tests and real world usage. |
Would be handy to expose an API so test runners can start & stop the server, optionally with the build system.
Usage
Methods
Config
parseNetlifyConfig()
parseWebpackConfig()
Server
constructor
Server.listen()
Server.close()
Webpack
constructor
Webpack.build()
Webpack.watch()
The text was updated successfully, but these errors were encountered: