File tree Expand file tree Collapse file tree 5 files changed +31
-15
lines changed Expand file tree Collapse file tree 5 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,10 @@ jobs:
18
18
node-version : ${{ matrix.node-version }}
19
19
- run : yarn --frozen-lockfile
20
20
- run : yarn -s build
21
- - run : yarn -s test runtime/app runtime/schema/settings lib/build runtime/schema/index lib/nexus-schema-backing-types lib/graphql-client runtime/server runtime/schema/settings-mapper lib/plugin lib/add-to-context-extractor
21
+ - run : yarn -s test runtime/app runtime/schema/settings lib/build runtime/schema/index lib/nexus-schema-backing-types lib/graphql-client runtime/server runtime/schema/settings-mapper lib/plugin lib/add-to-context-extractor lib/glocal
22
22
# todo
23
23
# lib/layout
24
- # lib/glocal
25
24
# lib/watcher
26
-
27
25
unit-tests :
28
26
runs-on : ubuntu-latest
29
27
strategy :
38
36
- run : yarn --frozen-lockfile
39
37
- run : yarn -s build
40
38
- run : yarn -s test:unit
41
-
42
39
system-tests :
43
40
runs-on : ubuntu-latest
44
41
strategy :
56
53
- run : yarn -s build
57
54
- name : Setup global git user
58
55
run : |
59
- # For nexus create app flow which will make an init commit
56
+ # For nexus create app flow which will make an init commit
60
57
git config --global user.name prisma-labs
61
58
git config --global user.email [email protected]
62
59
- run : yarn -s test system/${{matrix.test-case}}
Original file line number Diff line number Diff line change 18
18
node-version : ${{ matrix.node-version }}
19
19
- run : yarn --frozen-lockfile
20
20
- run : yarn -s build
21
- - run : yarn -s test runtime/app runtime/schema/settings lib/build runtime/schema/index lib/nexus-schema-backing-types lib/graphql-client runtime/server runtime/schema/settings-mapper lib/plugin lib/add-to-context-extractor
21
+ - run : yarn -s test runtime/app runtime/schema/settings lib/build runtime/schema/index lib/nexus-schema-backing-types lib/graphql-client runtime/server runtime/schema/settings-mapper lib/plugin lib/add-to-context-extractor lib/glocal
22
22
# todo
23
23
# lib/layout
24
- # lib/glocal
25
24
# lib/watcher
26
25
27
26
unit-tests :
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export function findFileRecurisvelyUpwardSync(
69
69
break
70
70
}
71
71
72
- if ( currentDir === '/' ) {
72
+ if ( isRootPath ( currentDir ) ) {
73
73
break
74
74
}
75
75
@@ -232,3 +232,23 @@ export async function isEmptyDir(dirPath: string): Promise<boolean> {
232
232
const contents = await FS . listAsync ( dirPath )
233
233
return contents === undefined || contents . length === 0
234
234
}
235
+
236
+ // https://github.com/iojs/io.js/blob/5883a59b21a97e8b7339f435c977155a2c29ba8d/lib/path.js#L43
237
+ const windowsPathRegex = / ^ (?: [ a - z A - Z ] : | [ \\ / ] { 2 } [ ^ \\ / ] + [ \\ / ] + [ ^ \\ / ] + ) ? [ \\ / ] $ /
238
+
239
+ /**
240
+ * Ask whether the given path is a root path or not.
241
+ *
242
+ * @remarks
243
+ *
244
+ * Take from https://github.com/sindresorhus/is-root-path/blob/master/index.js
245
+ */
246
+ export function isRootPath ( path : string ) {
247
+ path = path . trim ( )
248
+
249
+ if ( path === '' ) {
250
+ return false
251
+ }
252
+
253
+ return process . platform === 'win32' ? windowsPathRegex . test ( path ) : path === '/'
254
+ }
Original file line number Diff line number Diff line change 1
1
import * as path from 'path'
2
2
import * as TestContext from '../test-context'
3
- import { Param1 , repalceInObject } from '../utils'
3
+ import { normalizePathsInData , Param1 } from '../utils'
4
4
import { detectExecLayout } from './detect-exec-layout'
5
5
6
6
const ctx = TestContext . compose ( TestContext . tmpDir ( ) , TestContext . fs ( ) , ( ctx ) => {
7
7
return {
8
8
detectExecLayout : ( input ?: Partial < Param1 < typeof detectExecLayout > > ) => {
9
- return repalceInObject (
10
- ctx . tmpDir ,
11
- '/__dynamic__' ,
9
+ return normalizePathsInData (
12
10
detectExecLayout ( {
13
11
depName : 'a' ,
14
12
cwd : ctx . tmpDir ,
15
13
scriptPath : ctx . fs . path ( 'some/other/bin/a' ) ,
16
14
...input ,
17
- } )
15
+ } ) ,
16
+ ctx . tmpDir ,
17
+ '/__dynamic__'
18
18
)
19
19
} ,
20
20
}
@@ -54,7 +54,6 @@ describe('node project detection', () => {
54
54
} )
55
55
} )
56
56
it ( 'if package.json not present then is not a node project' , ( ) => {
57
- expect ( ctx . detectExecLayout ( ) . nodeProject ) . toEqual ( false )
58
57
expect ( ctx . detectExecLayout ( ) ) . toMatchObject ( {
59
58
nodeProject : false ,
60
59
toolProject : false ,
Original file line number Diff line number Diff line change @@ -124,8 +124,9 @@ export function detectExecLayout(input: Input): ExecScenario {
124
124
125
125
let isToolProject = null
126
126
try {
127
+ // todo test that not using Path.posix will break on windows
127
128
isToolProject =
128
- typeof require ( Path . join ( projectDir , 'package.json' ) ) ?. dependencies ?. [ input . depName ] === 'string'
129
+ typeof require ( Path . posix . join ( projectDir , 'package.json' ) ) ?. dependencies ?. [ input . depName ] === 'string'
129
130
} catch ( e ) {
130
131
console . log ( e )
131
132
}
You can’t perform that action at this time.
0 commit comments