Lines Matching defs:const
0 const t = require('tap')
2 const { basename } = require('path')
3 const tmock = require('../../fixtures/tmock')
4 const mockNpm = require('../../fixtures/mock-npm')
6 const CURRENT_VERSION = '123.420.69'
7 const CURRENT_MAJOR = '122.420.69'
8 const CURRENT_MINOR = '123.419.69'
9 const CURRENT_PATCH = '123.420.68'
10 const NEXT_VERSION = '123.421.70'
11 const NEXT_MINOR = '123.420.70'
12 const NEXT_PATCH = '123.421.69'
13 const CURRENT_BETA = '124.0.0-beta.99999'
14 const HAVE_BETA = '124.0.0-beta.0'
16 const runUpdateNotifier = async (t, {
29 const mockFs = {
54 const MANIFEST_REQUEST = []
55 const mockPacote = {
64 const manifestV = spec === 'npm@latest' ? CURRENT_VERSION
70 const mocks = {
78 const mock = await mockNpm(t, {
86 const updateNotifier = tmock(t, '{LIB}/utils/update-notifier.js', mocks)
88 const result = await updateNotifier(mock.npm)
98 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t)
106 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, {
115 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, {
127 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, {
139 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t)
145 const STAT_ERROR = new Error('blorg')
146 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, { STAT_ERROR })
152 const WRITE_ERROR = new Error('grolb')
153 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, { WRITE_ERROR })
159 const PACOTE_ERROR = new Error('pah-KO-tchay')
160 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, { PACOTE_ERROR })
166 const {
173 const reqs = ['npm@latest', `npm@^${NEXT_VERSION}`]
177 const {
184 const reqs = [`npm@^${CURRENT_BETA}`]
189 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, { mocks: {
199 const STAT_MTIME = Date.now() - 1000 * 60 * 60 * 24 * 7 + 1000 * 60 * 5
200 const { wroteFile, result, MANIFEST_REQUEST } = await runUpdateNotifier(t, { STAT_MTIME })
208 const STAT_MTIME = Date.now() - 1000 * 60 * 60 * 24 + 1000 * 60 * 5
209 const {
223 const cases = {
232 for (const [version, reqs] of Object.entries(cases)) {
233 for (const color of [false, 'always']) {
235 const {