-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support override scripts config (#185)
Follow npm/rfcs#488
- Loading branch information
Showing
2 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,42 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const test = require('node-core-test') | ||
const bugVersions = require('.'); | ||
|
||
let pkgCount = 0; | ||
let versionCount = 0; | ||
for (const name in bugVersions) { | ||
pkgCount++; | ||
const versions = bugVersions[name]; | ||
assert(versions); | ||
for (const version in versions) { | ||
versionCount++; | ||
const item = versions[version]; | ||
assert(item); | ||
assert(item.version || item.dependencies); | ||
if (item.version) { | ||
assert(typeof item.version === 'string'); | ||
} else if (item.dependencies) { | ||
assert(typeof item.dependencies === 'object'); | ||
assert(Object.keys(item.dependencies).length > 0); | ||
} | ||
test('should get bug-versions', () => { | ||
let pkgCount = 0; | ||
let versionCount = 0; | ||
for (const name in bugVersions) { | ||
pkgCount++; | ||
const versions = bugVersions[name]; | ||
assert(versions); | ||
for (const version in versions) { | ||
versionCount++; | ||
const item = versions[version]; | ||
assert(item); | ||
assert(item.version || item.dependencies); | ||
if (item.version) { | ||
assert(typeof item.version === 'string'); | ||
} else if (item.dependencies) { | ||
assert(typeof item.dependencies === 'object'); | ||
assert(Object.keys(item.dependencies).length > 0); | ||
} | ||
|
||
assert(item.reason) | ||
assert(typeof item.reason === 'string'); | ||
assert(item.reason) | ||
assert(typeof item.reason === 'string'); | ||
} | ||
} | ||
} | ||
|
||
console.log('Total: %d bug pkgs and %d bug versions', pkgCount, versionCount); | ||
console.log(''); | ||
console.log('Total: %d bug pkgs and %d bug versions', pkgCount, versionCount); | ||
assert(pkgCount > 0); | ||
assert(versionCount > 0); | ||
}); | ||
|
||
const pkg = require('./package'); | ||
console.log('unsafe-node-versions: %s', JSON.stringify(pkg.config['unsafe-node-versions'], null, 2)); | ||
console.log(''); | ||
console.log('unsafe-alinode-versions: %s', JSON.stringify(pkg.config['unsafe-alinode-versions'], null, 2)); | ||
test('should get "config" field from package.json', () => { | ||
const pkg = require('./package'); | ||
assert(pkg.config['unsafe-node-versions']); | ||
// console.log('unsafe-node-versions: %s', JSON.stringify(pkg.config['unsafe-node-versions'], null, 2)); | ||
assert(pkg.config['unsafe-alinode-versions']); | ||
// console.log('unsafe-alinode-versions: %s', JSON.stringify(pkg.config['unsafe-alinode-versions'], null, 2)); | ||
}); |