Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Turtles handles server start/shutdown and client side test in a headless browser (mocha-headless-chrome).
This module is still work in progress.
Allows to start multiple servers, multiple clients, with multiple templates (optional).
var Turtle = require('turtle');
var turtle = new Turtle(8686);
turtle.server({
path: __dirname + '/server/always_ok_server.js',
args: ['--port', '4200'],
started: /^Server started/img
});
turtle.template({
name: 'myJQueryTemplate',
scripts: [
__dirname + '/lib/jQuery.js'
]
});
turtle.client({
name: 'client1',
template: 'myJQueryTemplate'
}).
test({
path: __dirname + "/client",
filter: /\.test1\.client\.js$/im
});
turtle.client({
name: 'client2',
template: 'myJQueryTemplate'
}).
test({
path: __dirname + "/client/global_variable.test2.client.js"
});
turtle.run();
This is the main test runner. It serves the test files on the port given in parameter. Default is 8686
.
node
Creates and returns the new client for chaining.
A Client
is an instance of headless browser. There is always one default client. Each client is started in a
forked process. They are independent and there is no guaranty that they will run at exactly the same time.
A template is a HTML wrapper that embeds tests. It should include all the javascript libraries that are needed by the tests.
In the background, turtle will generate the test file in the tmp directory of your OS. This file is automatically deleted when turtle is done.
Templates are tied to a client. If you define only one template, every client will use the same template but you could declare a different template for each client.
Turtle automatically embeds mocha and uses the 'bdd' test format.
The name of a template to override. Any file added will be appended to the already defined ones.
turtle.template({
name: 'templateName',
css: [
'maybe/a/path/to/mocha.css'
],
scripts: [
'../path/to/my/included/library.js',
'./another/path/to/another/lib.js'
]
})
Then the override:
turtle.template({
name: 'overridenTemplateName',
override: 'templateName',
scripts: [
'./another/path/to/another/lib.js'
]
})
Keep the turtle file server running after the tests are done.
Exports itself to the module passed in parameter. It allows to reuse templates and server definitions. See the tests for an example.
Effectively run the tests.
The callback takes one argument which is an exit code. If zero, all tests are successful. If different than zero, at least one of the tests failed.
When no callback is defined the process will exit with an exit code different than zero if there is a test failure.
Add one or several tests to the current client.
Do not delete the html test files after the tests have ended. Using this will output the path of the test files in the console.
turtle.client('templateName')
to turtle.client({template: 'templateName'})
Copyright 2013, Zendesk Inc. Licensed under the Apache License Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
FAQs
Carries your UI tests in a chrome headless browser
The npm package turtle receives a total of 130 weekly downloads. As such, turtle popularity was classified as not popular.
We found that turtle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.