Skip to content

Commit

Permalink
test: instructions when encountering symlink error on Windows (#7470)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-maas committed Mar 26, 2022
1 parent 80afb87 commit 0d7ef43
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions scripts/jestGlobalSetup.cjs
Expand Up @@ -21,11 +21,21 @@ module.exports = async () => {

const tempDir = path.resolve(__dirname, '../packages/temp')
await fs.remove(tempDir)
await fs.copy(path.resolve(__dirname, '../packages/playground'), tempDir, {
dereference: false,
filter(file) {
file = file.replace(/\\/g, '/')
return !file.includes('__tests__') && !file.match(/dist(\/|$)/)
}
})
await fs
.copy(path.resolve(__dirname, '../packages/playground'), tempDir, {
dereference: false,
filter(file) {
file = file.replace(/\\/g, '/')
return !file.includes('__tests__') && !file.match(/dist(\/|$)/)
}
})
.catch(async (error) => {
if (error.code === 'EPERM' && error.syscall === 'symlink') {
throw new Error(
'Could not create symlinks. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.'
)
} else {
throw error
}
})
}

0 comments on commit 0d7ef43

Please sign in to comment.