You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: workspaces/libnpmversion/test/is-workspace-safe.js
+31-12
Original file line number
Diff line number
Diff line change
@@ -9,46 +9,65 @@ t.test('all the potential states', async t => {
9
9
name: 'foo'
10
10
}
11
11
constdir=t.testdir({
12
-
'git': {
12
+
git: {
13
13
'package.json': JSON.stringify({
14
14
...pkg,
15
15
workspaces: [
16
-
"packages/a"
17
-
]
16
+
'packages/a',
17
+
],
18
18
},null,2),
19
19
},
20
20
'git/packages/a': {
21
21
'package.json': JSON.stringify({
22
-
...pkg
22
+
...pkg,
23
23
},null,2),
24
24
},
25
25
'git/other': {},
26
26
'not-git': {},
27
27
'git-too': {
28
28
'package.json': JSON.stringify({
29
-
...pkg
29
+
...pkg,
30
30
},null,2),
31
31
},
32
-
'git-too/subdir': {}
32
+
'git-too/subdir': {},
33
33
})
34
34
35
35
awaitt.test('no git',asynct=>{
36
-
t.ok(awaitisWorkspaceSafe(null,`${dir}/not-git`),'should be safe because there is no git')
36
+
t.ok(awaitisWorkspaceSafe(
37
+
null,
38
+
`${dir}/not-git`
39
+
),'should be safe because there is no git')
37
40
})
38
41
39
42
awaitt.test('is git root',asynct=>{
40
-
t.ok(awaitisWorkspaceSafe(`${dir}/git`,`${dir}/git`,`${dir}/git`),'should be safe because cwd is git root')
43
+
t.ok(awaitisWorkspaceSafe(
44
+
`${dir}/git`,
45
+
`${dir}/git`,
46
+
`${dir}/git`
47
+
),'should be safe because cwd is git root')
41
48
})
42
49
43
50
awaitt.test('top level package has workspaces',asynct=>{
44
-
t.ok(awaitisWorkspaceSafe(`${dir}/git`,`${dir}/git`,`${dir}/git/other`),'should be safe because we see the workspaces')
51
+
t.ok(awaitisWorkspaceSafe(
52
+
`${dir}/git`,
53
+
`${dir}/git`,
54
+
`${dir}/git/other`
55
+
),'should be safe because we see the workspaces')
45
56
})
46
57
47
58
awaitt.test('in workspace',asynct=>{
48
-
t.notOk(awaitisWorkspaceSafe(`${dir}/git`,`${dir}${path.sep}git${path.sep}packages${path.sep}a`,`${dir}${path.sep}git${path.sep}packages${path.sep}a`),'should return false for being in a workspace')
0 commit comments