Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
define(function(require) {
var test = require('../../../test')
var a = require('a')
var b = require('biz/b')
var d = require('d')
var e = require('e')
var f = require('f')
test.assert(a.name === 'a', a.name)
test.assert(b.name === 'b', b.name)
test.assert(d.name === 'd', d.name)
test.assert(e.name === 'e', e.name)
test.assert(f.name === 'f', f.name)
seajs.config({
alias: {
'a': 'x', // override alias
'c': './path/to/c'
}
})
//var consoleMsg = global.consoleMsgStack.pop()
//test.assert(consoleMsg === 'The config of alias["a"] is changed from "./path/to/a.js" to "x"', consoleMsg)
require.async('c', function(c) {
test.assert(c.name === 'c', c.name)
require.ensure(["d"], function(require) {
var d = require("d");
equal(d.name, "d", "get d name");
equal(d.b, "b from d", "get b from d");
start();
});
});
define(function(require) {
var test = require('../../test');
test.assert(require('a').name === 'a', 'define(id, deps, fn)');
test.assert(require('./b').name === 'b', 'define(deps, fn)');
test.assert(require('./c').name === 'c', 'define(fn)');
test.assert(require('d').name === 'd', 'define(id, fn)');
test.assert(require('e').name === 'e', 'define(id, object)');
test.assert(require('./f').name === 'f', 'define(object)');
test.done();
});
define(function(require) {
var test = require('../../test');
test.assert(require('a').name === 'a', 'define(id, deps, fn)');
test.assert(require('./b').name === 'b', 'define(deps, fn)');
test.assert(require('./c').name === 'c', 'define(fn)');
test.assert(require('d').name === 'd', 'define(id, fn)');
test.assert(require('e').name === 'e', 'define(id, object)');
test.assert(require('./f').name === 'f', 'define(object)');
test.done();
});
{"oldValue": [7, 8, 9], "newValue": [7, 8, 6]},
{"oldValue": [7, 8, 6], "newValue": [7, 5, 6]},
{"oldValue": [7, 5, 6], "newValue": [4, 5, 6]}
], '"foo" array values are as expected');
Q.deepEqual(data.foo.descriptions, [
"foo array changed",
"foo array changed",
"foo array changed"
], '"foo" descriptions are as expected');
Q.deepEqual(data['d.name'].values, [
{
"newValue": "foo",
"oldValue": "marvin"
}
], '"d.name" values are as expected');
Q.deepEqual(data['d.name'].descriptions, [
"name in data changed"
], '"d.name" descriptions are as expected');
Q.deepEqual(data['od.name'].values, [
{
"newValue": "foo",
"oldValue": "pookie"
}
], '"od.name" values are as expected');
Q.deepEqual(data['od.name'].descriptions, [
"name in otherdata changed"
], '"od.name" descriptions are as expected');
});
scope.$apply(function () {
module.exports = module.prefetch("./b").then(function (id) {
assert.strictEqual(id, "/b.js");
assert.strictEqual(require("./b").name, id);
assert.strictEqual(require("./c").name, "/c.js");
assert.strictEqual(
require("d").name,
"/node_modules/d/index.js"
);
assert.strictEqual(
require("d/package").name,
"/node_modules/d/package.json"
);
return module.prefetch("./nonexistent").catch(function (error) {
assert.ok(error instanceof Error);
assert.ok(error.message.startsWith("Cannot find module"));
});
});
},
Q.deepEqual(data.bar.values, [
{"oldValue": "spam", "newValue": "baz"}
], '"bar" changed values are as expected');
Q.deepEqual(data.bar.descriptions, ["bar string changed"],
'"bar" description(s) are as expected');
Q.deepEqual(data.foo.values, [
{"oldValue": [7, 8, 9], "newValue": [7, 8, 6]},
{"oldValue": [7, 8, 6], "newValue": [7, 5, 6]},
{"oldValue": [7, 5, 6], "newValue": [4, 5, 6]}
], '"foo" array values are as expected');
Q.deepEqual(data.foo.descriptions, [
"foo array changed",
"foo array changed",
"foo array changed"
], '"foo" descriptions are as expected');
Q.deepEqual(data['d.name'].values, [
{
"newValue": "foo",
"oldValue": "marvin"
}
], '"d.name" values are as expected');
Q.deepEqual(data['d.name'].descriptions, [
"name in data changed"
], '"d.name" descriptions are as expected');
Q.deepEqual(data['od.name'].values, [
{
"newValue": "foo",
"oldValue": "pookie"
}
], '"od.name" values are as expected');
Q.deepEqual(data['od.name'].descriptions, [
"name in otherdata changed"