
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
intern-yadda-loader
Advanced tools
Yadda is a plain-language BDD system for Javascript. Intern is a flexible Javascript test runner. This package loads Yadda features/scenarios/steps as Intern suites/tests.
this.ctx
.this.async()
api).See the Intern User Guide for information on setting up an intern project. Then install yadda
and intern-yadda-loader
:
$ npm install yadda intern-yadda-loader --save-dev
NOTE: Yadda is a peer dependency of intern-yadda-loader
.
// `test/conf.js`
define({
environments: [{browserName: 'phantomjs'}],
loaderOptions: {
packages: [
// Load `intern-yadda-loader` as `yadda`
{ name: 'yadda', location: './node_modules/intern-yadda-loader' },
// Load package containing step definitions
{ name: 'steps', location: './test/steps' }
]
},
functionalSuites: [
// Specify features to load
'yadda!test/features/bottles.feature',
'yadda!test/features/google.feature'
// Also accepts directories, e.g. `yadda!test/features`
],
// Yadda configuration
yadda: {
// An array or string specifying step definition packages to load
steps: [
'steps/bottles-library',
'steps/google-library'
],
// The language to use when parsing the features (default: `English`)
lang: 'English'
}
});
# `test/features/bottles.feature`
Feature: 100 Green Bottles
Scenario: Should fall from the wall
Given 100 green bottles are standing on the wall
When 1 green bottle accidentally falls
And another falls
Then there are 98 green bottles standing on the wall
// `test/steps/bottles-library.js`
define(function (require) {
var expect = require('intern/chai!expect');
return function (library) {
library
.given("$NUM green bottles are standing on the wall", function (number) {
// The context is reused only within the current scenario.
expect(this.ctx.bottles).to.be.undefined;
this.ctx.bottles = parseInt(number);
})
.when("$NUM green bottle accidentally falls", function (number, next) {
// Async using `next` callback.
var ctx = this.ctx;
setTimeout(function () {
ctx.bottles--;
next();
}, 200);
})
.define("And another falls", function () {
// Async using Intern `this.async()` convention.
var ctx = this.ctx;
var deferred = this.async();
setTimeout(function () {
ctx.bottles--;
deferred.resolve();
}, 200);
})
.then("there are $NUM green bottles standing on the wall", function (number) {
expect(this.ctx.bottles).to.equal(parseInt(number));
});
};
});
# `test/features/google.feature`
Feature: Multilingual Google Search
Scenario: Searching Google For The First Time
When I open Google's fr search page
then the title is Google
and the search form exists
When I search for foo
then the title is foo - Recherche Google
and the search for foo was made
and 10 or more results were returned
Scenario: Searching Google Again
When I open Google's ie search page
then the title is Google
and the search form exists
When I search for bar
then the title is bar - Google Search
and the search for bar was made
and 10 or more results were returned
// `test/steps/google-library.js`
define(function (require) {
var expect = require('intern/chai!expect');
return function (library, dictionary) {
// Access to dictionary for custom definitions.
dictionary
.define('LOCALE', /(fr|es|ie)/)
.define('NUM', /(\d+)/);
library
.when("I open Google's $LOCALE search page", function(locale) {
return this.remote.get("http://www.google." + locale + "/");
})
.then("the title is $TITLE", function(title) {
return this.remote
.sleep(500)
.getPageTitle()
.then(function (pageTitle) {
expect(pageTitle).to.equal(title);
});
})
.then("the $ACTION form exists", function(action) {
return this.remote
.findByCssSelector('form[action="/' + action + '"]');
})
.when("I search for $TERM", function(term) {
return this.remote
.findByName('q')
.click()
.type(term + '\n');
})
.then("the search for $TERM was made", function(term) {
var regex = new RegExp('q=' + term);
return this.remote
.sleep(500)
.getCurrentUrl()
.then(function (url) {
expect(url).to.match(new RegExp('q=' + term));
});
})
.then("$NUM or more results were returned", function(number) {
return this.remote
.findAllByCssSelector('h3.r')
.then(function (elements) {
expect(elements).to.have.length.of.at.least(parseInt(number));
});
});
};
});
FAQs
Yadda loader for Intern
We found that intern-yadda-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.