This repository was archived by the owner on Nov 2, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsettings.js
More file actions
64 lines (52 loc) · 1.65 KB
/
settings.js
File metadata and controls
64 lines (52 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'use strict'
const t = require('../')
const settings = require('../settings.js')
t.ok(Array.isArray(settings.stackUtils.internals), 'Array.isArray(settings.stackUtils.internals)')
t.type(settings.rimrafNeeded, 'boolean')
t.not(settings.stackUtils.internals.length, 0)
t.equal(settings.output, process.stdout)
t.matchSnapshot({
...settings,
rimrafNeeded: 'version specific',
rmdirRecursiveSync(dir) {},
rmdirRecursive(dir, cb) {},
output: 'process.stdout',
stackUtils: {
...settings.stackUtils,
internals: []
}
})
t.throws(_ => {
settings.rmdirRecursiveSync = 'this is not a function'
}, TypeError)
t.throws(_ => {
settings.rmdirRecursiveSync = () => {}
}, TypeError)
t.throws(_ => {
settings.rmdirRecursive = 'this is not a function'
}, TypeError)
t.throws(_ => {
settings.rmdirRecursive = () => {}
}, TypeError)
const replacement = dir => {}
const replacementAsync = (dir, cb) => {}
settings.rmdirRecursiveSync = replacement
settings.rmdirRecursive = replacementAsync
t.equal(settings.rimrafNeeded, false)
t.equal(settings.rmdirRecursiveSync, replacement)
t.equal(settings.rmdirRecursive, replacementAsync)
t.equal(settings.snapshotFile('cwd', 'main', 'args'),
require('path').resolve('cwd', 'tap-snapshots', 'mainargs.test.cjs'),
'default function puts it in ./tap-snapshots')
settings.snapshotFile = (cwd, main, args) => [cwd, main, args].join('X')
t.equal(settings.snapshotFile('cwd', 'main', 'args'), 'cwdXmainXargs',
'can override snapshotFile setting function')
let isReady = false
settings.waitForReady().then(() => {
isReady = true;
})
t.equal(isReady, false)
settings.markAsReady()
setTimeout(() => {
t.equal(isReady, true)
})