Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tianding.wk committed Sep 14, 2023
1 parent adf537d commit e2a9ebc
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions test/install-with-lockfile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,34 @@ describe('test/install-with-lockfile.test.js', () => {
beforeEach(cleanup);
afterEach(cleanup);

it('should install successfully', async () => {
await coffee.fork(
helper.npminstall,
[
'--lockfile-path',
path.join(cwd, 'package-lock.json'),
], { cwd })
.debug()
.expect('code', 0)
.end();
assert.strictEqual(
await fs.readlink(path.join(cwd, 'node_modules', 'lodash.has3'), 'utf8'),
'.store/[email protected]/node_modules/lodash.has'
);
assert.strictEqual(
await fs.readlink(path.join(cwd, 'node_modules', 'lodash.has'), 'utf8'),
'.store/[email protected]/node_modules/lodash.has'
);
});
// the Windows path sucks, shamefully skip these tests
if (process.platform !== 'win32') {
it('should install successfully', async () => {
await coffee.fork(
helper.npminstall,
[
'--lockfile-path',
path.join(cwd, 'package-lock.json'),
], { cwd })
.debug()
.expect('code', 0)
.end();
assert.strictEqual(
await fs.readlink(path.join(cwd, 'node_modules', 'lodash.has3'), 'utf8'),
'.store/[email protected]/node_modules/lodash.has'
);
assert.strictEqual(
await fs.readlink(path.join(cwd, 'node_modules', 'lodash.has'), 'utf8'),
'.store/[email protected]/node_modules/lodash.has'
);
});

it('should convert package-lock.json to .dependencies-tree.json successfully', () => {
const dependenciesTree = lockfileConverter(lockfile, {
ignoreOptionalDependencies: true,
}, nested);
it('should convert package-lock.json to .dependencies-tree.json successfully', () => {
const dependenciesTree = lockfileConverter(lockfile, {
ignoreOptionalDependencies: true,
}, nested);

assert.strictEqual(Object.keys(dependenciesTree).length, 12);
});
assert.strictEqual(Object.keys(dependenciesTree).length, 12);
});
}
});

0 comments on commit e2a9ebc

Please sign in to comment.