@@ -5,6 +5,7 @@ import fs, { copy } from 'fs-extra'
5
5
import path , { join } from 'path'
6
6
import tempy from 'tempy'
7
7
import { fileURLToPath } from 'url'
8
+ import os from 'os'
8
9
9
10
const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
10
11
@@ -16,26 +17,34 @@ async function setUpProject (project) {
16
17
17
18
await copy ( join ( __dirname , 'fixtures' , 'projects' , project ) , projectDir )
18
19
const nodeModulesPath = path . resolve ( __dirname , '../node_modules' )
20
+ const projectNodeModulesPath = path . join ( projectDir , 'node_modules' )
21
+ const aegirPath = path . resolve ( __dirname , '..' )
19
22
20
23
// simulate having installed aegir
21
24
for ( const entry of await fs . readdir ( nodeModulesPath ) ) {
22
- if ( entry === '.' || entry === '..' ) {
25
+ if ( entry === '.' || entry === '..' || entry === '.bin' ) {
23
26
continue
24
27
}
25
28
26
29
// symlink dep
27
- await fs . createSymlink ( path . join ( nodeModulesPath , entry ) , path . join ( projectDir , 'node_modules' , entry ) , 'dir' )
30
+ await fs . createSymlink ( path . join ( nodeModulesPath , entry ) , path . join ( projectNodeModulesPath , entry ) , 'dir' )
28
31
}
29
32
30
33
// link aegir into project
31
- await execa ( 'npm' , [ 'link' , path . resolve ( __dirname , '..' ) ] , {
32
- cwd : projectDir
33
- } )
34
+ await fs . mkdir ( path . join ( projectNodeModulesPath , '.bin' ) )
35
+ await fs . createSymlink ( aegirPath , path . join ( projectNodeModulesPath , 'aegir' ) , 'dir' )
36
+ await fs . createSymlink ( path . join ( aegirPath , 'src' , 'index.js' ) , path . join ( projectNodeModulesPath , '.bin' , 'aegir' ) , 'file' )
34
37
35
38
return projectDir
36
39
}
37
40
38
41
describe ( 'test' , ( ) => {
42
+ if ( os . platform ( ) === 'win32' ) {
43
+ describe . skip ( 'Skipping tests on windows because symlinking works differently' , ( ) => { } )
44
+
45
+ return
46
+ }
47
+
39
48
describe ( 'esm' , function ( ) {
40
49
let projectDir = ''
41
50
0 commit comments