Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

replace deprecated assert.equal and assert.deepEqual #1063

Merged
merged 1 commit into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/producer.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export default function ({ backpack, bakes, slash, target }) {
));
}

assert.equal(stripe.store, STORE_CONTENT); // others must be buffers from walker
assert.strictEqual(stripe.store, STORE_CONTENT); // others must be buffers from walker
return cb(undefined, pipeToNewMeter(fs.createReadStream(stripe.file)));
} else {
assert(false, 'producer: bad stripe');
Expand Down
2 changes: 1 addition & 1 deletion prelude/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ exports.substituteDenominator = function (f, denominator) {
};

exports.snapshotify = function (file, slash) {
assert.equal(file, normalizePath(file));
assert.strictEqual(file, normalizePath(file));
return injectSnapshot(replaceSlashes(file, slash));
};

Expand Down
2 changes: 1 addition & 1 deletion test/test-46-multi-arch-2/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(right, '42\n');
assert.strictEqual(right, '42\n');
utils.vacuum.sync(output);
176 changes: 88 additions & 88 deletions test/test-48-common/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,106 +13,106 @@ function substituteMany (files) {
}

if (process.platform === 'win32') {
assert.equal('c:', common.normalizePath('c:'));
assert.equal('C:\\', common.normalizePath('c:\\'));
assert.equal('C:\\', common.normalizePath('c:\\\\'));
assert.equal('C:\\snapshot', common.normalizePath('c:\\snapshot'));
assert.equal('C:\\snapshoter', common.normalizePath('c:\\snapshoter'));
assert.equal('C:\\snapshot', common.normalizePath('c:\\snapshot\\'));
assert.equal('C:\\snapshoter', common.normalizePath('c:\\snapshoter\\'));
assert.equal('C:\\snapshot\\foo', common.normalizePath('c:\\snapshot\\\\foo'));
assert.equal('C:\\snapshot\\foo\\bar', common.normalizePath('c:\\snapshot\\\\foo\\\\bar\\/\\\\'));

assert.equal(common.insideSnapshot('c:'), false);
assert.equal(common.insideSnapshot('c:\\'), false);
assert.equal(common.insideSnapshot('c:\\foo'), false);
assert.equal(common.insideSnapshot('c:\\foo\\snapshot'), false);
assert.equal(common.insideSnapshot('c:\\snapshot'), true);
assert.equal(common.insideSnapshot('c:\\snapshoter'), false);
assert.equal(common.insideSnapshot('c:\\snapshot\\'), true);
assert.equal(common.insideSnapshot('c:\\snapshoter\\'), false);
assert.equal(common.insideSnapshot('c:\\snapshot\\\\'), true);
assert.equal(common.insideSnapshot('c:\\snapshot\\foo'), true);
assert.equal(common.insideSnapshot('c:\\snapshoter\\foo'), false);

assert.equal('c:\\', common.stripSnapshot('c:\\'));
assert.equal('c:\\\\', common.stripSnapshot('c:\\\\'));
assert.equal('C:\\**\\', common.stripSnapshot('c:\\snapshot'));
assert.equal('c:\\snapshoter', common.stripSnapshot('c:\\snapshoter'));
assert.equal('C:\\**\\', common.stripSnapshot('c:\\snapshot\\'));
assert.equal('c:\\snapshoter\\', common.stripSnapshot('c:\\snapshoter\\'));
assert.equal('C:\\**\\foo', common.stripSnapshot('c:\\snapshot\\\\foo'));
assert.equal('C:\\**\\foo\\bar', common.stripSnapshot('c:\\snapshot\\\\foo\\\\bar\\/\\\\'));

assert.equal('C:\\snapshot', common.snapshotify('C:\\'));
assert.equal('C:\\snapshot\\foo', common.snapshotify('C:\\foo'));
assert.equal('C:\\snapshot\\foo\\bar', common.snapshotify('C:\\foo\\bar'));

assert.equal('foo', common.removeUplevels('..\\foo'));
assert.equal('foo', common.removeUplevels('..\\..\\foo'));
assert.equal('.\\foo', common.removeUplevels('.\\foo'));
assert.equal('.', common.removeUplevels('.'));
assert.equal('.', common.removeUplevels('..'));
assert.equal('.', common.removeUplevels('..\\..'));

assert.deepEqual(substituteMany(
assert.strictEqual('c:', common.normalizePath('c:'));
assert.strictEqual('C:\\', common.normalizePath('c:\\'));
assert.strictEqual('C:\\', common.normalizePath('c:\\\\'));
assert.strictEqual('C:\\snapshot', common.normalizePath('c:\\snapshot'));
assert.strictEqual('C:\\snapshoter', common.normalizePath('c:\\snapshoter'));
assert.strictEqual('C:\\snapshot', common.normalizePath('c:\\snapshot\\'));
assert.strictEqual('C:\\snapshoter', common.normalizePath('c:\\snapshoter\\'));
assert.strictEqual('C:\\snapshot\\foo', common.normalizePath('c:\\snapshot\\\\foo'));
assert.strictEqual('C:\\snapshot\\foo\\bar', common.normalizePath('c:\\snapshot\\\\foo\\\\bar\\/\\\\'));

assert.strictEqual(common.insideSnapshot('c:'), false);
assert.strictEqual(common.insideSnapshot('c:\\'), false);
assert.strictEqual(common.insideSnapshot('c:\\foo'), false);
assert.strictEqual(common.insideSnapshot('c:\\foo\\snapshot'), false);
assert.strictEqual(common.insideSnapshot('c:\\snapshot'), true);
assert.strictEqual(common.insideSnapshot('c:\\snapshoter'), false);
assert.strictEqual(common.insideSnapshot('c:\\snapshot\\'), true);
assert.strictEqual(common.insideSnapshot('c:\\snapshoter\\'), false);
assert.strictEqual(common.insideSnapshot('c:\\snapshot\\\\'), true);
assert.strictEqual(common.insideSnapshot('c:\\snapshot\\foo'), true);
assert.strictEqual(common.insideSnapshot('c:\\snapshoter\\foo'), false);

assert.strictEqual('c:\\', common.stripSnapshot('c:\\'));
assert.strictEqual('c:\\\\', common.stripSnapshot('c:\\\\'));
assert.strictEqual('C:\\**\\', common.stripSnapshot('c:\\snapshot'));
assert.strictEqual('c:\\snapshoter', common.stripSnapshot('c:\\snapshoter'));
assert.strictEqual('C:\\**\\', common.stripSnapshot('c:\\snapshot\\'));
assert.strictEqual('c:\\snapshoter\\', common.stripSnapshot('c:\\snapshoter\\'));
assert.strictEqual('C:\\**\\foo', common.stripSnapshot('c:\\snapshot\\\\foo'));
assert.strictEqual('C:\\**\\foo\\bar', common.stripSnapshot('c:\\snapshot\\\\foo\\\\bar\\/\\\\'));

assert.strictEqual('C:\\snapshot', common.snapshotify('C:\\'));
assert.strictEqual('C:\\snapshot\\foo', common.snapshotify('C:\\foo'));
assert.strictEqual('C:\\snapshot\\foo\\bar', common.snapshotify('C:\\foo\\bar'));

assert.strictEqual('foo', common.removeUplevels('..\\foo'));
assert.strictEqual('foo', common.removeUplevels('..\\..\\foo'));
assert.strictEqual('.\\foo', common.removeUplevels('.\\foo'));
assert.strictEqual('.', common.removeUplevels('.'));
assert.strictEqual('.', common.removeUplevels('..'));
assert.strictEqual('.', common.removeUplevels('..\\..'));

assert.deepStrictEqual(substituteMany(
[ 'C:\\long\\haired\\freaky\\people', 'C:\\long\\haired\\aliens' ]),
[ 'C:\\freaky\\people', 'C:\\aliens' ]);

assert.deepEqual(substituteMany(
assert.deepStrictEqual(substituteMany(
[ 'C:\\long\\haired\\freaky\\people', 'C:\\long\\hyphen\\sign' ]),
[ 'C:\\haired\\freaky\\people', 'C:\\hyphen\\sign' ]);

assert.deepEqual(substituteMany(
assert.deepStrictEqual(substituteMany(
[ 'C:\\long\\haired\\freaky\\people', 'D:\\long\\hyphen\\sign' ]),
[ 'C:\\long\\haired\\freaky\\people', 'D:\\long\\hyphen\\sign' ]);
} else {
assert.equal('/', common.normalizePath('/'));
assert.equal('/', common.normalizePath('//'));
assert.equal('/snapshot', common.normalizePath('/snapshot'));
assert.equal('/snapshoter', common.normalizePath('/snapshoter'));
assert.equal('/snapshot', common.normalizePath('/snapshot/'));
assert.equal('/snapshoter', common.normalizePath('/snapshoter/'));
assert.equal('/snapshot/foo', common.normalizePath('/snapshot//foo'));
assert.equal('/snapshot/foo/bar', common.normalizePath('/snapshot//foo//bar/\\//'));

assert.equal(common.insideSnapshot(''), false);
assert.equal(common.insideSnapshot('/'), false);
assert.equal(common.insideSnapshot('/foo'), false);
assert.equal(common.insideSnapshot('/foo/snapshot'), false);
assert.equal(common.insideSnapshot('/snapshot'), true);
assert.equal(common.insideSnapshot('/snapshoter'), false);
assert.equal(common.insideSnapshot('/snapshot/'), true);
assert.equal(common.insideSnapshot('/snapshoter/'), false);
assert.equal(common.insideSnapshot('/snapshot//'), true);
assert.equal(common.insideSnapshot('/snapshot/foo'), true);
assert.equal(common.insideSnapshot('/snapshoter/foo'), false);

assert.equal('/', common.stripSnapshot('/'));
assert.equal('//', common.stripSnapshot('//'));
assert.equal('/**/', common.stripSnapshot('/snapshot'));
assert.equal('/snapshoter', common.stripSnapshot('/snapshoter'));
assert.equal('/**/', common.stripSnapshot('/snapshot/'));
assert.equal('/snapshoter/', common.stripSnapshot('/snapshoter/'));
assert.equal('/**/foo', common.stripSnapshot('/snapshot//foo'));
assert.equal('/**/foo/bar', common.stripSnapshot('/snapshot//foo//bar/\\//'));

assert.equal('/snapshot', common.snapshotify('/'));
assert.equal('/snapshot/foo', common.snapshotify('/foo'));
assert.equal('/snapshot/foo/bar', common.snapshotify('/foo/bar'));

assert.equal('foo', common.removeUplevels('../foo'));
assert.equal('foo', common.removeUplevels('../../foo'));
assert.equal('./foo', common.removeUplevels('./foo'));
assert.equal('.', common.removeUplevels('.'));
assert.equal('.', common.removeUplevels('..'));
assert.equal('.', common.removeUplevels('../..'));

assert.deepEqual(substituteMany(
assert.strictEqual('/', common.normalizePath('/'));
assert.strictEqual('/', common.normalizePath('//'));
assert.strictEqual('/snapshot', common.normalizePath('/snapshot'));
assert.strictEqual('/snapshoter', common.normalizePath('/snapshoter'));
assert.strictEqual('/snapshot', common.normalizePath('/snapshot/'));
assert.strictEqual('/snapshoter', common.normalizePath('/snapshoter/'));
assert.strictEqual('/snapshot/foo', common.normalizePath('/snapshot//foo'));
assert.strictEqual('/snapshot/foo/bar', common.normalizePath('/snapshot//foo//bar/\\//'));

assert.strictEqual(common.insideSnapshot(''), false);
assert.strictEqual(common.insideSnapshot('/'), false);
assert.strictEqual(common.insideSnapshot('/foo'), false);
assert.strictEqual(common.insideSnapshot('/foo/snapshot'), false);
assert.strictEqual(common.insideSnapshot('/snapshot'), true);
assert.strictEqual(common.insideSnapshot('/snapshoter'), false);
assert.strictEqual(common.insideSnapshot('/snapshot/'), true);
assert.strictEqual(common.insideSnapshot('/snapshoter/'), false);
assert.strictEqual(common.insideSnapshot('/snapshot//'), true);
assert.strictEqual(common.insideSnapshot('/snapshot/foo'), true);
assert.strictEqual(common.insideSnapshot('/snapshoter/foo'), false);

assert.strictEqual('/', common.stripSnapshot('/'));
assert.strictEqual('//', common.stripSnapshot('//'));
assert.strictEqual('/**/', common.stripSnapshot('/snapshot'));
assert.strictEqual('/snapshoter', common.stripSnapshot('/snapshoter'));
assert.strictEqual('/**/', common.stripSnapshot('/snapshot/'));
assert.strictEqual('/snapshoter/', common.stripSnapshot('/snapshoter/'));
assert.strictEqual('/**/foo', common.stripSnapshot('/snapshot//foo'));
assert.strictEqual('/**/foo/bar', common.stripSnapshot('/snapshot//foo//bar/\\//'));

assert.strictEqual('/snapshot', common.snapshotify('/'));
assert.strictEqual('/snapshot/foo', common.snapshotify('/foo'));
assert.strictEqual('/snapshot/foo/bar', common.snapshotify('/foo/bar'));

assert.strictEqual('foo', common.removeUplevels('../foo'));
assert.strictEqual('foo', common.removeUplevels('../../foo'));
assert.strictEqual('./foo', common.removeUplevels('./foo'));
assert.strictEqual('.', common.removeUplevels('.'));
assert.strictEqual('.', common.removeUplevels('..'));
assert.strictEqual('.', common.removeUplevels('../..'));

assert.deepStrictEqual(substituteMany(
[ '/long/haired/freaky/people', '/long/haired/aliens' ]),
[ '/freaky/people', '/aliens' ]);

assert.deepEqual(substituteMany(
assert.deepStrictEqual(substituteMany(
[ '/long/haired/freaky/people', '/long/hyphen/sign' ]),
[ '/haired/freaky/people', '/hyphen/sign' ]);
}
2 changes: 1 addition & 1 deletion test/test-50-api/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require('../../').exec([
output, [], {}
);

assert.equal(right, '42\n');
assert.strictEqual(right, '42\n');
utils.vacuum.sync(output);
});
}).catch(function (error) {
Expand Down
6 changes: 3 additions & 3 deletions test/test-50-arguments/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ utils.pkg.sync([
]);

right = utils.spawn.sync(output, [ '42' ], {});
assert.equal(right, '42\n');
assert.strictEqual(right, '42\n');
right = utils.spawn.sync(output, [ '-ft' ], {});
assert.equal(right, '-ft\n');
assert.strictEqual(right, '-ft\n');
right = utils.spawn.sync(output, [ '--fourty-two' ], {});
assert.equal(right, '--fourty-two\n');
assert.strictEqual(right, '--fourty-two\n');
utils.vacuum.sync(output);
2 changes: 1 addition & 1 deletion test/test-50-ast-parsing-2/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ right.split('\n').some(function (line) {
});

right = rightLines.join('\n') + '\n';
assert.equal(left, right);
assert.strictEqual(left, right);
utils.vacuum.sync(output);
2 changes: 1 addition & 1 deletion test/test-50-ast-parsing/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, right);
assert.strictEqual(left, right);
utils.vacuum.sync(output);
4 changes: 2 additions & 2 deletions test/test-50-bakery-2/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, 'function\n');
assert.equal(right, 'function\n');
assert.strictEqual(left, 'function\n');
assert.strictEqual(right, 'function\n');
utils.vacuum.sync(path.dirname(output));
2 changes: 1 addition & 1 deletion test/test-50-bakery-fetch/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fetch.need({
env: { PKG_EXECPATH: 'PKG_INVOKE_NODEJS' } }
);

assert.equal(right, 'ok\n');
assert.strictEqual(right, 'ok\n');
}).catch(function (error) {
console.error(`> ${error.message}`);
process.exit(2);
Expand Down
4 changes: 2 additions & 2 deletions test/test-50-bakery/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, 'undefined\n');
assert.equal(right, 'undefined\n');
assert.strictEqual(left, 'undefined\n');
assert.strictEqual(right, 'undefined\n');
utils.vacuum.sync(path.dirname(output));
2 changes: 1 addition & 1 deletion test/test-50-chdir-env-var/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname('source/' + output) }
);

assert.equal(right, 'ok\n');
assert.strictEqual(right, 'ok\n');
utils.vacuum.sync(path.dirname('source/' + output));
2 changes: 1 addition & 1 deletion test/test-50-class-to-string/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(right, 'ok\n');
assert.strictEqual(right, 'ok\n');
utils.vacuum.sync(output);
4 changes: 2 additions & 2 deletions test/test-50-console-trace/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ right = right.stderr.split('\n');
var a = right[0];
var b = extractFileName(right[2]);
var c = extractFileName(right[3]);
assert.equal(a, b);
assert.equal(c, 'pkg/prelude/bootstrap.js');
assert.strictEqual(a, b);
assert.strictEqual(c, 'pkg/prelude/bootstrap.js');
utils.vacuum.sync(output);
2 changes: 1 addition & 1 deletion test/test-50-corrupt-executable/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ right = utils.spawn.sync(
stdio: 'pipe', expect: 1 }
);

assert.equal(right.stdout, '');
assert.strictEqual(right.stdout, '');
assert((right.stderr.indexOf('Invalid') >= 0) ||
(right.stderr.indexOf('ILLEGAL') >= 0) ||
(right.stderr.indexOf('SyntaxError') >= 0));
Expand Down
2 changes: 1 addition & 1 deletion test/test-50-extensions/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, right);
assert.strictEqual(left, right);
utils.vacuum.sync(output);
2 changes: 1 addition & 1 deletion test/test-50-for-await-of/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(right, '1\n2\n3\n4\n5\n');
assert.strictEqual(right, '1\n2\n3\n4\n5\n');
utils.vacuum.sync(output);
2 changes: 1 addition & 1 deletion test/test-50-fs-runtime-layer-2/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ right = right.split('\n');
// right may have less lines, premature exit,
// less trusted, so using left.length here
for (let i = 0; i < left.length; i += 1) {
assert.equal(left[i], right[i]);
assert.strictEqual(left[i], right[i]);
}

utils.vacuum.sync(path.dirname(output));
4 changes: 2 additions & 2 deletions test/test-50-fs-runtime-layer-2/test-x-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ function test01 () {
const buffer4 = buffer3;
fs.writeFile(theFile, buffer4, function (error7, wtf2) {
if (process.pkg) {
assert.equal(typeof error7, 'object'); // TODO maybe code=EACCESS?
assert.strictEqual(typeof error7, 'object'); // TODO maybe code=EACCESS?
} else {
assert.equal(error7, null);
assert.strictEqual(error7, null);
}
console.log('typeof wtf2', typeof wtf2);
fs.readdir(theDirectory, function (error8, list) {
Expand Down
2 changes: 1 addition & 1 deletion test/test-50-fs-runtime-layer-3/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(right,
assert.strictEqual(right,
'true\n' +
'false\n' +
'Cannot write to packaged file\n' +
Expand Down
2 changes: 1 addition & 1 deletion test/test-50-global-object/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, right);
assert.strictEqual(left, right);
utils.vacuum.sync(path.dirname(output));
2 changes: 1 addition & 1 deletion test/test-50-many-arrow-functions/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, right);
assert.strictEqual(left, right);
utils.vacuum.sync(output);
2 changes: 1 addition & 1 deletion test/test-50-many-callbacks/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, right);
assert.strictEqual(left, right);
utils.vacuum.sync(output);
2 changes: 1 addition & 1 deletion test/test-50-may-exclude-must-exclude/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ right = right.split('\n').filter(function (line) {
} else return line;
}).join('\n') + '\n';

assert.deepEqual(right.split('\n').slice(0, 16), [
assert.deepStrictEqual(right.split('\n').slice(0, 16), [
'> Warning Cannot resolve \'reqResSomeVar\'',
'> [debug] Cannot resolve \'reqResSomeVarMay\'',
'> Warning Malformed requirement for \'reqResSomeVar\'',
Expand Down
2 changes: 1 addition & 1 deletion test/test-50-may-exclude/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ right = utils.spawn.sync(
{ cwd: path.dirname(output) }
);

assert.equal(left, right);
assert.strictEqual(left, right);
utils.vacuum.sync(path.dirname(output));
Loading