Skip to content
Merged
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
18 changes: 17 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ suite('create-package-json', () => {
assert.strictEqual(pkg.private, true);
});

// Remove null/undefined keys
test('remove null/undefined keys', async () => {
await fix.setup();
const pkg = await createPackageJson({
private: null
});

assert.strictEqual(pkg.private, undefined);
});

test('scaffold scripts', async () => {
await fix.setup();
const pkg = await createPackageJson();
Expand Down Expand Up @@ -277,9 +287,15 @@ suite('create-package-json', () => {
assert.deepStrictEqual(pkg.keywords, npmInitPkg.keywords);
assert.strictEqual(pkg.license, npmInitPkg.license);

// Handle different behavior for node versions
if (parseInt(process.version.split(/v|\./)[1], 10) < 24) {
assert.notStrictEqual(pkg.type, npmInitPkg.type);
} else {
assert.strictEqual(pkg.type, npmInitPkg.type);
}

// Should be different
assert.notStrictEqual(pkg.author, npmInitPkg.author, JSON.stringify([pkg.author, npmInitPkg.author]));
assert.notStrictEqual(pkg.type, npmInitPkg.type, JSON.stringify([pkg.type, npmInitPkg.type]));
});
});
});
Loading