How to use the test.assert function in test

To help you get started, we’ve selected a few test examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jbrantly / yabble / test / modules1.1.1 / wrappedTests / main / program.js View on Github external
"program": function(require, exports, module) {
var test = require('test');

test.assert(require.main != null && require.main === module, 'main module has require.main');

var aMain = require('a').main();
test.assert(aMain != null && aMain === module, 'submodule has require.main');

require.ensure(['b'], function(require) {
	test.assert(require.main != null && require.main === module, 'require.ensure has require.main');
	test.print('DONE', 'info');
});
}}, ["test", "a"]);
github kriskowal / narwhal-lib / tests / commonjs / modules / determinism / submodule / a.js View on Github external
var pass = false;
var test = require('test');
try {
    require('a');
} catch (exception) {
    pass = true;
}
test.assert(pass, 'require does not fall back to relative modules when absolutes are not available.')
github gutentags / system / test / determinism / submodule / a.js View on Github external
var pass = false;
var test = require("test");
try {
    require("a");
} catch (exception) {
    pass = true;
}
test.assert(pass, "require does not fall back to relative modules when absolutes are not available.");
github jbrantly / yabble / test / modules1.0 / wrappedTests / determinism / submodule / a.js View on Github external
"submodule/a": function(require, exports, module) {
var test = require('test');
var pass = false;
var test = require('test');
try {
    require('a');
} catch (exception) {
    pass = true;
}
test.assert(pass, 'require does not fall back to relative modules when absolutes are not available.')

}}, ["test", "a"]);
github smith / commonjscript / extensions / freeAssign / program.js View on Github external
var test = require('test');
foo = function () {};
test.assert(typeof foo != "undefined" && exports.foo == foo, 'free assignment bound to exports');

var a = require('a');
test.assert(a.aVeryUnlikelyIdentifier, 'free assignment exported from other module');
test.assert(typeof aVeryUnlikelyIdentifier == "undefined", 'free assignment not implicitly communicated with common scope');

test.print('DONE', 'info');

test

Node.js 18's node:test, as an npm package

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis